OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: gadolinite on 26 May 2004, 01:41:17

Title: [] exec "scriptname.sqs"
Post by: gadolinite on 26 May 2004, 01:41:17
[what goes here?] exec "scriptname.sqs"
Title: Re:[] exec "scriptname.sqs"
Post by: Chris Death on 26 May 2004, 01:58:51
[whatever_you_want] exec "scriptname.sqs"

http://www.ofpec.com/editors/browse.php?category=1_3

check out the link step by step - and you should find alot of
answers to your question  ;)

~S~ CD
 
Title: Re:[] exec "scriptname.sqs"
Post by: j-man on 26 May 2004, 02:15:16
that's where your variable(s) go.
If your script has a line like this:

Code: [Select]
_varname = _this select 0
that what ever you put in between the "[]" will replace "_varname" in your script

eg.

Code: [Select]
[jman] exec "script.sqs"
and then...

Code: [Select]
_man = _this select 0

_man setdammage 0

exit

In that script, the soldier named "jman" would have his dammage set to 0. But if you replace "jman" with something else when you execute the script, then who ever you replace "jman" with, would have there dammage set to 0.
Title: Re:[] exec "scriptname.sqs"
Post by: Chris Death on 26 May 2004, 03:33:59
j-man - soz, but i don't think it make much sense to go into
deatail about passing unitnames or anything else at this point
of the questions here.

Maybe this one makes more sense (don't think so without
having read a tut about scripts or arrays, but however):

[] exec "sriptname.sqs"

[] = an array of any kind

inside script an array can be accessed as a whole by:

_this

or by individual elements e.g:

_this select 0
_this select 1
_this select etc.

let's say the array = [whateva1,whateva2,whateva3]

then:

_this = [whateva1,whateva2,whateva3]

or:

_this select 0 = whateva1
_this select 1 = whateva2
_this select 2 = whateva3

:note - again all i can suggest you is to have a read thru some
scripting tutorials to get some more knowledge about what
i'm talking here.

~S~ CD
Title: Re:[] exec "scriptname.sqs"
Post by: General Barron on 26 May 2004, 04:04:06
Not to make things too complicated for you here, but you can also pass other things besides arrays:

unit1 exec "blah.sqs"

then in your script, "blah.sqs", you will have access to a variable called "_this". Since you passed the script unit1, _this will refer to unit1 in that particular copy of the script that you just now ran.
Title: Re:[] exec "scriptname.sqs"
Post by: gadolinite on 26 May 2004, 22:43:13
I see, thats the OFP game engine's way of passing parameters.
Title: Re:[] exec "scriptname.sqs"
Post by: gadolinite on 30 May 2004, 18:31:47
How would set this up?

trigger condition 1 pseudocode:
[partone] exec "domove.sqs"

trigger condition 2 pseudocode:
[parttwo] exec "domove.sqs"



#partone

chop domove getpos a

exit

#parttwo

chop domove getpos b

exit

 :)Thanks
Title: Re:[] exec "scriptname.sqs"
Post by: PsyWarrior on 30 May 2004, 18:36:09
Greets,

Try this out:

Code: [Select]
_Place = _this select 0

goto _place
hint "Error! _place must be Part1 or Part2!"
exit

#Part1
;code
exit

#Part2
;code
exit

Exec it with
["Part1"] exec "Script.sqs

You must use the speech marks in the execution.

That should do it ;).

-Supr. Cmdr. PsyWarrior
-Psychic Productions