Watching Values

  • #1, by redsparkSaturday, 20. June 2015, 13:19 5 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

    117 Posts


  • #2, by afrlmeSaturday, 20. June 2015, 14:12 5 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
    1
    2
    3

    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

    6842 Posts

  • #3, by redsparkSaturday, 20. June 2015, 15:36 5 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

    117 Posts

  • #4, by afrlmeSaturday, 20. June 2015, 15:56 5 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

    6842 Posts

  • #5, by redsparkSaturday, 20. June 2015, 16:45 5 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")

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51


    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

    117 Posts

Write post