Home   Help Search Login Register  

Author Topic: Checking if markertype exists  (Read 677 times)

0 Members and 1 Guest are viewing this topic.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Checking if markertype exists
« on: 09 Oct 2005, 23:55:14 »
the script system

Firstly i have a script that defines a set of variables (to be called upon later
this basically is a list of vehicle classnames with "_icon" added to the end of them
and then these are equalled to a "markertype"

eg
markerInit.sqs
Quote
classname1_icon = "markertype stringname"
classname2_icon = "markertype stringname"
classname3_icon = "markertype stringname"

i then basically have a marker setpos script which sets the marker type defined in the above script for a given vehicleclassname


Markersetpos script
Quote
;; only relevant code displayed

_v = vehicle _u
_type = call (typeof _v + "_Icon")
;;_type should then be redefined by the markerInit.sqs into a markertype
_m setmarkertype _type


My problem is, if for some reason the
classnameX_icon = "markerclass stringname" hasnt been declared, i need to fall back to a default marker
and therefore i need to be able to return whether _m is a real classname of marker

I dont want to use an
if (_m in array)
if (getmarkertype _m in array)

as there are approx 100 markers it could be and searching through such an array would be very cpu intensive


any help would be greatly appreciated
« Last Edit: 10 Oct 2005, 01:14:55 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Checking if markertype exists
« Reply #1 on: 10 Oct 2005, 00:27:23 »
Scripts are not really my strong point, but:

_type = call (typeof _v + "Icon")

Should that not be?:

_type = call (typeof _v + "_Icon")


If not, I'll crawl back into my box.   ::) ::)


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

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Checking if markertype exists
« Reply #2 on: 10 Oct 2005, 01:15:11 »
Well spotted on the syntax error Planck

Have figured solution out anyway

if _type hadnt been listed in the markerInit.sqs
then _type returns "scalar bool array string 0xfcffffef" error

so i can use that

eg

if! (_type == "scalar bool array string 0xfcffffef")then
« Last Edit: 10 Oct 2005, 01:27:31 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123