The Dink Network

doh!

June 6th 2003, 07:46 AM
pillbug.gif
Why won't this work!! I've tried everything!!

please help!
June 6th 2003, 07:49 AM
pillbug.gif
void talk(void)
{
if(&stick==1)
{
say_stop("This stick will work, two more",1);
&stick += 1;

if(&stick==2)
{
say_stop("Ok, one more should do it!",1);
&stick=+1;

if(&stick==3)
{
say_stop("Now I'll try to start a fire in my house.",1);
&stick+=1;
Kill_this_task();
}
}
}
}

\\these two in unison should work, you can't \\talk to the sticks!

VOID MAIN(VOID)
{
playmidi("1.mid");
int &mom = create_sprite(208, 164, 16, 353, 1);
sp_base_walk(&mom, 350);
sp_speed(&mom, 1);

freeze(&mom);
freeze(1);

move_stop(1, 9, 195, 1);
sp_dir(1,9);
sp_kill(&mom,51000);

say("Hi mom!",1);
wait(4000);
say("`6Not now, I'm busy looking at Dink's masterpiece!!",&mom);
wait(4000);
say("`6Who the heck are you?",&mom);
wait(4000);
say("Mom.. I'm Blink, your son!?",1);
wait(4000);
say("`6Oh yeah, you",&mom);
wait(4000);
say("`6BUT DINK PAINTED THE WALL, WHITE!!",&mom);
wait(4000);
say("Mom, what about me?",1);
wait(4000);
say("Dink is all you talk about!",1);
wait(4000);
say("`6What did you ever do, Blink?",&mom);
wait(4000);
say("Well, today, I was voted best in the science fai...",1);
wait(4000);
say("`6That's great, I need to look at Dink's paintings now!",&mom);
waiT(4000);
say("Well... bye mom! I love you!",1);
wait(4000);
move_stop(&mom, 2, 280, 1);
sp_dir(&mom, 8);
say("`6Whatever",&mom);
wait(4200);
say("I'll do something to make you notice me mom.",1);
wait(4000);
say("For starters, I'll bring in some firewood!",1);
unfreeze(1);
&stick=1;
stopmidi("1.mid");
kill_this_task():
}
June 6th 2003, 09:12 AM
old.gif
What are you trying to do, you can delete all those if statements, because they dink will run all those say_stop commands...
June 6th 2003, 09:13 AM
old.gif
Btw, you can only talk to the sticks, when the variable IS 1, if its 0, then you will never be able to talk to them.

WHAT ARE YOU TRYING TO DO? :S
June 6th 2003, 09:17 AM
pillbug.gif
So, basically even though I want Dink to say something different when he finds each stick, they'll all run together because I used say_stop instead of plain say? I also included the other script to show that I already set the variable, &stick, to 1

And I did make the global variable, if you're gonna ask that
June 6th 2003, 10:06 AM
old.gif
Oh, assign this script to each stick on the ground:

void talk(void)
{
if (&stick == 1) goto ast;
if (&stick == 2) goto bst;
if (&stick == 3) goto cst;

AST:
say_stop("First text", 1);
goto end;

BST:
say_stop("Second text", 1);
goto end;

CST:
say_stop("Third text", 1);

end:
&stick += 1;
editor_type(&current_sprite, 1);
}
June 6th 2003, 10:07 AM
old.gif
when &stick = 4 dink has all the sticks, when its 1 he has none
June 6th 2003, 12:31 PM
spike.gif
Dink runs all the text at once, since you don't have return; after you add 1 to the story...

You should do like this:

if(&stick==1)
{
&stick += 1;
say_stop("This stick will work, two more",1);
return;
}

if(&stick==2)
{
&stick += 1;
say_stop("Ok, one more should do it!",1);
return;
}

if(&stick==3)
{
&stick += 1;
say_stop("Now I'll try to start a fire in my house.",1);
return;
}
June 6th 2003, 12:34 PM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
As an alternative for all those gotos:

void talk(void)
{
if (&stick == 3)
{
//do this
}
if (&stick == 2)
{
//do this
}
if (&stick == 1)
{
//do this
}
&stick += 1;
}
June 6th 2003, 01:45 PM
old.gif
Simeon, I find the gotos much easier, why? Because I have a problem with spaces, when I make a if statement, it always doesnt work, because, I dont know, I think too many or little spaces.

I know its strange, but I thing the goto-way is easier and never fails...
June 6th 2003, 02:41 PM
pillbug.gif
Thanks! I never knew that goto command existed, it'll save me a whole lota time.
June 6th 2003, 03:15 PM
knightg.gif
WC
Peasant He/Him United States
Destroying noobs since 1999. 
!! TheProphet is a goto whore...I hate goto, any real programmer does.
June 6th 2003, 03:17 PM
pillbug.gif
DON'T JUDGE ME, MAN!

j/k
June 6th 2003, 03:17 PM
old.gif
START:
sp_kill(&wc, 1);
goto START;

I love goto's

I know goto's are not perfect, but it helps. And I know you shouldnt use gotos, but I do
June 6th 2003, 03:27 PM
wizardb.gif
Phoenix
Peasant He/Him Norway
Back from the ashes 
Like yours truly..
June 6th 2003, 04:01 PM
knightg.gif
WC
Peasant He/Him United States
Destroying noobs since 1999. 
Well, since dink doesn;t support while, for, ect loops, goto's are needed, but there is a easier way to write that script (and probably much better for editing. Here is my example.

void talk(void)
{
if (&stick == 3)
{
say_stop("Third text", 1);
&stick += 1;
editor_type(&current_sprite, 1);
}
if (&stick == 2)
{
say_stop("Second text", 1);
&stick += 1;
editor_type(&current_sprite, 1);
}
if (&stick == 1)
{
say_stop("First text", 1);
&stick += 1;
editor_type(&current_sprite, 1);
}
}
June 6th 2003, 04:24 PM
pillbug.gif
that one doesn't seem to work, you can't even talk to the stick...
June 7th 2003, 12:26 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
I've no idea why your if-statements don't work, but anyway, when you get to work with real languages, you'll see why you shouldn't use goto's there - those languages offer greater contol of running parts of a script somewhere else
June 7th 2003, 12:50 AM
old.gif
This is a nice one!

D:
goto a;

B:

goto C;

A:

goto b;

C:

goto D;
June 23rd 2003, 02:39 AM
slayer.gif
MadStalker
Peasant He/Him Finland
tag line 
Assign this to any sprite:

void main( void )
{
crap:
say("I suck.", 1);
goto crap;
}