SphereCommunity
Not triggering time expiry - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Not triggering time expiry (/Thread-Not-triggering-time-expiry)



Not triggering time expiry - mlyon83 - 05-18-2013 04:39 AM

The script below won't take action to release a player from jail. LINK.ACCOUNT.TAG.JAIL_TIME value is 30 seconds. Any idea?


Code:
IF (<LINK.ACCOUNT.TAG.JAIL_STATUS> == 1)
    LINK.TAG.JAIL_TEMP_CALC=<EVAL <SERV.TIME> / 10>
    LINK.TAG.JAIL_TEMP_CALC2=<EVAL <SERV.TIME>+<LINK.ACCOUNT.TAG.JAIL_TIME>>
    IF (<LINK.TAG.JAIL_TEMP_CALC> >= <LINK.TAG.JAIL_TEMP_CALC2>)
        LINK.ACCOUNT.TAG.JAIL_STATUS=0
        LINK.TAG.JAIL_LOGIN=0
        LINK.TAG.JAIL_LOGIN2=0
        LINK.EVENTS=-e_player_jailed
        LINK.GO=<LINK.TAG.JAIL_RELEASE_POSITION>
        LINK.MESSAGE @00 You feel free.
    ELSE
        IF (<LINK.REGION.NAME> != Jail)
            VAR.NEXT_JAIL_CELL=<VAR.NEXT_JAIL_CELL>+1
            IF (<VAR.NEXT_JAIL_CELL> >= 5)
                LINK.GO=3905,1255,-10
                VAR.NEXT_JAIL_CELL=0
            ELSEIF (<VAR.NEXT_JAIL_CELL> >= 4)
                LINK.GO=3904,1265,-10
            ELSEIF (<VAR.NEXT_JAIL_CELL> >= 3)
                LINK.GO=3914,1265,-10
            ELSEIF (<VAR.NEXT_JAIL_CELL> >= 2)
                LINK.GO=3914,1255,-10
            ELSEIF (<VAR.NEXT_JAIL_CELL> >= 1)
                LINK.GO=3905,1255,-10
            ENDIF
            LINK.MESSAGE @00 You cannot leave jail until you're forgiven.
        ELSE
            LINK.MESSAGE @00 Nothing shows, test.
        ENDIF
    ENDIF
ENDIF



RE: Not triggering time expiry - RanXerox - 05-18-2013 06:12 AM

Not enough information... is that code on a item? Is the item a memory on the player? Does it have a timer? Is the timer being set properly? Is this code sample from the timer trigger? Does the player have all the right tags? Are there syntax errors?


RE: Not triggering time expiry - mlyon83 - 05-18-2013 10:54 AM

(05-18-2013 06:12 AM)RanXerox Wrote:  Not enough information... is that code on a item? Is the item a memory on the player? Does it have a timer? Is the timer being set properly? Is this code sample from the timer trigger? Does the player have all the right tags? Are there syntax errors?

Everything on it works fine up until the IF (TIME >= TIME) statement. I've even done test messages to see if it works. The problem is it's not processing that IF statement to evaluate the time properly, so the player sits in jail without automatically being released.


RE: Not triggering time expiry - RanXerox - 05-18-2013 04:52 PM

It seems to me that (<SERV.TIME> / 10) is always less than (<SERV.TIME>+<LINK.ACCOUNT.TAG.JAIL_TIME>) unless this jail_time tag is a number less than zero...

Or in other words, (a tenth of "something") is always less than ("something" plus "something else") unless that "something else" is a very small number. You said that "something else" is 30, which is definitely not a small number...