The Dink Network

Key Scripts

February 14th 2006, 04:58 PM
dragon.gif
I need to know how to make some key scripts. They are for: a feats menu, a help menu and a menu with the new stats for my dmod. Can anyone please help me?
February 14th 2006, 05:03 PM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
Check out key-80.c in the dink story directory for an example. There's a list of which numbers are which keys, but I'm oblivious to where you might find it.
February 14th 2006, 05:12 PM
fairy.gif
GlennGlenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
WHen ur in the game press CTRL + D to enable debug mode, it will show you what key you are pressing if you are for example pressing J.
February 14th 2006, 05:16 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Keycodes.

If you have a 1.08 RC, there's a list of them as well in dinkc.chm.

F key = key-70.c
H key = key-72.c
S key = key-83.c

If you wanted to use other keys, you can look them up in the file I linked to. The script should be in the main() proc:

key-70.c

void main( void )
{
say("Feats!",1);
kill_this_task();
//You'll regret leaving out the kill_this_task()
//Scripts eating up memory and such nasty things.
}
February 14th 2006, 05:25 PM
dragon.gif
I know how to find the keycodes. That's not my problem. You did guess the keys I want to use correctly, though. Well done.

My problem is that I don't know how to write a key script.
February 14th 2006, 05:45 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Eh, how do you mean? They're just normal scripts like any other. So "how to write a key script":

- Open editor of choice (Notepad, EasyDinkC, etc).
- Type your script in the main() proc.
- End with kill_this_task().
- Save as key-70.c (or whatever other key you wish to use).
- Run your D-Mod
- Press "F", or whatever other key you used.
- Watch the script execute

Though I'm pretty sure you didn't mean that

key-70.c:

void main( void )
{
stop_entire_game(1);

choice_start()

set_y 240

title_start();
Feats!
title_end();

"Option 1"
"Option 2"
"Option 3"

choice_end()

if (&result == 1)
{
say("Option 1!",1);
}

if (&result == 2)
{
say("Option 2!",1);
}

if (&result == 3)
{
say("Option 3!",1);
}

kill_this_task();
}

Of course, you'll have to change the menu options and what will happen when you've made a choice, but this is the general idea.

If this isn't what you meant, what part of writing key scripts do you not get? If you've ever spawn()-ed something, key-scripts work just the same. If you haven't, forget what I said, or remember it in case you ever want to spawn().
February 14th 2006, 05:59 PM
dragon.gif
I know about writing scripts (to some extent). But there's still a lot of DinkC I don't know and a lot about using it. I wasn't sure if there was anything special needed for doing it.
February 14th 2006, 06:05 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Ah, okay. I hope it's clear now
February 14th 2006, 06:28 PM
dragon.gif
Indeed, it is. Thank you.