Check a global variable then perform a calculation

0 favourites
  • 3 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • I'm trying to get Construct to perform a calculation if a certain variable is set a certain way. But I cannot figure out how.

    The global variable cfcf can only be C or F. If it is C I want it to convert the value of OVTEMP (imagine OVTEMP is normally in fahrenheit) using the formula OVTEMP * 9 / 5 + 32 and then storing the new number in OVTEMP.

    It is impossible. I've tried a thousand different things and none work. I could even do this in BASIC in seconds but I cannot find the right way to talk to javascript to get it to do something so simple. Where am I going wrong?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Not sure about global scope but you can access the local variables with localVars.variable.

  • I'm trying to get Construct to perform a calculation if a certain variable is set a certain way. But I cannot figure out how.

    The global variable cfcf can only be C or F. If it is C I want it to convert the value of OVTEMP (imagine OVTEMP is normally in fahrenheit) using the formula OVTEMP * 9 / 5 + 32 and then storing the new number in OVTEMP.

    It is impossible. I've tried a thousand different things and none work. I could even do this in BASIC in seconds but I cannot find the right way to talk to javascript to get it to do something so simple. Where am I going wrong?

    Picture from old post on how to set global variables in js

    So i guess you should try to use runtime.globalvars.YOURVARIABLE and then set it to your JS variable, example FOO

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)