Jump to content
Sign in to follow this  
igneous01

Passing the value of a function to another script

Recommended Posts

as the title says, how do you get the value or result from a function into a variable in another script? and this means that it must take the end result value, because if the function is run multiple times i dont want it to overwrite the existing information from the previous function result.

im not sure if that was clear, but another ex.

a function to get the score of hits, and store it (this wil be the score of test1)

recycling the function for the other tests, and storing them as well.

maybe theres a way to getVariable from outside of the scope and script into another one?

any ideas?

Share this post


Link to post
Share on other sites

To get around the limits of spawn and returning data I developed an interprocess communication ( IPC ) subsystem - using gamelogics and setVariable. Others have developed similar tech. Look into one of those for inspiration.

Share this post


Link to post
Share on other sites

interesting indeed ^^

but i havnt been able to find anything IPC related on both google/biki or here. Unless its under another topic maybe?

And how did you do it? ran the script from the gamelogic and used setvariable from there? then getvariable from the script? and did u just use more gamelogics for more times the script was run?

ill try and see if i can accomplish something similar.

thanks for the insight

EDIT**

i dont know if this would work, but what if i formatted the value of a variable into string, and then used compile afterwards? that way the function can run as many times as needed, once i compile the value that was formatted, it should return the value that was last updated when format was used?

Edited by Igneous01

Share this post


Link to post
Share on other sites

Look for the ECHO package, my IPC stuff and documentation is in there. It's on armaholic, a discussion thread in the complete mods section.

Share this post


Link to post
Share on other sites

An alternative more simpler approach might be to just spawn a function that handles this, passing the unit to the function?

Share this post


Link to post
Share on other sites

EDIT**

i dont know if this would work, but what if i formatted the value of a variable into string, and then used compile afterwards? that way the function can run as many times as needed, once i compile the value that was formatted, it should return the value that was last updated when format was used?

I´d love to know if this works and how the exact syntax would look like...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×