Stopping threads

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
TheShiznaeSpe
Major
Posts: 304
Joined: Wed Feb 05, 2003 11:45 pm
Location: US
Contact:

Stopping threads

Post by TheShiznaeSpe »

Is it possible to stop a thread midway?


I want to the cancel the allies_win_hold and the axis_win_hold from completing, but not permanently.

So far I have this:

Code: Select all

target_building_touched:

$control_trigger waittill trigger

local.player = parm.other
if(local.player.dmteam == "allies")
{
	iprintln "The US holds the target building."
	$allies_spawn disablespawn
	$allies_spawn_target enablespawn
	$axis_spawn enablespawn
	$axis_spawn_target disablespawn
	$us_indicator show
	$iraq_indicator hide
	thread allies_win_hold
	axis_win_hold delete // i've tried stop also
}
if(local.player.dmteam == "axis")
{
	iprintln "The Iraqis holds the target building."
	$allies_spawn enablespawn
	$allies_spawn_target disablespawn
	$axis_spawn disablespawn
	$axis_spawn_target enablespawn
	$us_indicator hide
	$iraq_indicator show
	thread axis_win_hold
	allies_win_hold delete // i've tried stop also
}

end
Also:

The command locprint, is it possible to cancel this also? So another message replaces it?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Yup there are a number of ways to stop a thread, i.e. end, delete, remove or immediateremove. Use parm.previousthread to 'get' the thread object:

thread allies_win_hold
level.allies_thread = parm.previousthread
level.axis_thread end

and

thread axis_win_hold
level.axis_thread = parm.previousthread
level.allies_thread end

locprint is automatically overwritten by another locprint (pretty annoying actually).
Image
TheShiznaeSpe
Major
Posts: 304
Joined: Wed Feb 05, 2003 11:45 pm
Location: US
Contact:

Post by TheShiznaeSpe »

thanks that's just what i need :D
Post Reply