Discussion in 'Script Releases' started by Rodent, Apr 20, 2012.

  1. Rodent

    Rodent Member

    Messages:
    47
    I didn't see anyone make a script to disable wand auto attacks yet, so I made one. Totally possible I missed it though, kinda hard to believe no one posted one yet!

    Attached Files:

  2. macker0407

    macker0407 Active Member

    Messages:
    270
    A mildly improved version of the script. There's no reason to cast the result of Me.RangedAutoAttackOn into a string, and then doing a string comparison. Waitframe can also be dangerous if you're doing something that involves sending commands to the client that also has some server side interactions, hence the use of wait 10 instead(1 second wait).

    Code (Text):

    function main()
    {
        while 1
        {
            if ${Me.RangedAutoAttackOn}
            {
                eq2execute /auto 1
            }
            wait 10
        }
    }
     
  3. Rodent

    Rodent Member

    Messages:
    47
    I didn't want to use wait 10 because I thought it would just trigger every 1 second, and I wanted it triggered instantly. But to be fair, I didn't test wait at all. If wait 1 or wait 2 doesn't lag anything badly it would be a better alternative.

    Also thanks for letting me know about the string thing. The script I edited was a check for maintained and do x if it's up, and for some reason I had to have two strings and compare them, it didn't want to work the other way. I probably mistyped something though.
  4. macker0407

    macker0407 Active Member

    Messages:
    270
    The problem with very low waits is the time it takes for Me.RangedAutoAttackOn to change state. If it's affected by latency you could land up sending 10+ eq2executes to the client before it reflects the new state which increases the server load. I suppose you could use this instead, if you want to attempt to make the flip immediate:

    Code (Text):

    function main()
    {
        while 1
        {
            if ${Me.RangedAutoAttackOn}
            {
                eq2execute /auto 1
                wait 10 !${Me.RangedAutoAttackOn}
            }
            waitframe
        }
    }
     
    That should, in theory, wait for 1 second or until .RangedAutoAttackOn is FALSE before continueing with the loop. Otherwise the loop will repeat every frame.

Share This Page