displaying the array integer

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

displaying the array integer

Post by nuggets »

ooh i get by, with a little help from my friends

does the title explain it all???

how can i depict the integer used in the array to use it in another object
i.e trigger[1] will activate target[1] etc...

just displaying it is all i want now though :D

all help gratefully received
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
Jack Ruby
General
Posts: 1443
Joined: Fri Feb 07, 2003 12:20 am
Location: london

Post by Jack Ruby »

Its all Greek to me man :)
Philip II of Macedon sent a message to Sparta:
"If I win this war, you will be slaves forever."
The Spartan ephors sent back a one word reply: "If".
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

local.i

Post by tltrude »

Here is a little scrap from the exploder script:

Code: Select all

	if (level.explodersmasheds > 0)
	{
		level.explodersmashed = exec global/makearray.scr $explodersmashed

		for (local.i=1;local.i<level.explodersmasheds+1;local.i++)
		{
			level.explodersmashed[local.i] hide
			level.explodersmashed[local.i] notsolid

			if (level.explodersmashed[local.i].set == NIL)
				exec global/error.scr ("Error, ExploderSmashed at " + level.explodersmashed[local.i].origin + " has no #set") 1
				else
				println ("Spawned ExploderSmashed " + local.i)

		}
	}
Hope that helps!
Tom Trude,

Image
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 »

cheers tom

by looking at that it seems it keeps it's stored number under i :D i'll have a look now
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 »

Why not make a little function yourself?

Code: Select all

getarrayindex local.array local.element:
  for(local.i = 1; local.i <= local.array.size; local.i++)
  {
    local.thing = local.array[local.i]
    if(local.thing == local.element)
      end local.i
  }
end -1
Then you can type:
local.number = waitthread getarrayindex local.targets local.target
Image
Post Reply