ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: vanzelus on January 05, 2014, 09:53:23 AM

Title: What to add to prevent the script from toggling off ability too soon.
Post by: vanzelus on January 05, 2014, 09:53:23 AM
Hi,

I currently have this in my attack sub,

Code: [Select]
If #mana >= 45 && %cast_wait_timer <= #scnt2
{
  Event Macro 36 0 ; secondary weapon ability
  Set %cast_wait_timer #scnt2 + 20
}

My question is, what do I need to input besides that code so that when my sampire misses, the ability is still on until it hits the mob?  Currently, it toggles on, if he hits then everything's fine but if he misses, then it'll toggle off, and then back on in a few seconds.  It's not really a problem, just more or less I want it to be as efficient as possible.  Am currently learning how to script properly so any inputs will be of great help.  Thanks.
Title: Re: What to add to prevent the script from toggling off ability too soon.
Post by: Alpha on January 05, 2014, 10:42:18 AM
You need to use the Savepix Command to check the COLOR of your icon which also means you will need to know the Exact location of the icon...

http://wiki.easyuo.com/index.php?title=SavePix
Title: Re: What to add to prevent the script from toggling off ability too soon.
Post by: vanzelus on January 05, 2014, 12:02:30 PM
if that's the only way to do it, then that means I'd have to write a "gosub setpix" and implement the pixel scanning?
Title: Re: What to add to prevent the script from toggling off ability too soon.
Post by: dxrom on January 05, 2014, 12:18:09 PM
In startup you can automate the process (Unlike how I have it in LAME) via knowing where the icons are (EUO has a screen coords thing for where your cursor is) just mouse over, write the coords down and do something like:

Code: [Select]
sub setpixel-secondary
    event macro 36 0 //toggles it on
    wait 2
    savePix 900 300 3 //saves the color @ 900,300 to variable 3
    event macro 36 0 //toggles off
return

Or you can do it the way I did it in LAME:
Code: [Select]
sub setpixel-secondary
    event macro 36 0
    display ok move the mouse to the BOTTOM LEFT CORNER of the secondary Weapon Move button. you have 2 seconds
    wait 2s
    savePix #CURSORX #CURSORY 3
    wait 5
    event macro 36 0
return

And taking it one more level you can research how to save a configuration thus allowing you to not have to re-setup the colors everytime you load your script. Personally I opted out for that as I've never had any success with my own or even other people's scripts and saving settings.

Then it's as simple as a sub like this to execute secondary ability.

Code: [Select]
sub execSec
    cmppix 3 f
       {
       event macro 36 0 ;Use Seconday
       wait 5
       }
return
Title: Re: What to add to prevent the script from toggling off ability too soon.
Post by: vanzelus on January 05, 2014, 12:31:22 PM
Wow, awesome; yea i'd want to have the config saved so i won't need to input the pixel color every time running the script.  Thanks for showing me the options available.  Didn't think of pixel scanning as a method, learn something every time I try to implement new stuffs :)