0
vapno92

VARIABLES - help!

Recommended Posts

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

Share this post


Link to post
Share on other sites

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:

script_1:
...
let flt[1] = 2
...
label 1
let flt[1] = flt[1] - 1

 

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
...

Share this post


Link to post
Share on other sites

As far as I was aware, variables have to be flagged in the hex, otherwise the script bypasses them as ordinary and inanimate commands.

Share this post


Link to post
Share on other sites

Thanks guys, I've already solved it. I typed "fintactor" instead "findactor", I am such a dickhead :-[

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
0