Page 1 of 1

displaying the array integer

Posted: Sun Jun 22, 2003 12:05 am
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

Posted: Sun Jun 22, 2003 1:40 am
by Jack Ruby
Its all Greek to me man :)

local.i

Posted: Sun Jun 22, 2003 5:57 am
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!

Posted: Sun Jun 22, 2003 10:27 am
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

Posted: Sun Jun 22, 2003 10:42 am
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