Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Set the value of AMBIENCE=X to a value or a global variable.

Author
Message
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 4th Nov 2013 07:24 Edited at: 4th Nov 2013 07:37
So you know how in practically any language out there you can do this:


This will set SECONDnewVARIABLE to 30.

So in FPI I have a global variable called FLVALUE. (global for the purpose of being accessible by every entity.)


Now I want AMBIENCE=X to have the value of this variable, so logically this right here should make sense.



This should logically assign AMBIENCE the current value of FLVALUE which is 74.

How can I assign the values of variables to the action functions?

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 4th Nov 2013 07:44 Edited at: 4th Nov 2013 07:44
GOT IT!!!!!!!!!!!! (I apologise but it seems to be the curse of mine that I shall find an answer on my own just after asking someone else. )

I shall compensate by posting an answer.

If I want the function like AMBIENCE=X to take the value of a declared variable (FLVALUE) I should use a % sign before the variable name.

AMBIENCE=%FLVALUE

Sorry for the hassle

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com
Teabone
Valued Member
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Canada
Posted: 4th Nov 2013 07:46 Edited at: 4th Nov 2013 07:47
Trying putting a percent sign in front of FLVALUE. Hopefully that works out.


EDIT: LOL there you go beat me to it :p

(Teabone)
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 4th Nov 2013 08:10
Any ideas on this case?

Using the SETVARRND=VarName X

Where X I want to use a value of another Variable.


Logically this would generate a random number from 0 to 468 and then assign AMBIENCE to the value of RANDOMvar which is looped.

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com
Teabone
Valued Member
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Canada
Posted: 4th Nov 2013 08:16
I'm assuming you want it to randomly flash lights? As the state is returning to 2.

Does it work though for you when you use the value of a variable to randomize with?

(Teabone)
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 4th Nov 2013 08:26 Edited at: 4th Nov 2013 08:52
Yes for the purpose of visually confirming that this system is working, I picked AMBIENCE=X. (Now forget about AMBIENCE=X maximum set to 100)

Thus far with SETVARRND=VarName X I am not sucessful to assign a variable value to X using the % sign. Perhaps there is another for this task

yes the line:

is supposed to repeat over and over again.

I Could always just set the range of the random value manually but I want to make it auto updated so that in the start of the level I say:

SETVAR=MaximumLightCap 42

so then that script will automatically update the random value to be between 0 and 42. Then in the middle of the level I say:

SETVAR=MaximumLightCap 96
and the random value will be randomized between 0 and 96.

Question is, Can the Variable Function...
SETVARRND=VarName X

...use a value of a variable for its X.

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 4th Nov 2013 20:40
SOLVED IT

All this time I though that SETVAR= command sets up an new variable with a value but in fact in only sets the value of an existing variable. Thus all this time I tried pulling values from non-existing variables.

To create variables I had to use DIMLOCALVAR= then SETVAR= to add value to that variable and now I can in fact copy the value of a variable to be used in X of the:

SETVARRND=VarName X

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com
Teabone
Valued Member
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Canada
Posted: 4th Nov 2013 22:18 Edited at: 4th Nov 2013 22:19
I was going to mention previously that ambient variable can only go within 0 to 100. Though would make more sense if it was 0 to 255 honestly. But I'm assuming it means by percent from 0 to 100, rather than the RGB values of 255 total.

I too have had a couple headaches around setting variables. Its good to post these issues on the forum and your solutions it will help us all out that get often confused lol

(Teabone)
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 5th Nov 2013 00:27
Yes I find that the FPSC Value System is very vague. When it doesn't say what units of measurements some of the features are in you are left to guesstimate and learn from trial and error.

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com

Login to post a reply

Server time is: 2024-03-28 21:14:48
Your offset time is: 2024-03-28 21:14:48