Watching Values

  • #1, by redsparkSaturday, 20. June 2015, 13:19 10 years ago
    Is there a way to monitor the value of Conditions or Values while the game is being played? Like an expression watch in most IDEs. Thanks.

    Forum Fan

    122 Posts


  • #2, by afrlmeSaturday, 20. June 2015, 14:12 10 years ago
    What you mean like an overlay that displays when you change something? You could check with the developer console I suppose.
    PRINT CONDITIONS -- will display a list of all conditions & their values
    PRINT VALUES -- will display a list of all values & their values
    

    Hope this helps?

    P.S: I suppose it would be possible to script a system that displays recent changes like an auto log, but it would probably be more hassle to write than it's worth, especially if you are using loops at any point to update values.

    Imperator

    7285 Posts

  • #3, by redsparkSaturday, 20. June 2015, 15:36 10 years ago
    I just found the developer console. Yes, that is what I'm looking for. I didn't even know that existed. Thanks.

    What I'm trying to do is implement a simple Finite State machine for sliding my inventory and other interfaces in and out of the screen. However, I'm having a hard time determining if the state value within the interface has changed because nothing seems to be happening. wink I have something messed up but I don't know where.

    Forum Fan

    122 Posts

  • #4, by afrlmeSaturday, 20. June 2015, 15:56 10 years ago
    You could always check the position of x interface, or just declare slide in the other interfaces when you slide the inventory interface out. If they are already at the target position then it'll ignore the commands to slide them in.

    Imperator

    7285 Posts

  • #5, by redsparkSaturday, 20. June 2015, 16:45 10 years ago
    Oh my goodness! I actually got it to work! Let me know what you think:
    --[[
    *********************************************************************************
    INVENTORY
    *********************************************************************************]]--
    local inventory_States = {
    [1] = function () end,
    [2] = function () 
    local inventory = getObject("Interfaces[inventory]")
    local p = inventory:getPoint(VInterfaceOffset)
    if p.y<=640 then 
    getObject("Values[inventory_state]"):setValue(VValueInt, 1)
    else
    p.y= p.y-2
    inventory:setValue(VInterfaceOffset,p)
    end
    end,
    [3] = function ()
    local inventory = getObject("Interfaces[inventory]")
    local p = inventory:getPoint(VInterfaceOffset)
    if p.y>=696 then 
    getObject("Values[inventory_state]"):setValue(VValueInt, 1)
    else
    p.y= p.y+2
    inventory:setValue(VInterfaceOffset,p)
    end
    end
    }
    
    
    function updateInventory()
    local inventory_state = getObject("Values[inventory_state]"):getInt(VValueInt)
    inventory_States[inventory_state]()
    end
    
    
    
    --[[
    *********************************************************************************
    HANDLERS
    *********************************************************************************]]--
    function updateInterfaces()
    updateInventory()
    end
    
    function onMainLoop()
     updateInterfaces() -- updates all Interface Positions
    end
     
    registerEventHandler("mainLoop", "onMainLoop")
    
    


    The inventory_state value is set when your mouse leaves the interface and/or enters a button area -- similar to how you have your sliding interface written.

    Forum Fan

    122 Posts