OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: dmakatra on 02 May 2004, 17:17:50

Title: local variable not working in setmarkerpos command!
Post by: dmakatra on 02 May 2004, 17:17:50
Hi! I have this setmarkerpos command yeh? And I want a local variable as the marker name... which is quite screwy 'cause the markername have to be in qoutes. :-\ I've tried using the format command but no luck. What should I do?

"_marker" setmarkerpos getpos _GL
format ["%1" setmarkerpos getpos _GL, _marker]

Above are the two lines I've tried with.

:beat: *Gets Shot* :beat:
Title: Re:local variable not working in setmarkerpos command!
Post by: Planck on 02 May 2004, 17:35:15
How are you setting the local variable as the marker name in the first place?

_marker = this select ?

or

_marker = mymarker

or how?

Presuming your marker is named mymarker.




Planck
Title: Re:local variable not working in setmarkerpos command!
Post by: dmakatra on 02 May 2004, 17:43:59
_marker = _this select 3

:beat: *Gets Shot* :beat:
Title: Re:local variable not working in setmarkerpos command!
Post by: Planck on 02 May 2004, 17:50:39
Have you tried without the quotes then?

_marker setmarkerpos getpos _GL


Planck
Title: Re:local variable not working in setmarkerpos command!
Post by: dmakatra on 02 May 2004, 17:53:06
Yes, and the command requires qoutes. :-\

:beat: *Gets Shot* :beat:
Title: Re:local variable not working in setmarkerpos command!
Post by: Chris Death on 02 May 2004, 17:54:23
errrm Armsty,

_marker is a local variable -> you're right

but:

"_marker" is a string called: "_marker"

When executing your script the line should look like that:

[whatever,whatever,whatever,"markername"] exec "script.sqs"

Now you can say in your script:

_marker = _this select 3

and now you can say:

_marker setMarkerpos getpos _gl

as _marker now represents: "markername"

:edit - btw - another way could have been (in case you wouldn't
execute the script with the markername between quotes);

_marker = format ["%1",_this select 3]

That way you could have put the markernames into quotes
too then.

~S~ CD
Title: Re:local variable not working in setmarkerpos command!
Post by: dmakatra on 02 May 2004, 17:57:16
Oh right! Stupid me. Cheers guys!

I'll lock this when I've tried it out and I have seen that it works (I'm sure it will, just gonna be 100 % :) ).

:beat: *Gets Shot* :beat:

EDIT: #Locked. Puh! Just 20 scripts or so more and then I'm done with the backbone of the mission. ::)