Switch

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
psyco
Private
Posts: 1
Joined: Sat Jul 17, 2004 5:10 am

Switch

Post by psyco »

hay guys do u have any idea why this wouldnt work?

This is what changes the scoreboard

Code: Select all

scoreboard:
	while (1) {
		switch ( local.objs )
		{
			case 0:
				setcvar "g_obj_alliedtext2" "( 0 / 2 )"
				break
			case 1:
				setcvar "g_obj_alliedtext2" "( 1 / 2 )"
				break
			case 2:
				setcvar "g_obj_alliedtext2" "( 2 / 2 )"
				break	
			Default:
				setcvar "g_obj_alliedtext2" "( 0 / 2 )"
				break	
		}
	wait 1
	}
From what i have red that should check what local.objs is and set the scoreboard to suit. At the moment it doesnt do anything to the scoreboard. i dont think there is anything in local.objs for some reason :|

i am using this to add one (1) to local.objs

Code: Select all

local.objs++
i was told that adds one onto what ever local.objs is.

and last at the top of the script i am using local.objs = 0 so it sets the scoreboard to 0. if u can help me out i would realy appreciate it
Angex
Major
Posts: 293
Joined: Mon Dec 30, 2002 1:23 pm
Contact:

Post by Angex »

Local variables are only accessible by the thread they are created in, unless you use parameter passing. In the example below local.objs is in two different threads, but it doesn't refer to the same variable. Local.objs int the main thread has a value of 0, and the local.objs in the scoreboard is NIL or NULL.

Code: Select all

main:
    local.objs = 0

    thread scoreboard
end

scoreboard:
    switch(local.objs) {
    }
end
By making local.objs into a level variable this example would work.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

level

Post by tltrude »

Changing it to "level.objs" will work, if "level.objs" is set to one of the four numbers in another thread or script.

We would need to see the whole script, and know which game (Mohaa, SH, or BT) it is, to help more.
Tom Trude,

Image
Post Reply