Home   Help Search Login Register  

Author Topic: Global Find  (Read 1613 times)

0 Members and 1 Guest are viewing this topic.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Global Find
« on: 27 Oct 2004, 10:00:40 »
Is there a way I find all objects of a specific type on an island?  

What I want to do specifically is find all the streetlights and turn them to OFF.

I am trying to avoid having to find all their object numbers individually

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Global Find
« Reply #1 on: 27 Oct 2004, 11:13:12 »
Yes there is.

You would need to cycle through every object on the island, check if it was a streetlamp and then turn it off if it was.

The last part is very easy, the middle part is quite easy (typeOf command I think) and the first part is hard.    

object 1 is a string, right?    And it is a string that has two parts, "object" and "1".    Making a 1 on its own increment is easy, and it should be possible to add two strings, add a third string for the rest of the code in the line you desire and then use a call command to execute the string you have cobbled together.

Probably.
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #2 on: 27 Oct 2004, 11:58:12 »
Wonderful thank you I will have a play with it.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re:Global Find
« Reply #3 on: 28 Oct 2004, 00:19:24 »
I may have a similar need.  Once you get this working, how about posting the solution?  Thanks!
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #4 on: 28 Oct 2004, 07:50:19 »
I would be happy to.  But it might be awhile.  

Does anyone know how I can find the upper range of the object number on any map?  (I presume thje lower limit is 0, or at least if not then starting at 0 will not generate any fatal errors.)

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Global Find
« Reply #5 on: 28 Oct 2004, 08:14:00 »
There might be a limit on objects, at least there's a limit on how many textures can be used on an island...

Pure theory, never tested.. :P :
However, when taking object XXXXXX which doesn't exist, it probably returns the "scalar bool array string 0xfcffffef", so you could set up a check in the loop dealing with the objects, in vein of

? (_object == "scalar bool array string 0xfcffffef"): exit

???
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #6 on: 28 Oct 2004, 10:09:50 »
I am sure you are right.  What a pain!  

I don't know if 'scalar bool array string 0xfcffffef' would be recognised as a valid object.

I suppose for each map I could start with a number I know exists and increment and decrement until I get the error at each end of the range.  

That would not work though if the object numbers are grouped with gaps between groups.  I know I would have created a map in that way.  

So much to do and so little time!!

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Global Find
« Reply #7 on: 28 Oct 2004, 11:37:49 »
Quote
I suppose for each map I could start with a number I know exists and increment and decrement until I get the error at each end of the range.
The 'scalar bool blah blah' is a valid value, and many scripts use it...

But sadly, I checked this with hint format ["%1",typeOf (object 999999)]
And I get no error altough there's no object 999999 on everon...
object 0 returned 'FuelStation'...

So, you'd be better off to check it with ? _object == "": exit type of thing...
I tried that and it should work...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Global Find
« Reply #8 on: 28 Oct 2004, 11:38:47 »
Try using objNull.

I can't remember if the objects start at 1 or 0.    It's surprisingly easy to find it on BIS islands, it will only take you a minute or two.     Top end is harder, but you only have to find the top number in the areas where there are streetlamps.    It's a slightly longer job but not as grim as you would think.
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #9 on: 28 Oct 2004, 11:52:00 »
This is frustrating - I am itching to get at it but I am stuck at work!!  I have just written a script but have no way to test it for several hours.

mac - I have now gone beyond the streetlight thing and want to do something much more general.  The island I am using (Malden) has so few that I could find them all manually quicker than I could debug a script.  But with a script I would the be able to find anything, on any island in the future, as well as sharing it with my friends of course.  Also I think I may not want to turn all the lights  off.

Quote
The 'scalar bool blah blah' is a valid value, and many scripts use it...
Thanks, I didn't know that.


Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Global Find
« Reply #10 on: 28 Oct 2004, 13:08:04 »
Anyway, at least on Everon the objects start from 0..

And no need for objNull, as if you use typeOf in the check and there's no object, typeOf returns an empty string...

As I said, I tried it and it worked... the 'should' is there just for precaution ;D

You would need to come up with something to keep the player enterntained while the script loops through 10000+ objects though...
Will not be a fast task... ::)
« Last Edit: 28 Oct 2004, 13:09:57 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #11 on: 28 Oct 2004, 13:25:56 »
Actually I am thinking of a script to help mission builders to find the objects they want so they can use the obect numbers in their missions.

I agree it could take a long time to do the search everytime the mission is played.

Thanks for the information about the empty string.  The script I have written - but cannot yet test - uses objNull.  If I can't get that to work I will go for the empty string.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re:Global Find
« Reply #12 on: 28 Oct 2004, 16:35:51 »
Maybe this will help determine the upper limit for objids.  Place one new unit on an empty map and get its ID.  I'm assuming units added through mission editor will have a highter number than any object pre-placed in the map.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Global Find
« Reply #13 on: 28 Oct 2004, 16:41:59 »
Negative.
Object IDs are created by the Island creation tool (Visitor/Wrp Edit), the editor placed objects have no IDs...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #14 on: 28 Oct 2004, 20:56:59 »
OK.  So I now have a script that increments the objects from 0 upwards and displays the typeOf that object on the screen.  

But I am now having problems with getting it to take action.

For example:  

I know that (object 37326) is a  StreetLampMetal

but:

if ((object 37326) == StreetLampMetal) then {hint " well this works"}

Does not do anything.

Am I being stupid again?