The Dink Network

Dnotalk.c

March 1st 2006, 04:33 PM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
I know this is very basic scripting, but what can I say, I'm a scripting disaster.

I'm kind of stuck how to customize Dnotalk.c succesfully. I tried some things, and some scripts crashed, but now I have this:

//dnotalk.c

void main( void )
{
if (&player_map == 500) {
say("Yeah", 1); }
if (&player_map == 65) {
say("Your momma", 1); }
else {
int &randy = random(5, 1);
if (&randy == 1)
say("I don't see anything interesting.",1);
if (&randy == 2)
say("There isn't much to see here.",1);
if (&randy == 3)
say("What should I look at?",1);
if (&randy == 4)
say("Hmm, perhaps I should look at something.",1);
if (&randy == 5)
say("I see air.",1); }
}

Now, Dink only says "Your momma", and doesn't say "Yeah" when he's in screen 500. Anyone knows how to properly do this? Note that the texts are changed because I might give away something then.

EDIT: This is mu 1212th post on this forum! *does the happy dance*
March 1st 2006, 04:40 PM
pq_knight.gif
and1
Peasant He/Him
 
Try write it like this i find your scripting messy

void main(void)
{
if (&player_map == 500)
{
say("Yeah", 1);
}
if (&player_map == 65)
{
say("Your momma", 1);
}
else
{
int &randy = random(5, 1);
}
if (&randy == 1)
{
say("I don't see anything interesting.",1);
}
if (&randy == 2)
{
say("There isn't much to see here.",1);
}
if (&randy == 3)
{
say("What should I look at?",1);
}
if (&randy == 4)
{
say("Hmm, perhaps I should look at something.",1);
}
if (&randy == 5)
{
say("I see air.",1);
}
}

March 1st 2006, 04:50 PM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
Oh yes, I scripted it that way (else it wouldn't even work), this board must've messed it up a bit. I'll edit my post, but yeah, that's the way I did it.
March 1st 2006, 04:55 PM
pq_knight.gif
and1
Peasant He/Him
 
Try write it with { and }
like:
if (&rand == 1);
{
say("I dont know how else to help you",1);
}
March 1st 2006, 05:01 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Ooh, ooh, I know, I know

void main(void)
{
if (&player_map == 500)
{
say("Yeah", 1);
}
if (&player_map == 65)
{
say("Your momma", 1);
}
else
{
int &randy = random(5, 1);
}
if (&randy == 1)
{
say("I don't see anything interesting.",1);
}

//Blah...

If &player_map is 500, the first line will be said, but the script will continue through all other lines. The else only works if &player_map is not 65. Basically, even when &player_map is 500, it'll still execute the else block, and say another text (which'll quickly overrule the first one, so that first if-statement is rubbish).

Secondly, &randy only gets initted when &player_map is not 65. Though as we've just seen, the value of it ís used, even when &player_map ís 65. Then there'll exist no variable called &randy, thus not knowing what to compare. In the (Java-)programmers world, this is a NullPointerException. It'll help to put return; after Dink has said something, especially in the &player_map checks.
March 1st 2006, 05:06 PM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
Your script doesn't work either...
March 1st 2006, 05:13 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Bah...
March 1st 2006, 05:24 PM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
I now have this:

//The script with the texts

void main(void)
{
if (&player_map == 500)
{
say("Yeah", 1);
}
if (&player_map == 499)
{
say("Your momma", 1);
}
}
else
{
int &randy = random(5, 1);
}
if (&randy == 1)
{
say("I don't see anything interesting.",1);
}
if (&randy == 2)
{
say("There isn't much to see here.",1);
}
if (&randy == 3)
{
say("What should I look at?",1);
}
if (&randy == 4)
{
say("Hmm, perhaps I should look at something.",1);
}
if (&randy == 5)
{
say("I see air.",1);
}
}

And that's kinda cool, 'cause Dink now says both "your momma" and "yeah", but when he's in any other screen, he doesn't say anything. Maybe that's even cooler...
March 1st 2006, 05:33 PM
spike.gif
This should work, didn't test it though.

void main()
{
int &randy = random(5, 1);
if (&randy == 1)
say("I don't see anything interesting.",1);
if (&randy == 2)
say("There isn't much to see here.",1);
if (&randy == 3)
say("What should I look at?",1);
if (&randy == 4)
say("Hmm, perhaps I should look at something.",1);
if (&randy == 5)
say("I see air.",1);
if (&player_map == 500)
say("Yeah", 1);
if (&player_map == 499)
say("Your momma", 1);
}
March 1st 2006, 05:38 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Thou art screwing up...

The second } after your momma closes the main proc.

say("Yeah",1);
return;

Using return in case of &player_map checks may work.
Also remove that main proc closing } after your momma.
March 1st 2006, 06:44 PM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
I díd screw up. But I really think it's kind of cool to just disable those "nothing to see here" lines. I think I'll also remove the dnomagic lines., now I'm at it. When there is something significant happening in the screen, I'll let Dink say something.
March 1st 2006, 06:50 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Please take into consideration that when a player presses space when seeing nothing, he'll get accustomed to Dink saying nothing, probably forgetting that on some screens at some times there might be something useful to be said. Don't place any quest-critical stuff in there, even the most subtle hint will get lost.
March 1st 2006, 06:54 PM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
Yeah, I know, I won't. Though, I don't think it's any different now, since no D-Mod has Dink saying something other than his regular lines, and even if I did have Dink say something in every screen, I don't think players will try "examening" every screen. Dnotalk will be more some kind of a funny extra, a small novelty, than anything else.