Choices Command
Ok i'm fairly new to DinkC scripting and have been through a couple of tutorials but whenever i select anything in the following code it crashes my computer and pulling out the plug is the only solution .
void talk(void)
{
freeze(1);
say_stop("`#What were YOU doing in pillbug manor?", ¤t_sprite);
choice_start()
"I was teleported there by a magical duck-mage to save our world"
"Im an idiot who just got lost"
choice_end()
}
if (&result== 1)
{
say("`#Ah ha and i'm king Daniel, u aint going anywhere", ¤t_sprite);
}
if (&result== 2)
{
say("`# Exactly as i thought, Get out of here scumbag!", ¤t_sprite);
screenlock(0);
}
Im guessing it will be something simple that im just too new to pick-up but yeah any help would be great.
void talk(void)
{
freeze(1);
say_stop("`#What were YOU doing in pillbug manor?", ¤t_sprite);
choice_start()
"I was teleported there by a magical duck-mage to save our world"
"Im an idiot who just got lost"
choice_end()
}
if (&result== 1)
{
say("`#Ah ha and i'm king Daniel, u aint going anywhere", ¤t_sprite);
}
if (&result== 2)
{
say("`# Exactly as i thought, Get out of here scumbag!", ¤t_sprite);
screenlock(0);
}
Im guessing it will be something simple that im just too new to pick-up but yeah any help would be great.
You don't need that bracket after the choice_end, that bracket closes the talk procedure and needs to go at the end. It's also best to unfreeze just before the end of the talk procedure( unless the script ends itself in mid-proc. e.g.-return; ) Otherwise it looks o.k. to me
Yeah, the unfreeze you forgot will make your PC end up in that situation. However, you should still be able to escape Dink by pushing CTRL-ALT-DEL or simply ALT-ESC.
And pushing reset is better than pulling the plug.
And pushing reset is better than pulling the plug.
The first thing I see is you need a space here:
if (&result == 1)
if (&result == 1)
CTRL-ALT-DEL, ALT-F4, and ALT-ESC didn't work and with XP there is no reset button .
But after a proper reset CTRL-ALT-DEL workds now but still with the following revised script i still get a crash:
void talk(void)
{
freeze(1);
say_stop("`#What were YOU doing in pillbug manor?", ¤t_sprite);
choice_start()
"I was teleported there by a magical duck-mage to save our world"
"Im an idiot who just got lost"
choice_end
unfreeze(1);
}
if (&result == 1)
{
say("`#Ah ha and i'm king Daniel, u aint going anywhere", ¤t_sprite);
}
if (&result == 2)
{
say("`# Exactly as i thought, Get out of here scumbag!", ¤t_sprite);
screenlock(0);
}
Same freeze PC error
But after a proper reset CTRL-ALT-DEL workds now but still with the following revised script i still get a crash:
void talk(void)
{
freeze(1);
say_stop("`#What were YOU doing in pillbug manor?", ¤t_sprite);
choice_start()
"I was teleported there by a magical duck-mage to save our world"
"Im an idiot who just got lost"
choice_end
unfreeze(1);
}
if (&result == 1)
{
say("`#Ah ha and i'm king Daniel, u aint going anywhere", ¤t_sprite);
}
if (&result == 2)
{
say("`# Exactly as i thought, Get out of here scumbag!", ¤t_sprite);
screenlock(0);
}
Same freeze PC error
Well, you don't need a bracket after ending the choice_start(), it's still one script, but if that doen't work you can always try something else. How about... GOTOS!
VOID TALK(VOID)
{
freeze(1);
say_stop("`#What were YOU doing in pillbug manor?", ¤t_sprite);
choice_start()
I was teleported there by a magical duck-mage to save our world"
"Im an idiot who just got lost"
choice_end
if (&result == 1) goto AST
if (&result == 2) goto BST
{
AST:
say("`#Ah ha and i'm king Daniel, u aint going anywhere", ¤t_sprite)
unfreeze(1);
return;
BST:
say("`# Exactly as i thought, Get out of here scumbag!", ¤t_sprite);
screenlock(0);
unfreeze(1);
}
}
...I let it do the same thing, just changed how it's done. I fixed a problem where Dink was never unfrozen after the script is finished and you had one extra closing and opening thingy that ended the script way too soon. That should fix it.
VOID TALK(VOID)
{
freeze(1);
say_stop("`#What were YOU doing in pillbug manor?", ¤t_sprite);
choice_start()
I was teleported there by a magical duck-mage to save our world"
"Im an idiot who just got lost"
choice_end
if (&result == 1) goto AST
if (&result == 2) goto BST
{
AST:
say("`#Ah ha and i'm king Daniel, u aint going anywhere", ¤t_sprite)
unfreeze(1);
return;
BST:
say("`# Exactly as i thought, Get out of here scumbag!", ¤t_sprite);
screenlock(0);
unfreeze(1);
}
}
...I let it do the same thing, just changed how it's done. I fixed a problem where Dink was never unfrozen after the script is finished and you had one extra closing and opening thingy that ended the script way too soon. That should fix it.
well you dont need a bracket after the choice end istead put that bracket after the last bracket in the script that will help
GOTOS!!?! Arh, no gotos. Not here...
Ehhh, why is at the end of the script a screenlock(0); command?
At first i don't see a screenlock(1); there, so this command is just unecessary.
At first i don't see a screenlock(1); there, so this command is just unecessary.
Maybe, there's another script in that screen that creates a screenlock.
I don't think so, because if there's a screenlock(1); in another script, then he should screenlock(0); in the same script.
Unless this choice script is just from a spawn(); command, but that's useless.
Unless this choice script is just from a spawn(); command, but that's useless.
Well. 'Could as well be in the same script, void main or so. And.. eh.. Why should the screenlock(0); be in the same script as screenlock(1); ? Is it a serious gaffe if it's not or something?