The Dink Network

Goto

June 7th 2003, 09:36 PM
pillbug.gif
This won't work! It just blends together! Please help!

VOID MAIN(VOID)
{
if(&mom<2) goto AST
if(&mom>3) goto BST
{

AST:

blah

BST:

blah

}
}

of course, the blah would be replaced by something.
June 7th 2003, 10:26 PM
custom_odd.gif
because after doing AST it'll just keep going down, to BST, all you have to do is put return; after all the stuff you want at AST:
June 7th 2003, 10:30 PM
pq_frog.gif
Ric
Peasant Canada
 
It is a bit safer to bracket the action of an if. Sometimes stacking the command works, but dink doesn't like it. Also when it does work, if &mom =0, it will goto ast, then continue and run bst too. Above all, when making comparison (using "if"), you must have a space before and after the <= or == or whatever.
hm...
void main ()
{
if (&mom < 2) { goto ast; }
if (&mom > 3) { goto bst; }
}
void separatethis ()
{
ast:
blah
return;
bst:
blahblah
}
you don't need to goto a separate procedure, but you must plan how command will end. And is &mom a global variable? (initiated in "start.c"), if not add int &mom; at the begining of main().
June 8th 2003, 09:02 AM
pillbug.gif
Thanks!
June 9th 2003, 10:43 AM
wizardb.gif
Phoenix
Peasant Male Norway steam
Back from the ashes 
None of you has done it right (at least not in accordance with documentation).

you can do

if (&one == 1)
say("Wah", 1);

but not

if (&one == 1) say("Wah", 1);
or
if (&one == 1) { say("Wah", 1); }

also notice that you can only have one command if you do it this way, so

if (&one == 1)
say("Wah", 1);

is valid, but

if (&one == 1)
say("Wah", 1);
say("Wah again", 1);

is not. In that case, you must do

if (&one == 1)
{
say("Wah", 1);
say("Wah again", 1);
}

There you go. The really dinky way of doing it.
June 9th 2003, 10:56 AM
custom_magicman.gif
magicman
Peasant Netherlands steam duck
Mmmm, pizza. 
Now this is weird... In the post I see:
"if (&one == 1) say("Wah",1);
And underneath the reply form I see a return.
It has to be a return, of course, but it's still weird I didn't see it in the original post...
June 9th 2003, 10:57 AM
custom_king.png
redink1
King Male United States xbox steam bloop
A mother ducking wizard 
but not

if (&one == 1) say("Wah", 1);


Um... that works. The only thing that you can't do with if statements without curly brackets is variable assignments. For example, this won't work:

if (&gold > 500) &gold -= 500;

And I think this doesn't work too:
if (&gold > 500)
&gold -= 500;
June 9th 2003, 11:03 AM
custom_magicman.gif
magicman
Peasant Netherlands steam duck
Mmmm, pizza. 
Hey, now I DO see a return in the original post... I've got to get new glasses