The Dink Network

Reply to Re: Gamestopping bug near the beginning

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
December 23rd 2015, 09:35 AM
spike.gif
Since we're discussing it, here's the whole script (lookey.c):
void talk(void)
{

freeze(1);
 choice_start();
(&cave == 0) "What's for sale?"
 "Hello!"
(&cave == 1) "How do I get out of these caves?"
(&boncaa == 13) "I've got you a shelf" 
 "Leave"
 choice_end();

if (&result == 4)
 {
say_stop("`5That's just great! Here's the key to the Dark Caves.", &current_sprite);
wait(200);
say_stop("How do I use it?", 1);
wait(200);
say_stop("`5Just go to the entrance. Another entrance will show.", &current_sprite);
say_stop("`5But remember that the Dark Caves are real dark.", &current_sprite);
say_stop("`5You'll have trouble seeing the edges, but they are there for sure.", &current_sprite);
 &boncaa = 14;
}

if (&result == 3)
 {
say_stop("`5Just ask my daughter for the magic key.", &current_sprite);
wait(200);
say_stop("And where is she?", 1);
wait(200);
say_stop("`5She went to the toilet.", &current_sprite);
 &cave = 2;
}

if (&result == 1)
 {
say_stop("`5Invisible keys.", &current_sprite);
wait(200);
say_stop("What would someone do with such a key?", 1);
wait(200);
say_stop("`5Go the Dark Caves.", &current_sprite);
wait(200);
say_stop("And what's there?", 1);
wait(200);
say_stop("`5I don't know, but some want to go there.", &current_sprite);
wait(200);
say_stop("*looks at table*", 1);
wait(200);
say_stop("`5You can't steal them, so don't even think about it.", &current_sprite);
wait(200);
say_stop("How can I? I can't even see them!", 1);
wait(200);
say_stop("`5If you want one you have to give me a shelf.", &current_sprite);
wait(200);
say_stop("A shelf?", 1);
wait(200);
say_stop("`5Very rare around here.", &current_sprite);

 &cave = 1;
}

if (&result == 2)
 {
say_stop("Hello!", 1);
wait(200);
say_stop("`5A good day to you to.", &current_sprite);
 }

unfreeze(1);

My proposed fix was this:
...

unfreeze(1);
(just a line break)


I just tried it out on DinkHD, and had a pretty weird experience: the choice menu graphics weren't there when I talked to her (vines, arrows, etc), only the actual choices were displayed. However, this problem only occurred once, when I tried talking to her again everything was normal, I couldn't reproduce it even by exiting and relaunching DinkHD, nor deleting and adding the dmod again. I dunno what to say, except "Oh, DinkHD." =)

I believe, that the real issue is that the Choice function provides for 5 ifs, whereas there are only 4 thens with none being defined as the default or 'fall-through' path. By omitting the closing brace for the talk(void) function, the menu is only being dismissed visibly and not programmatically. This can be evidenced in V1.08HD by hitting escape for the menu which will have both the Map and Dink menu options, disabled because there is already a menu open.

I think the the 'view map' and 'dink menu' options are only not being displayed because Dink is frozen - the same as if you press escape while in a conversation. I don't disagree that adding a closing bracket is preferable to an empty space, though, even if disregarding any programmatical considerations; it's better just for the sake of clarity, as it's easier to notice if you forgot to add a bracket at the end of a script, than it is to notice if you forgot to add a line break.

I did also notice a difference between FreeDink and DinkHD in how they behave with a line break at the end. It seems that a line break is always not enough in DinkHD, while it works every time in FreeDink (and regular v1.08). This is the test script I used:
void main
int &bananas = 999
void talk
say("I have &bananas wonderful wonderful bananas",&current_sprite)
(just a line break)

^ that doesn't work in DinkHD.

void main
int &bananas = 999
void talk
say("I have &bananas wonderful wonderful bananas",&current_sprite)
 (one single empty space)

^ This does work in DinkHD

EDIT: Stupid code tags don't display line breaks and empty spaces. (just a line break) and (one single empty space) aren't in the actual scripts, obviously.