Home   Help Search Login Register  

Author Topic: Global Find  (Read 1988 times)

0 Members and 1 Guest are viewing this topic.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Global Find
« Reply #15 on: 28 Oct 2004, 22:01:37 »
Maybe you need the typeOf command in there, something like:

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

Syntax not guaranteed at all.


Planck
I know a little about a lot, and a lot about a little.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #16 on: 28 Oct 2004, 22:07:17 »
Well I was being stupid

Thanks Plank.  Unfortunately:
if ((object 37326) == typeof "StreetLampMetal") then {hint " well this works"}

generates an error.  but:
if (typeof (object 37326) == "StreetLampMetal") then {hint " well this works"}

is the one I need.

Thanks

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #17 on: 28 Oct 2004, 22:31:27 »
OK.  Attached is a script that searches though the obects in a map to find all objects of a given type.  The script attached will find all:

StreetLampPanel

and all

StreetLampMetal

objects.

Are there any other types of streetlamp?

It is easy to change this script to find any type of object.

What do you think?  Is it worth tidying it up and putting in the Script Beta site?
« Last Edit: 28 Oct 2004, 22:31:47 by THobson »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Global Find
« Reply #18 on: 28 Oct 2004, 22:44:54 »
Well...


StreetLampMetal is configured to use model 'lampazel.p3d'.

StreetLampWood uses 'lampadrevo.p3d

Those are in the Data3d.pbo


The rest are part of Resistance and so will be in the O.pbo:

StreetLampPanel uses 'vo_seda.p3d'
StreetLampPanelAmpl uses 'tlampac_vo_seda.p3d'
StreetLampYellow uses 'vo_zlut.p3d'
StreetLampCut uses 'lampa_cut.p3d'

Those are in O\Misc, apart from the last one which is in O\Hous.

There is another StreetLamp model but I don't know if, or where, it is configured..........O\Misc\vo_stara1.p3d

So.........Yes there are others.

I will try out your script and report back.


Planck
« Last Edit: 28 Oct 2004, 22:49:54 by Planck »
I know a little about a lot, and a lot about a little.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #19 on: 28 Oct 2004, 22:51:25 »
Thanks.  I will update the script tomorrow to look for the others.

The script above is a little unfriendly.  The one attached will pause after finding each object.

They are both terribly slow

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Global Find
« Reply #20 on: 29 Oct 2004, 01:59:31 »
if (typeOf (object 37326) == "StreetLampMetal") then {hint " well this works"}

Just a guess .... typeOf command missing and also quotes.
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #21 on: 29 Oct 2004, 07:50:57 »
Mac.  Thanks for the reply, you are absolutely correct, but we had actually got there at post 16.  

Any thoughts on the script?  It may be that it would only be any use to the newbies like me that havn't yet figured out how to look inside the maps.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #22 on: 29 Oct 2004, 09:01:45 »
I am well on my in tidying up the code and making it more general.  Any comments on its usefulness would be greatly appreciated.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Global Find
« Reply #23 on: 29 Oct 2004, 22:17:11 »
I tried this script and I am happy to report that it found all of the streetlights on Abel (Malden) without a hiccup.

All 12 of them, just in case people wondered how many there were on Malden.

The reported ID numbers were also correct.

It might be useful to make a dialog and expand the script so that a mission maker can input the object, or objects, they wish to search for.


Planck
« Last Edit: 29 Oct 2004, 22:17:55 by Planck »
I know a little about a lot, and a lot about a little.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #24 on: 29 Oct 2004, 22:39:27 »
Planck:  Thank you.  One thing I don't like about it so far is that the exact object name needs to be used.  I was hoping to be able to search for "Street" to get all the streetlamps,  "Fuel" for all the fuel stations  etc.

This is the subject of a thread I started in Advanced Scripting (String manipulation) so no comments here please on that - I don't want to be accused of starting a duplicate thread.

I too searched Malden for streelamps.  That is where my mission is and I want to turn off all the streetlamps.  I noticec they are all metal.  (I have modified the script to search for all the ones you told me about yesterday)

Is an alternative to this script opening up the map and doing a text search there?  I have no experience of WrpEdit.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Global Find
« Reply #25 on: 29 Oct 2004, 22:56:57 »
Quote
Is an alternative to this script opening up the map and doing a text search there?  I have no experience of WrpEdit.

No, Wrpedit does not show you the ID numbers.

Wrpedit will show you the p3d file names on each object that you hover the mouse over.
It does not give you the object name or the ID number.

So, you won't be able to do it that way either.......sorry


Planck
I know a little about a lot, and a lot about a little.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Global Find
« Reply #26 on: 30 Oct 2004, 07:37:09 »
Thanks.  Pity.