Question

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
martijn_NL
Map Reviewer
Posts: 156
Joined: Mon Apr 14, 2003 5:33 pm
Location: The Netherlands
Contact:

Question

Post by martijn_NL »

What is the different between goto and thread?
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post 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.........
Live to map, not map to live.
-mohaa_rox, .map
moderator
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post 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
Last edited by nuggets on Fri Jun 27, 2003 5:43 pm, edited 1 time in total.
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
martijn_NL
Map Reviewer
Posts: 156
Joined: Mon Apr 14, 2003 5:33 pm
Location: The Netherlands
Contact:

Post by martijn_NL »

now i understand
Mapping 4 life
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post 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
hope this helps, prob not cos it's all foreign 2 me :-/
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Just don't use goto is all you need to know :P
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Goto Hell

Post 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
Tom Trude,

Image
Post Reply