Quiz
Moderator: Neosoft Support
Quiz
Hi guys, ive been trying to produce a program that allows a fastest finger first quiz.
Basically, I have two buzzers.
Each buzzer (when pressed) activates a button on the keyboard and when pressed it shows their name and blocks the other one out.
I have been using the disable and enable object script BUT its not working as it should.
One of the buzzers always seems to be the first each time.
Can anyone shed any light on the issue, or suggest a solve?
Thanks
Basically, I have two buzzers.
Each buzzer (when pressed) activates a button on the keyboard and when pressed it shows their name and blocks the other one out.
I have been using the disable and enable object script BUT its not working as it should.
One of the buzzers always seems to be the first each time.
Can anyone shed any light on the issue, or suggest a solve?
Thanks
Re: Quiz
martinp:
When communicating on this forum, it helps to speak the lingo that other NeoBook users understand ... what is a "buzzer" ? ... what is "a button on the keyboard" ?
When communicating on this forum, it helps to speak the lingo that other NeoBook users understand ... what is a "buzzer" ? ... what is "a button on the keyboard" ?
For each event, post your code here ... and explain what each referenced NeoBook object is.I have been using the disable and enable object script BUT its not working as it should.
One of the buzzers always seems to be the first each time.
Can anyone shed any light on the issue, or suggest a solve?
Re: Quiz
Oops sorry.
I have 2 large physical red buttons that activate keys on the keyboard when they are pressed.
Button 1 and button 2
I have attached a code to each key so that when a buzzer is pressed, it disables the other buzzer.
Loop "1" "2" "[Count]"
If "Button[Count]" "<>" "[Self]"
DisableObject "Button[Count]"
EndIf
EndLoop
The above works BUT it does not disable the 'other' button quick enough.
The project is for a Quiz Night where two teams go head to head.
A question is asked and the first person to buzz in gets to answer the question.
Hence the 'fastest finger first' theme.
Thanks
I have 2 large physical red buttons that activate keys on the keyboard when they are pressed.
Button 1 and button 2
I have attached a code to each key so that when a buzzer is pressed, it disables the other buzzer.
Loop "1" "2" "[Count]"
If "Button[Count]" "<>" "[Self]"
DisableObject "Button[Count]"
EndIf
EndLoop
The above works BUT it does not disable the 'other' button quick enough.
The project is for a Quiz Night where two teams go head to head.
A question is asked and the first person to buzz in gets to answer the question.
Hence the 'fastest finger first' theme.
Thanks
Re: Quiz
As far as i understand your "buzzer" simply simulates a key press on your keyboard?
So i mean you don´t need the loop inside your button script. Simply fire an
If Button 1 is pressed..
and
If Button 2 is pressed..
Or am i missing something?
So i mean you don´t need the loop inside your button script. Simply fire an
If Button 1 is pressed..
Code: Select all
DisableObject "Button2"
...do something more...
If Button 2 is pressed..
Code: Select all
DisableObject "Button1"
...do something more...
Greetings from Germany
Klaus
Klaus
Re: Quiz
martinp:
1) Before you ask the question ...
2) for the Click event for Button1 ...
3) for the Click event for Button2 ...
Have a Text object that will show the value of [FirstResponder].
If you still get unexpected results, tell us ...
a) What are the shortcut keys assigned to Button1 and Button2 ?
b) Which one does NeoBook favour all the time ?
1) Before you ask the question ...
Code: Select all
SetVar "[FirstResponder]" ""
Code: Select all
If "[FirstResponder]" "=" ""
SetVar "[FirstResponder]" "Button1"
Endif
Code: Select all
If "[FirstResponder]" "=" ""
SetVar "[FirstResponder]" "Button2"
Endif
If you still get unexpected results, tell us ...
a) What are the shortcut keys assigned to Button1 and Button2 ?
b) Which one does NeoBook favour all the time ?
Re: Quiz
shortcut keys:
Button 1 is NUM1 (keypad)
Button 2 is NUM2 (keypad)
It does tend to favour button 1......BUT.....could this due to the way that I press the two buttons at the same time?
If anyone presses two buttons at the same time, chances are they will have one finger that maybe more dominant than the other, in other words.....if you are left handed, or right handed??
Button 1 is NUM1 (keypad)
Button 2 is NUM2 (keypad)
It does tend to favour button 1......BUT.....could this due to the way that I press the two buttons at the same time?
If anyone presses two buttons at the same time, chances are they will have one finger that maybe more dominant than the other, in other words.....if you are left handed, or right handed??
Re: Quiz
martinp:
Ctrl+A to Ctrl+Z
Ctrl+Alt+A to Ctrl+Alt+Z
F1 to F12
Ctrl+F1 to Ctrl+F12
Shift+F1 to Shift+F12
Shift+Ctrl+F1 to Shift+Ctrl+F12
Ins, Delete, Backspace and various combinations
... but no number keys ... however, if you choose Ins option, it refers to the key on the numeric pad with the characters 0 and Ins ... and similarly, if you choose the Del option it refers to the key on the numeric pad with the characters decimal point and Del.
On my keyboard, the unshifted key on the numeric pad is End (for 1) and down-arrow (for 2).
Please post here how you managed to define 1 and 2 on the Numeric keypad.
Each time, I (not the fastest finger in the west) could interrupt processing after just one command was serviced ... so code this ...
1) Before you ask the question ...
2) for the Click event for Button1 ...
3) for the Click event for Button2 ...
... and give it your fastest finger ... if NeoBook can service at least one command before the second event code kicks in, then you can examine the contents of [FirstResponder] to see who got in first.
Even if this works on your computer, note that results may be different with older/slower computers and/or faster fingers.
How did you manage to set these shortcuts ? ... NeoBook's dropdown values for the shortcut key selection do not show these options ... in my NeoBook, it offers ...shortcut keys:
Button 1 is NUM1 (keypad)
Button 2 is NUM2 (keypad)
Ctrl+A to Ctrl+Z
Ctrl+Alt+A to Ctrl+Alt+Z
F1 to F12
Ctrl+F1 to Ctrl+F12
Shift+F1 to Shift+F12
Shift+Ctrl+F1 to Shift+Ctrl+F12
Ins, Delete, Backspace and various combinations
... but no number keys ... however, if you choose Ins option, it refers to the key on the numeric pad with the characters 0 and Ins ... and similarly, if you choose the Del option it refers to the key on the numeric pad with the characters decimal point and Del.
On my keyboard, the unshifted key on the numeric pad is End (for 1) and down-arrow (for 2).
Please post here how you managed to define 1 and 2 on the Numeric keypad.
I tried doing this with the Ins and Del keys ... using the commands suggested in my last post ... when I examined the Debugger for the sequence of commands serviced, I did notice that NeoBook halts whatever it is doing (in this case, servicing commands for one Button) and hops on to servicing of commands for the second button ... then coming back to complete the commands for the first button.It does tend to favour button 1......BUT.....could this due to the way that I press the two buttons at the same time?
If anyone presses two buttons at the same time, chances are they will have one finger that maybe more dominant than the other, in other words.....if you are left handed, or right handed?
Each time, I (not the fastest finger in the west) could interrupt processing after just one command was serviced ... so code this ...
1) Before you ask the question ...
Code: Select all
SetVar "[FirstResponder]" ""
Code: Select all
SetVar "[FirstResponder]" "[FirstResponder]Button1, "
Code: Select all
SetVar "[FirstResponder]" "[FirstResponder]Button2, "
Even if this works on your computer, note that results may be different with older/slower computers and/or faster fingers.
Re: Quiz
I did a quick test on my maschine using my code postet above.
This is the result. A friend and i hacked like hell on keys "a" and "l"
(The list is mouch more longer...) seems to me works like a charme
My maschine is a I5 windows 7
This is the result. A friend and i hacked like hell on keys "a" and "l"
(The list is mouch more longer...) seems to me works like a charme
My maschine is a I5 windows 7
a
a
a
l
l
l
a
l
l
l
a
a
l
l
a
l
l
a
a
l
a
l
l
a
l
a
a
a
l
l
a
a
l
l
l
a
a
a
a
l
a
l
l
a
l
a
a
l
l
l
a
l
l
l
l
l
a
a
l
a
l
l
a
l
l
l
a
a
l
Greetings from Germany
Klaus
Klaus
Re: Quiz
Klaus:
On my Windows 10 machine (with AMD A10-7300 processor), I could replicate your experience (I used Ins and Del keys) ... which ...
1) confirms that with both our machines (and human finger-swiftness), you can sneak in one NeoBook command ... faster machines may enable more commands ... slower machines (with fast-fingered humans) may pose a problem.
2) assuming that you can sneak in at least one command, your suggestion to make the first command DisableObject is the best solution (as it prevents the instructions for the other Button from being activated).
@martinp:
Make the first command in each Button's click section "Disable the other Button" ... you will need to have instructions to Enable both Buttons before every test ... if it still does not work, post details of your machine.
On my Windows 10 machine (with AMD A10-7300 processor), I could replicate your experience (I used Ins and Del keys) ... which ...
1) confirms that with both our machines (and human finger-swiftness), you can sneak in one NeoBook command ... faster machines may enable more commands ... slower machines (with fast-fingered humans) may pose a problem.
2) assuming that you can sneak in at least one command, your suggestion to make the first command DisableObject is the best solution (as it prevents the instructions for the other Button from being activated).
@martinp:
Make the first command in each Button's click section "Disable the other Button" ... you will need to have instructions to Enable both Buttons before every test ... if it still does not work, post details of your machine.
Re: Quiz
DisableButton code works brilliant (when placed first in each button script).....BUT if you add more than two buttons, the results differ.
The laptop that I use is not that fast and it struggles with code when more than two buttons are pressed at a 'relatively' same time.
As you can probs gather, I'm not brilliant with coding (but I do get by) and learning all the time...
Disabling the other three buttons when one is pressed is causing a few headaches.....can anyone suggest a work round?
Thanks guys
The laptop that I use is not that fast and it struggles with code when more than two buttons are pressed at a 'relatively' same time.
As you can probs gather, I'm not brilliant with coding (but I do get by) and learning all the time...
Disabling the other three buttons when one is pressed is causing a few headaches.....can anyone suggest a work round?
Thanks guys
Re: Quiz
Here's the code that I've been using on each button
DisableObject "button2"
DisableObject "button3"
DisableObject "button4"
MoveObject "Answer1" "251" "555"
DisableObject "button1"
"Answer1" is a JPG image that shows above a team name so that it indicates who pressed first.
The DisableOject button 1 (at the end of the code) is to stop teams pressing their button again
(in this instance, it was Team 1......or button 1)
DisableObject "button2"
DisableObject "button3"
DisableObject "button4"
MoveObject "Answer1" "251" "555"
DisableObject "button1"
"Answer1" is a JPG image that shows above a team name so that it indicates who pressed first.
The DisableOject button 1 (at the end of the code) is to stop teams pressing their button again
(in this instance, it was Team 1......or button 1)
Re: Quiz
martinp:
Try this (for capturing the fast finger) first ... if it works (on the slow machine), we can explore means of showing the results ...
1) Before you ask the question ...
2) for the Click event for Button1 ...
... for each of the other buttons, setup a similar SetVar command.
Temporarily, have a Text object visible ... and set its value to [FirstResponder] ... depending on order of key presses, you will see its content as something like ...
Button3, Button1, Button2, Button4,
If you are able to verify that this text displays the values in the order of key presses, the logic for extracting the first Button is ...
Initially assign the above code to yet another button (say Show Winner) ... if it is not acceptable to have a user action (click, key press) in order to show the winner, an automated process (using a Timer object) can be explored.
Too bad you don't have (can't find) a computer fast enough to handle at least two commands between key presses.The laptop that I use is not that fast and it struggles with code when more than two buttons are pressed at a 'relatively' same time.
Try this (for capturing the fast finger) first ... if it works (on the slow machine), we can explore means of showing the results ...
1) Before you ask the question ...
Code: Select all
SetVar "[FirstResponder]" ""
Code: Select all
SetVar "[FirstResponder]" "[FirstResponder]Button1, "
Temporarily, have a Text object visible ... and set its value to [FirstResponder] ... depending on order of key presses, you will see its content as something like ...
Button3, Button1, Button2, Button4,
If you are able to verify that this text displays the values in the order of key presses, the logic for extracting the first Button is ...
Code: Select all
StrParse "[FirstResponder]" ", " "[WinnerButton]" "[Count]"
AlertBox "WinnerButton" "[WinnerButton1]"
If "[WinnerButton1]" "=" "Button1"
MoveObject "Answer1" "251" "555"
EndIf
If "[WinnerButton1]" "=" "Button2"
MoveObject "Answer2" "251" "555"
EndIf
If "[WinnerButton1]" "=" "Button3"
MoveObject "Answer3" "251" "555"
EndIf
If "[WinnerButton1]" "=" "Button4"
MoveObject "Answer4" "251" "555"
EndIf