Hello guys
Let's just tell, that I have two script
1. is like:
bla bla bla bla.....
let flt[0] = 2
bla bla bla bla.....
label 1
let flt[0] = flt[0]-1
2. is like:
bla bla bla bla.....
if flt[0]=1,1000,-1
bla bla bla bla.....
label 1000
do something
It doesn't work. How do I mafia get to share flt[0] between scripts? It seems like variables are local for each script.
I temporrary edited scripts so they are like:
1. is like:
findactor 1, "script2"
let flt[0] = 2
bla bla bla bla.....
bla bla bla bla.....
label 1
let flt[0] = flt[0]-1
label 69
if flt[0]=1,1000,-1
label 1000
setevent 1,100,-1
2. is like:
bla bla bla bla.....
bla bla bla bla.....
event 100
do something
It doesn't work. What am I doing wrong?
let flt[0] = 2 is before any labels, so it will do only once
Use get_remote_float or set_remote_float
get_remote_float xx, yy, zz - returns to xx a value in variable zz which is in script yy
xx - ID of variable in current script
yy - ID of actor remote script
zz - ID of remote variable in script yy
set_remote_float xx, yy, zz - sets variable xx as variable zz in script yy
xx - ID of variable in current script
yy - ID of actor remote script
zz - ID of remote variable in script yy
In your script:
<pre class="ipsCode">script_1:
...
let flt[1] = 2
...
label 1
let flt[1] = flt[1] - 1</pre>
<pre class="ipsCode">script_2:
// eg
findactor 3, "script_1"
...
// you have to use get_remote_float always, when you want to get a value from remote variable
get_remote_float 0, 3, 1
if flt[0] = 1, 1000, -1
...
label 1000
...</pre>
As far as I was aware, variables have to be flagged in the hex, otherwise the script bypasses them as ordinary and inanimate commands.
Thanks guys, I've already solved it. I typed "fintactor" instead "findactor", I am such a dickhead :-[