Author Topic: Gorgon lens charge scanner / charger  (Read 14609 times)

0 Members and 1 Guest are viewing this topic.

Offline baldielocksTopic starter

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Gorgon lens charge scanner / charger
« on: July 21, 2010, 10:17:30 AM »
0
~edit. Incorporated below changes. Could use a debugger if anyone is willing. At work for another 8 hours.
Set up: must have (currently) gorgon lens made from bright blue scales (from living medusa). Must have helmet and gorget slots filled with items that can accept charges.
Code: [Select]
;===========================================================
; Name: Gorgon lens charge scanner
; Author: Baldielocks
; Version: 1 Beta
; Easyuo Version : 1.5
; Client Version : 7.0.7.3

; Purpose: Scans gorget and helmet slots for lens charges, applies more if needed and in pack.

; Special Thanks:
; Trailmyx for his gump wait and offset click subs and ideas. And for SUO utility and the site!
; Twinkle McNugget for advice and his ignore item sub.
; Just Another Face for advice on logic writing.
; Massacre for finding my first bug
; Cervesa for the pointer on sub writing.

; Changelog: Beta version 1, 21 July 2010 :
;Corrected flow issues and logic as identified by Cervesa and JAF and everyone else in the thread.

; Info. Must have perfect lens in pack (made from birght blue medusa scale).
; I inserted a hard pause in the script to avoid unintentional loss of lenses by beta testers.
; Remove or comment out if it works smoothly.
;===========================================================

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
BL gorgon lens scanner & recharger.txt
« Last Edit: July 22, 2010, 11:22:02 AM by baldielocks »

Offline Masscre

  • Gran Master Jester !!
  • Scripthack
  • *
  • Posts: 4615
  • Activity:
    0%
  • Reputation Power: 55
  • Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!
  • Gender: Male
  • Air Guitar Commander !!
  • Respect: +144
  • Referrals: 1
    • View Profile
Re: event property / logic check question
« Reply #1 on: July 21, 2010, 10:35:12 AM »
0
This is not your current problem but could be a later problem.

gorgonlens:
 finditem %gorget
 gosub scan %gorget
 finditem %helmet
 gosub scan %gorget (should be %helmet)
goto gorgonlens
halt

Offline JustAnotherFace

  • Hero Member
  • *
  • Posts: 530
  • Activity:
    0%
  • Reputation Power: 8
  • JustAnotherFace has no influence.
  • Gender: Male
  • My new toy....
  • Respect: +24
  • Referrals: 4
    • View Profile
Re: event property / logic check question
« Reply #2 on: July 21, 2010, 10:36:47 AM »
0
I am trying to code a gorgon lens charge scanner. If gorgon is not in #property, script will charge the item.
For some reason, it is not detecting it. Ideas, suggestions, denigrating remarks on my coding skills?
Code: [Select]
set %lens VTO ;currently only detects lens from live medusa (bright blue scale)
 event sysmessage set gorget / necklace for charge scan
set #targcurs 1
while #targcurs = 1
wait 1
set %gorget #ltargetid
 event sysmessage set helmet / glasses / earring for charge scan
set #targcurs 1
while #targcurs = 1
wait 1
set %helmet #ltargetid

gorgonlens:
 finditem %gorget
 gosub scan %gorget
 finditem %helmet
 gosub scan %gorget
goto gorgonlens
halt

 sub scan
 ;%1 = item to scan id
  event property %1
   if gorgon || charges notin #property
 {
 finditem %lens C_, #backpackid
 if #findcnt = 0
 {
 display out of lenses, halting
 halt
 }
 set #lobjectid #findid
 set #ltargetid %gorget

 event macro 17 0
 while #targcurs = 1
 {
 wait 1
 }
 event macro 22 0
 gosub gumpwait waiting_gump 203_121
 gosub OffsetClick 268 184
 wait 15
 return
 
 ;---TM's offset click sub
sub OffsetClick
  set %tempx %1 + #CONTPOSX
  set %tempy %2 + #CONTPOSY
  click %tempx %tempy
return

 ;---TM's waitgump sub
 sub GumpWait
  wait 10
  set %timedelay #SCNT
  loopwait1:
    if #CONTNAME = %1 || #CONTNAME = %2
      return
    if #SCNT > %timedelay + 7
      return
    goto loopwait1
return
 

I believe this line
Code: [Select]
if gorgon || charges notin #property
Should be like this

if gorgon notin #property || charges notin #property

JaF
« Last Edit: July 21, 2010, 10:39:35 AM by JustAnotherFace »
All that tyranny needs to gain a foothold is for people of good conscience to remain silent.
Thomas Jefferson

Offline Masscre

  • Gran Master Jester !!
  • Scripthack
  • *
  • Posts: 4615
  • Activity:
    0%
  • Reputation Power: 55
  • Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!
  • Gender: Male
  • Air Guitar Commander !!
  • Respect: +144
  • Referrals: 1
    • View Profile
Re: event property / logic check question
« Reply #3 on: July 21, 2010, 10:42:00 AM »
0
sub scan
 ;%1 = item to scan id
  event property %1 ;  also here you do not have %1 declared so the script does not know what to do with it
   if gorgon || charges notin #property

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: event property / logic check question
« Reply #4 on: July 21, 2010, 10:44:22 AM »
0
It's in there mass...

 gosub scan %gorget

so %1 = %gorget

Though I usually convert them in the sub so I know what they are....

sub whatever
set !gorget %1
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline Alpha

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: event property / logic check question
« Reply #5 on: July 21, 2010, 10:57:04 AM »
0
Quote

 sub scan
 ;%1 = item to scan id
  event property %1
  Wait 20
   if gorgon || charges notin #property
 {
 finditem %lens C_, #backpackid
 if #findcnt = 0
 {
 display out of lenses, halting
 halt
 }

Event property Takes time to Return a Result..  Your trying to read the properties of the item and continuing on before the item has returned those properties.. or at least that will happen commonly though perhaps not every time.  You can use a simple Wait to increase your odds that #property has updated but it's not bullet proof.

Offline baldielocksTopic starter

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Re: event property / logic check question
« Reply #6 on: July 21, 2010, 11:05:39 AM »
0
Thanks all! Hey I'm still learning! But making progress. Thanks for catching the %helmet! That will save some problems. And will work on declaring the carry over variables in all my scripts.
Wrote this pretty fast, so did not refine it yet for release. (was actually fighting medusa when I wrote it lol, gotta love even the non-elite the whammy assitant).

So, to summarize, change the order as JAF suggested, and add in a wait as Alpha suggested.

Offline JustAnotherFace

  • Hero Member
  • *
  • Posts: 530
  • Activity:
    0%
  • Reputation Power: 8
  • JustAnotherFace has no influence.
  • Gender: Male
  • My new toy....
  • Respect: +24
  • Referrals: 4
    • View Profile
Re: event property / logic check question
« Reply #7 on: July 21, 2010, 11:09:30 AM »
0
What Alpha described is due to your ping / lag.  If you have no lag then event property will generally return without issues.  However as a general rule it is a good idea to put in a short wait to account for any lag and to let the event property command actually process before jumping to the next line of code.

Cerv is also correct of course!  I was typing basically the same thing Cerv typed and hit post and saw that there was a new reply, Cerv beat me to the punch! lol

JaF
All that tyranny needs to gain a foothold is for people of good conscience to remain silent.
Thomas Jefferson

Scrripty

  • Guest
Re: event property / logic check question
« Reply #8 on: July 21, 2010, 11:28:42 AM »
0
In my experience, if the property is updated in the client, which most things are if you have been logged in for a minute or two, you can event property them instantly.  I just took out all the waits in my plant tender, and it scanned 127 plants in 302 seconds with no waits by the event property.  Its scanning things that need to have their info updated by the client that you need to watch for.  Like house signs...  Or characters that recall in next to you... scanning their armor with no waits for the info to update could come back with wierd results.  But scanning things that are on your screen and have been there and their info has been updated by the client.... you're good to go.  Thats been my experience.  If you're running around scanning things, you're gonna miss stuff because it hasn't updated to the client by the time you scan it.  If you're scanning your own armor, just close and open your paperdoll, and the info should be updated by the server.  Then you can scan it as much as you'd like.

Offline JustAnotherFace

  • Hero Member
  • *
  • Posts: 530
  • Activity:
    0%
  • Reputation Power: 8
  • JustAnotherFace has no influence.
  • Gender: Male
  • My new toy....
  • Respect: +24
  • Referrals: 4
    • View Profile
Re: event property / logic check question
« Reply #9 on: July 21, 2010, 11:29:15 AM »
0
Baldie,

The way I understand it is this: (and I may be absolutely wrong, anyone who knows any different than this please post)

Code: [Select]
if gorgon || charges notin #property
The natural way to read that statement is.....

If gorgon or charges notin #property
    DoSomething

the OR statement is described in EUO docs as follows:
Quote
%a || %b    Or     If either one of the values evaluates as true, the expression is true.


I read that to mean that basically the value on the right and the left of the || command have to be FULL values. As if they were two totally seperate lines.

In other words your code would read like this:

Code: [Select]
If gorgon
  do something
if charges notin #property
  do something

Do you see the problem now?  If gorgon is not a full statement... if gogron, what?

So the correct way to make it perform the function you want would be

Code: [Select]
if gorgon notin #property || charges notin #property
  do something

That would read on two seperate lines like this:

Code: [Select]
If gogron notin #property
  do something
If charges notin #property
  do something

Hope that helps!  Again, if anyone knows that it functions any differently please post and explain, because I may have it all wrong also. But thats the way I handle the && and || statements.


Oh yeah I realized i forgot something.  The IF at the beginning of the line is implied to follow every || &&.  Thus you dont need to type the IF all over again following a OR / AND command.

JaF

 


« Last Edit: July 21, 2010, 03:25:44 PM by JustAnotherFace »
All that tyranny needs to gain a foothold is for people of good conscience to remain silent.
Thomas Jefferson

Offline baldielocksTopic starter

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Re: event property / logic check question
« Reply #10 on: July 21, 2010, 02:28:03 PM »
0
Incorporated all suggestions. Thanks everyone. If only I could test it at work. Anyone willing to try? Just need an item with charges, and without. Put a safety pause in scipt to avoid losing charges should this not work.

Offline baldielocksTopic starter

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Re: Gorgon lens charge scanner / charger
« Reply #11 on: July 21, 2010, 07:47:39 PM »
0
one limitation i see currently is inability to select one or either or both gorget / helmet. Think this would be a good addition? Gonna add a menu anyway, so these checks would not be an issue to include.

Offline baldielocksTopic starter

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Re: Gorgon lens charge scanner / charger
« Reply #12 on: July 22, 2010, 10:56:20 AM »
0
Got it to detect reliably. BUttttttt. I can't get it to target an item in paperdoll. Any tips?

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: Gorgon lens charge scanner / charger
« Reply #13 on: July 22, 2010, 11:10:58 AM »
0
Here's a clue... Your paperdoll is a container. ;)
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Scrripty

  • Guest
Re: Gorgon lens charge scanner / charger
« Reply #14 on: July 22, 2010, 11:12:25 AM »
0
Exevent drag it to your backpack, then do your think and drop it back on your paperdoll? :)  I'm not sure.... I'd have to look too.

Tags: