OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Blanco on 27 Feb 2005, 02:48:45
-
I wanna know if it's possible to use a simple condition line as parameter to execute a script?
something like this:
[unit1, (getdammage unit2 > 0.5)] exec "script.sqs"
I tried it with
call _this select 1
but it doesn't work...
-
I am famous, at least with me, for my ignorance on scripting matters. Consequently, no matter how embarrassng the following is, I'm not embarrassed.
Could you pass the conditional bit as a string, and then un-string it in the script?
-
macguba is correct. What you are doing is passing the true/false result of that condition to the script. Using a boolean with the "call" command will cause an error. Instead, pass it as a string, and then use the "call" command on it:
[unit1, "getdammage unit2 > 0.5"] exec "script.sqs"
_damaged = call (_this select 1)
-
Whoo-hoo! :wow: :toocool:
-
I tried it that way General, but nothing happens, no errors, just nothing...
[this,"Getdammage unit2 > 0"] exec "script.sqs"
_damaged = call (_this select 1)
#loop
?_damaged : hint "ok":exit
~1
goto "loop"
I killed unit2, but no hint :-[
-
Just a thought but when this line is executed:
[this,"Getdammage unit2 > 0"] exec "script.sqs"
Won't that make 'select 1' equal to 0, as he is still alive at that time.
Possibly you need to take:
_damaged = call (_this select 1)
and put it inside the loop.
Planck
-
just thinking aloud... can you assign a condition to a variable?
_dammaged = _this select 1
#loop
?(call _damaged) : hint "ok":exit
~1
goto "loop"
that looks better to me
-
Wohoo! It works! Thx a lot! (all of ya)
Planck is right. Very nice... :)
PS: I also tried your code Triggerhappy, it doesn't work, at least not in my example.
-
Did you copy TriggerHappy's code via cut and past?
He has a titchy little typo there:
_dammaged.......and then
_damaged.
If you didn't copy/paste it just ignore me.
Planck