Author Topic: [SOLVED] How to convert this bool to an integer?  (Read 1780 times)

jclampy69

  • Full Member
  • ***
  • Posts: 86
    • View Profile
[SOLVED] How to convert this bool to an integer?
« on: January 08, 2021, 02:18:15 PM »
Hi, can someone give me pointers on how to do this properly. I haven't tried converting a bool to an integer before and am finding it difficult to find an example of doing this.

Code: [Select]
local whatdir; //direction of scrolling

function dir_on_transition( ttype, var, ttime)
    {
    if ( ttype == Transition.ToNewSelection)
        {
        if ( fe.get_input_state( "Up") == true) whatdir = "-1"
        else if ( fe.get_input_state( "Up") == true) whatdir = "1"
    }
    print (whatdir) // debugging
}
fe.add_transition_callback( "dir_on_transition")

Thanks to Oomek for finding me a solution.
Code: [Select]
local whatdir = 0; //direction of scrolling

function dir_on_transition( ttype, var, ttime )
{
if ( ttype == Transition.ToNewSelection )
{
whatdir = -var
print ( whatdir ) //debugging
}
return false
}
fe.add_transition_callback( "dir_on_transition" )
« Last Edit: January 08, 2021, 04:33:01 PM by jclampy69 »