Page 1 of 1

is there any reason why waitthread wont wait!

Posted: Sun Mar 06, 2005 4:37 am
by Elgan
is there any reason why waitthread wont wait for the thread to finish.

i have some code that needs to loop and set soemthing up. but it relies on the code it runs from to of been updated correctly. i have a thread (update_all) that does this.

I have waitthread update_allcmds, but it does not wait for it to finish. it atcs like thread.

Code: Select all


			waitthread update_allcmds
		}

wait 1 // IF I PUT WAIT 1 HERE IT WORKS COS ITS ENOUGH TIME FOR THE THREAD TO FINISH

	for(local.i=1;local.i<=game.all_commands.size;local.i++)
	{
		iprintln game.all_commands[local.i][1]
	}

		for(local.i=1;local.i <= game.scripts.size;local.i++)
		{
			local.jente = game.scripts[local.i][1]
			//level.run[local.jente] = waitthread getcmd "adverts" //local.jente
MY VARS RETURN NIL COS ADVERTS has not been updated into game.all_commands yet.

	local.hm = waitthread getcmd "adverts" 1 //local.jente


iprintln local.hm
			exec game.scripts[local.i][4]
		}

and the thread

Code: Select all



update_allcmds:

	for(local.i=1;local.i<=game.commands.size;local.i++)
	{
		for(local.s=1;local.s <= game.commands[local.i].size; local.s++ )
		{
			game.all_commands[local.i][local.s] = game.commands[local.i][local.s]
		}
	}

	if(game.loaded_weapons==NIL)
	{
		end
	}

	local.i = game.commands.size
	for(local.n=1;local.n<=game.loaded_weapons.size;local.n++)
	{
		local.i++
		for(local.s=1;local.s <= game.loaded_weapons[local.n].size; local.s++ )
		{
			game.all_commands[local.i][local.s] = game.loaded_weapons[local.n][local.s]
		}
	}

	local.i = game.all_commands.size
	for(local.n=1;local.n<=game.scripts.size;local.n++)
	{
		local.i++
		for(local.s=1;local.s <= game.scripts[local.n].size; local.s++ )
		{
			game.all_commands[local.i][local.s] = game.scripts[local.n][local.s]
		}
	}


end

what is that cvar to check what threads etc are doing?

g_debugscript or something?

im off to bed now. i bet its something stupid i just cant think., please point that out. good night!

NIL

Posted: Sun Mar 06, 2005 9:18 am
by tltrude
My guess would be that "game.loaded_weapons" has no value.

Posted: Sun Mar 06, 2005 3:34 pm
by Elgan
eek. oops ., yes of course thanx tom

now i have to change it all :twisted: