The Dink Network

Changing what the enter key does

February 14th 2014, 08:12 PM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Anyone know if there's a way to change what the enter (return) key does? There's certain parts in my D-Mod where I don't want the player to be able to access the inventory. Is there an actual script for the key or is it hardcoded?
February 14th 2014, 08:18 PM
wizardg.gif
leprochaun
Peasant He/Him Japan bloop
Responsible for making things not look like ass 
Hrm. I don't believe you can disable the enter key. You can do wait_for_button() but that freezes the entire game and that doesn't seem like what you're looking for.

Is what you want that the player can't open the inventory, or that the player can't access any weapons/items? Because I have a script written that's constantly disarming the player, so he/she can't actually use anything. I feel like that's the closest you can get. Or maybe it's just the closest I can get.
February 14th 2014, 08:32 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Make a script called "button4.c" and enter something like:

void main(void)
{
 
 if(&story == 6)
 {
  say("no inventory for you!",1);
  kill_this_task();
 }
 show_inventory();
 kill_this_task();
 
}



This will only show the inventory when &story isn't 6.
February 14th 2014, 08:33 PM
wizardg.gif
leprochaun
Peasant He/Him Japan bloop
Responsible for making things not look like ass 
Will that actually work?
February 14th 2014, 08:34 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Yeah, I'm pretty aure it will, I have something similar in my dmod!

"button4.c" changes what happens when you press enter and show_inventory() shows the inventory... it's that simple!
February 15th 2014, 01:21 AM
wizardg.gif
Paul
Peasant He/Him United States
 
That's a new feature in Dink 1.08, so it's only been available for the last eight years.

...

Wow, time flies.
February 15th 2014, 11:32 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
I'd use kill_this_task() rather than return here. You don't want key scripts to remain in the memory... And say() rather than say_stop() as well, using say_stop() without freezing the player is generally not a great idea.
February 15th 2014, 11:44 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Thanks!

I guess I could've just looked the key's script from the DinkC Reference, but that didn't cross my mind.
February 15th 2014, 12:33 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Thanks meta, I edited it so that somebody who finds this in the future doesn't copy a faulty script!