Page 1 of 1

Question

Posted: Fri Jun 27, 2003 3:20 pm
by martijn_NL
What is the different between goto and thread?

Posted: Fri Jun 27, 2003 3:53 pm
by mohaa_rox
this is what i think it is:

they are roughly about the same, and their use can be the same.

BUT

goto normally used in loops, like in a thread itself, if we wanna repeat that action over and over again, called a loop, we use goto threadname.
but thread can also be used, that's when i tried.

let's see what the others have to say.........

Posted: Fri Jun 27, 2003 5:21 pm
by nuggets
goto will stop running the current thread

i.e
line 1
line 2
line 3
goto line 1
line 4

line 4 will never be reached, with thread however it'll still read the rest of the thread irrelevant of what else is happening,

if it's finding a variable (from the new thread being threaded) and needed in the next line

i.e
line 1
line 2
thread finder
if (level.dunno == blah blah blah
line 3

finder:
level.dunno = 1
end

you should always use waitthread, so the script will hold until the previous statement has been completed :D

Posted: Fri Jun 27, 2003 5:35 pm
by martijn_NL
now i understand

Posted: Fri Jun 27, 2003 5:45 pm
by nuggets
also with threads they'll hold variables with them such as

1a local.bean:
iprintlnbold_noloc local.bean
end

1b:
thread 1a $runner
end

Posted: Sat Jun 28, 2003 6:44 am
by jv_map
Just don't use goto is all you need to know :P

Goto Hell

Posted: Sat Jun 28, 2003 8:47 am
by tltrude
jv_map hates goto, ha ha.

my_script:

$foulup_trigger waittill trigger

if (local.script == "bad")
{
goto hell
}
if (local.script == "good")
{
goto heaven
}
end

hell:
$myscript remove
end

heaven:
thread my_script
end