wait_for_button
Why can't I use all the buttons for wait_for_button? Like &result == 68 for D? Seems like only the standard buttons for Dink apply like CTRL, ESC, SPACE, arrow keys etc.
Main problem: Dink will say ass when I press ESC, but not when I press D.
void main(void) { freeze(1); loop: wait_for_button(); if (&result == 68) { say("ass",1); } if (&result == 5) { say("ass",1); } goto loop; }
Main problem: Dink will say ass when I press ESC, but not when I press D.
I accidontally smashed my keyboard while posting.

According to the reference it should. What's your script look like?
Just a simple test script:
I noticed something. When the loop is running, Dink won't say ass when I press D, but if I hit ESC, then D, he will mysteriously say ass afterwards each time I press D.
void main(void) { freeze(1); loop: wait_for_button(); if (&result == 68) { say("ass",1); } if(&result != 5) { goto loop; } unfreeze(1); kill_this_task();
I noticed something. When the loop is running, Dink won't say ass when I press D, but if I hit ESC, then D, he will mysteriously say ass afterwards each time I press D.
It's going back to the loop every time because your check is !=5 when it should be != 68.
Or is button 5 ESC?
Point is, even if the player pushes D- they also push a button that goes into the != 5 check and the wait_for_button() loop starts again.
Or is button 5 ESC?
Point is, even if the player pushes D- they also push a button that goes into the != 5 check and the wait_for_button() loop starts again.
Uh-huh, true. I ditched the one from the reference and tried this:
Now, button 5 is ESC. If I try the above, it won't work at all! If I try if (&result == 5) though, Dink will say ass. The game is also frozen. dang
void main(void) { freeze(1); loop: wait_for_button(); if (&result == 68) { say("ass",1); } goto loop; unfreeze(1); kill_this_task();
Now, button 5 is ESC. If I try the above, it won't work at all! If I try if (&result == 5) though, Dink will say ass. The game is also frozen. dang
Doesn't wait_for_button freeze dink automatically? Try not using freeze();
He isn't frozen by wait_for_button though. But why does it work for the standard keys (ctrl, space, esc, arrows) while he's frozen and not other keys?
I dunno, freeze() is weird man. Maybe someone who's used wait_for_button() before can tell you.
Oh, gosh dang ignore all that in the previous post. I messed up. Freeze ain't the problem.
Main problem: Dink will say ass when I press ESC, but not when I press D.
void main(void) { freeze(1); loop: wait_for_button(); if (&result == 68) { say("ass",1); } if (&result == 5) { say("ass",1); } goto loop; }
Main problem: Dink will say ass when I press ESC, but not when I press D.
How about this script:
That's right, no loop, no if, nothing. The point of wait_for_button() is that it waits until a button has been pressed. If you don't see "ass" with a button value after pressing D, that means the engine doesn't think a button has been pressed. If that's the case, then I guess the answer is "because apparently the engine doesn't work that way". If you *do* see "ass" with a button value. Well. Then you now know what value to check for if you press D
void main( void ) { freeze(1); wait_for_button(); say("ass, button &result",1); unfreeze(1); }
That's right, no loop, no if, nothing. The point of wait_for_button() is that it waits until a button has been pressed. If you don't see "ass" with a button value after pressing D, that means the engine doesn't think a button has been pressed. If that's the case, then I guess the answer is "because apparently the engine doesn't work that way". If you *do* see "ass" with a button value. Well. Then you now know what value to check for if you press D

Huh, then I guess the engine doesn't work that way. It only registers the standard buttons for Dink.
Huh, then I guess the engine doesn't work that way. It only registers the standard buttons for Dink.
Yes, that's what DinkC.txt says about it as well. Then again, it also says that the M key is not recognized as button 6, but for me it is. Perhaps that changed from 1.07 to 1.08 or Freedink.
Yes, that's what DinkC.txt says about it as well. Then again, it also says that the M key is not recognized as button 6, but for me it is. Perhaps that changed from 1.07 to 1.08 or Freedink.
If you really need the player to push the D key, you could create a key68.c script and have a check for that particular instance when you want it used. You wouldn't need to use wait_for_button() in that case.
Hm, yeah I've been tinkering around with key-68. Wait_for_button is ideal for what I'm trying to do though, but thanks all anyways.

I'll just go pimp run_script_by_number() again. If you put ¤t_script somewhere in a global, you can use that in a key script to jump to a procedure.
It's a bit of a roundabout way of doing things, though. Still, it may be of some use in some cases.
Also works great with spawn():
It's a bit of a roundabout way of doing things, though. Still, it may be of some use in some cases.
// somewhere in main.c make_global_int("&keyhandler",0); // key-68.c void main( void ) { if (&keyhandler > 0) { run_script_by_number(&keyhandler,"d"); } kill_this_task(); } // script.c void main( void ) { int &d = 0; } void talk( void ) { if (&d > 0) { say_stop("Nope. Wrong button. Press D.",1); return; } say_stop("Oh. Looks like I have to press D to continue.",1); &keyhandler = ¤t_script; return; d1: say_stop("Another bit of stuff here.",1); say_stop("Mind, you, to see more, press D again.",1); &keyhandler = ¤t_script; return; d2: say_stop("That's it! Keep pressing that key!",1); &keyhandler = ¤t_script; return; d3: say_stop("End of story.",1); } // I'm not too happy about this bit, but oh well. You could of course put the cutscene-stuff directly inside this. void d( void ) { &keyhandler = 0; &d += 1; if (&d == 1) { goto d1; } if (&d == 2) { goto d2; } if (&d == 3) { goto d3; } }
Also works great with spawn():
// In main.c make_global_int("&keyhandler",0); // Did you know: main.c gets run on game load as well! &keyhandler = spawn("keyhandler"); // keyhandler.c void d( void ) { say("D",1); } // key-68.c void main( void ) { if (&keyhandler > 0) { run_script_by_number(&keyhandler,"d"); } kill_this_task(); }