ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: valen2.0 on August 21, 2016, 03:59:45 PM

Title: Can anyone help
Post by: valen2.0 on August 21, 2016, 03:59:45 PM
I am trying to make a script that will cast curse weapon. But I also want it to implement a buffbar scanner. Either Twinkle McNugget or ens. Would anyone be able to help me?
Title: Re: Can anyone help
Post by: Endless Night on August 22, 2016, 02:30:55 PM
I am trying to make a script that will cast curse weapon. But I also want it to implement a buffbar scanner. Either douchebags or ens. Would anyone be able to help me?

We don't post/use the name of the Scripty on this site.   He burned alot of people here via many methods,  needless to say he left a major sour taste in everyones mouth.


But you are more than welcome to use the original and still the best Buffbar scanner.   It just so happens i posted a new beta version of script... http://www.scriptuo.com/index.php?topic=1508.msg114465#msg114465

Download those follow setup instructions in first post (basically put files  in same directory as easyuo.exe)

Then your custom script could be something like this...
Code: [Select]
repeat
   call scanbuffbar
   if  _CurseWeapon_ notin %BuffBarIconNames
       {
       ; code to caste curse weapon
       }
until #charghost = yes
Title: Re: Can anyone help
Post by: valen2.0 on August 22, 2016, 04:35:47 PM
Sorry for using his name I did not know that. And I will try this and also give feed back as well if you would like as you stated it was beta.
Title: Re: Can anyone help
Post by: Endless Night on August 22, 2016, 04:54:14 PM
Sorry for using his name I did not know that. And I will try this and also give feed back as well if you would like as you stated it was beta.

The latest version is a beta version inbetween version ... as I made alot of changes between version 40 and 41.   But its not a true beta as the script is many many years old.  I think I started writting the buffbar scanner back in 2003/4 when the buffbar  was initially introduced into UO and everyone said it couldn't be done... so its well over a decade old.   :)    That said yes please let me know if you have any difficulties.

Title: Re: Can anyone help
Post by: valen2.0 on August 22, 2016, 05:01:27 PM
Also thank you for the code. I do appreciate it. What I had looked nothing like this lol. I'm not too good at this language it seems.
Title: Re: Can anyone help
Post by: Endless Night on August 22, 2016, 05:21:43 PM
Also thank you for the code. I do appreciate it. What I had looked nothing like this lol. I'm not too good at this language it seems.

Na if you look at the history of this script on Easyuo you will see it has been through an excess of 41 iterations/versions many unreleased.  Each time the code gets reduced and the scanning speed increases.  The first version was 100% readable like a book as time went on it has gottens less and less readable as I utilize what ever tricks i can muster to gain speed.    The first version would take one second plus to read the bar .. now its averaging 1-2ms !!!
Title: Re: Can anyone help
Post by: valen2.0 on August 23, 2016, 07:03:56 AM
ok so i have redownloaded the new files EN, but when I run this it doesn't appear to can the bar. I just waits about 10 seconds and recasts. The files are all in the same directory. Am i not implementing the file correctly? Or am I missing it locating the icon itself?


repeat
   call scanbuffbar
   if  _CurseWeapon_ notin %BuffBarIconNames
       {
        event macro 15 104
        wait 5
       }
until #charghost = yes
Title: Re: Can anyone help
Post by: Endless Night on August 23, 2016, 07:19:25 AM
ok simple test to make sure its finding the the code.

Open buffbar .. Have at least one icon on it .. (any icon) run below code... and post up what it tells you.

Code: [Select]
call scanbuffbar
display ok  BAR Direction: %BuffbarDirection $  Icons Found: %BuffBarIconsFound $ Icon Names: %BuffBarIconNames
halt
Title: Re: Can anyone help
Post by: valen2.0 on August 23, 2016, 08:26:20 AM
Bar direction: right
Icons Found: 4
Icon Names: enchanted summoning, poison resistance,lightning strike , and vampiric embrace.


So it scans the bar.

Post Merge: August 23, 2016, 08:35:05 AM
is an else statement missing inside the loop?
Title: Re: Can anyone help
Post by: Endless Night on August 23, 2016, 08:48:06 AM
Umm caste  Curseweapon on yourself and then run the test see if it detects it... or not ?
Title: Re: Can anyone help
Post by: valen2.0 on August 23, 2016, 09:23:42 AM
It detects it. I had like 7 icons and it showed them all.

Post Merge: August 23, 2016, 09:25:12 AM
I double checked the spelling just invade there was a conflict there. It was the same. Is the notin function not working properly?
Title: Re: Can anyone help
Post by: Endless Night on August 23, 2016, 09:31:17 AM
It detects it. I had like 7 icons and it showed them all.

Post Merge: August 23, 2016, 08:25:12 AM
I double checked the spelling just invade there was a conflict there. It was the same. Is the notin function not working properly?

Well lets try different logic..   if not ( blabla in blabla )

if  ! ( _CurseWeapon in %BuffBarIconNames )
   {  ; code to caste curseweapon }


Make sure the %BuffbarIconNames  showes  CurseWeapon as   _CurseWeapon  ... with the _ infront...
Title: Re: Can anyone help
Post by: valen2.0 on August 23, 2016, 10:27:55 AM
OK I will double check that after I finish running errands. It's my day off lol.

Post Merge: August 23, 2016, 04:55:29 PM
hmm it still doesn't work. It always recasts it around 10 seconds in.
Title: Re: Can anyone help
Post by: Endless Night on August 23, 2016, 05:21:26 PM
I double checked the spelling just invade there was a conflict there. It was the same.

What did you mean by above please post the exact code from your script cut and paste.  Its going to be something silly.
Title: Re: Can anyone help
Post by: valen2.0 on August 23, 2016, 05:26:35 PM
I meant just incase there was a spelling error. I looked to make sure that in the code the variable wasn't spelled different.
The current code is


repeat
   call scanbuffbar
   if  ! ( _CurseWeapon in %BuffBarIconNames )
       {
        event macro 15 104
        wait 5
       }

until #charghost = yes
Title: Re: Can anyone help
Post by: The Ghost on August 23, 2016, 05:56:32 PM

try this
Code: [Select]
repeat
   call scanbuffbar
   if  _CurseWeapon_ in %BuffBarIconNames
       {
        event macro 15 104
        wait 5
       }

until #charghost = yes
Title: Re: Can anyone help
Post by: valen2.0 on August 23, 2016, 06:30:42 PM
Ok, so

repeat
   call scanbuffbar
   if  _CurseWeapon_ in %BuffBarIconNames
       {
        event macro 15 104
        wait 5
       }

until #charghost = yes

doesn't cast the spell at all. So the scanner is obviously working.  Why wouldn't the previous code work?
Title: Re: Can anyone help
Post by: valen2.0 on August 24, 2016, 08:02:51 PM
Ok, so I have tried to place call scanbuffbar in the code in different places and even call it more than once to see if for some reason it wasn't updating correctly. Like it overwrote the variable maybe? still nothing. it still casts every 10 seconds or so.
Title: Re: Can anyone help
Post by: Endless Night on August 25, 2016, 05:09:57 AM
Ok, so I have tried to place call scanbuffbar in the code in different places and even call it more than once to see if for some reason it wasn't updating correctly. Like it overwrote the variable maybe? still nothing. it still casts every 10 seconds or so.

Ok I am going to have to create a char on test center to get to the bottom of this. 
Title: Re: Can anyone help
Post by: Endless Night on August 25, 2016, 06:00:57 AM
Figured it out... My Mistake... it no other icons on Bar curseweapon is being returned as  CurseWeapon_   not _CurseWeapon_

Will include fix in next release.. but you can fix yourself  edit line 40 of  scanbuffbar.txt   change  "set %BuffBarIconNames"   to  "set %BuffBarIconNames _"

Code: [Select]
repeat
   call scanbuffbar
   if  _CurseWeapon_ notin %BuffBarIconNames
       {
        event macro 15 104
        ; below waits are to give time for spell to finish casting and buff to load so dont repeat try to caste.
        wait 5
        While #charstatus = A    ; casting spell
          wait 1
        wait 2 ; time needed for buff to be added
       }
until #charghost =yes
Halt
    


As i predicted it was something silly.
Title: Re: Can anyone help
Post by: The Ghost on August 25, 2016, 07:23:30 AM
 FYI,
 Rebirth have no icon for Curse weapon.
Title: Re: Can anyone help
Post by: valen2.0 on August 25, 2016, 07:44:25 AM
IT WORKS! also i did find a little hiccup haha. If you have your pointer over the bar it bugs out the scanner it seems and it will either spam cast or cast every couple seconds.
Title: Re: Can anyone help
Post by: Endless Night on August 25, 2016, 08:10:02 AM
IT WORKS! also i did find a little hiccup haha. If you have your pointer over the bar it bugs out the scanner it seems and it will either spam cast or cast every couple seconds.

yes i you cover specific icons  but not other spots on buffbar script not be able to read all icons...   Only way to eliminate that is much more scanning...   The next version will have a few additional checks for exactly that.  Life is sometimes a compromise,  In order to completely 100% know the length of the bar I would have to refresh it every time.  But that would be annoying, the bar constantly reopening and thus blinking on your screen  My original version way back when did that and it was annoying.  So Place your bar in out of way spot not likely to get accidentally covered.

The bar is read via pixel scanning in EUO their is no way to do it otherwise.. in stealth you can read the gump in memory and thus is 100%  accurate 100% Of the time and  faster.    As long as you take reasonable precautions my buffbar scanner will be 100% accurate as well.