Author Topic: Gorgon lens charge scanner / charger  (Read 14880 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
Re: Gorgon lens charge scanner / charger
« Reply #30 on: July 23, 2010, 08:33:00 AM »
0
ONe najor drawback here is that I cannot leap into UO / EUO to experiment. Still a ways from being able to forecast results from memory. But I am working on it still!

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 #31 on: July 23, 2010, 08:38:00 AM »
0
Here... when you target something make sure to set it's type.

Code: [Select]
  findItem %whatever C , #charID ; finds whatever type in your paperdoll
  if #findCnt > 0 ; if it's not there then skip this part
  {
    set #ltargetID #findID ; now your setup with #ltarget for doing stuff
    set %target #ltargetID ; not *needed* but I like it
    set #ltargetKind 1 ; HERE YOU GO... make sure that's set correctly@!
    do stuff
    wait a bit
    do more stuff
    etc......
  }
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 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 #32 on: July 23, 2010, 09:10:10 AM »
0
Thanks C for that. Now, for more explanation, cause THAT's apparently my weak spot ( in this discussion, got plenty more to explore!)
LTargetKind Values
Setting   Object Class
1    Object
2    Ground,Mountains,Caves
3    Resource: Tree,Water

Note:    Not setting #LTargetKind (usually to 1) is by far one of the most common mistakes made when scripting. Simply put, every time that you use Event Macro 22 you must always make sure #LTargetKind is set properly or you will most likely have sporadic targeting problems.

So that's why everyone does that? GOtcha. Now, do peeps / monsters count as objects for this as well?



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 #33 on: July 23, 2010, 09:16:42 AM »
0
So that's why everyone does that? GOtcha. Now, do peeps / monsters count as objects for this as well?


They sure aint Ground, Mountains or Caves! Heh... or resources, tree's or water for that matter....
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 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: Gorgon lens charge scanner / charger
« Reply #34 on: July 23, 2010, 12:27:33 PM »
0
Here... when you target something make sure to set it's type.

Code: [Select]
  findItem %whatever C , #charID ; finds whatever type in your paperdoll
 

That line in Cerv's code example is what I, and Cerv were trying to get you to understand.  Your finditem statement needs to define where to look for the item.  In this case it is looking for the items in a container... yes your paperdoll is a container.  So you would set it exactly like Cerv pointed out:
Code: [Select]
Finditem %item C_ , #charidThis tells the script to search for what ever your %item has been defined to, Inside a C_ (Container) , and the container happens to be #charid... your paperdoll.

Finditems are defined here for your reading http://wiki.easyuo.com/index.php/FindItem

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

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: Gorgon lens charge scanner / charger
« Reply #35 on: July 23, 2010, 12:43:27 PM »
0
I am having a problem, but not in the way you imply JAF. Thanks for stepping in to try to pull my head out of the sand though! Might need more than three it seems at this rate.

Since this is a combat situation, removing items from PD is dangerous (you only need to recharge gorgon lens because you are currently fighting medusa). I need another way around that, as I cant see myself releasing a script that could get you killed. I currently use 3-4 charges per medusa, and suspect that others do as well. This and a companion script will greatly reduce the danger of statues.

As to handling containers, I think I finally got a decent handle on that:
find and set %stuff in pack
find and set %boxonground G_ ,
findcnt || findkind to verify in G_ radius.
If true,
then drag %stuff
dropc %stuff in pack to %boxonground.

Since the items I want to charge are in a container, and I get that, the only way to directly target something in it SHOULD be target last (like when we used to steal from paperdolls), or a click with target cursor = 1 at contposX Y or finditem X Y. Thats where I am having issues.

@Twinkle McNugget. Thanks for the reminder. I guess I should be using the target command then? default is 2 seconds, unless an argument (is that the right term?) is added (3-5 being the most common)? target 5s (5s is argument, correct?)

There's also event macro 25 0, wait for target, that could be used as well. Not sure if you would have to use event macro 28 0 (wait) in conjunction though. I never coud get that to work right in the client.


Hmm, not quite... read my post above, then take a look at this code from a pot chugger script I wrote.


Code: [Select]
sub disarm
{
  finditem %lhandtypes C_ , #charid
  if #findkind <> -1
  {
    set %lhanded #findid
    set #lHandID %lhanded
    wait 2
    event macro 24 1
  }
  finditem %rhandtypes C_ , #charid
  if #findkind <> -1
  {
    set %rhanded #findid
    set #rHandID %rhanded
    event macro 24 2
  }
  wait 20
}
return
display ok disarm exited without return

This code finds the items I defined earlier in the script called %lhandtypes.  It finds them in the C_ (container) , #charid (paperdoll)
it sets a %lhanded to the #findid
then it sets the #lhandid to the %lhanded (which is the #findid)
it waits 2
then it uses the event macro for disarm.

goes to the next line and searches for %rhandtypes ....... etc etc etc.

also, a tip I learned a long time ago, is when trying to debug your code to see if your subs are exiting correctly with the return, put in the display line after the return.  If for some reason the script jumps over the return line, you get a display popup telling you that your sub (helpful to define what sub) exited without a return

Hope this is starting to make more sense...

Listen closely to Cerv and his hints... he is more often correct than mistaken :)

JaF
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: Gorgon lens charge scanner / charger
« Reply #36 on: July 23, 2010, 01:05:03 PM »
0
it does, it really does. If only I could experiment, would really understand. Am a kinesthetic learner by nature. Thanks JAF and Cerv!
Will have more questions once we can use EUO again.

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 #37 on: August 04, 2010, 07:40:05 AM »
0
 >:(
Still having targetting issues. As review, I want to target either a neck or helmet slot that had gorgon charges, and recharge it when it reaches 0. My issue is getting the lens targetted on the item in the paperdoll.

Code: [Select]
gosub TM_AdvJournalSync LENS 100

set %lens VTO
finditem * C_ , #charid
For #findindex 1 #findcnt ;just for Twinkle McNugget. Ignore anything not currently holding a charge.
  ;Obviously, you would want everything fully charged before fighting medusa.
{
  if #findkind = -1
    break
  event property #findid
  if Gorgon_Lens_Charges notin #property
    ignoreitem #findid 1
}

gorgonlens:
gosub TM_AdvJournalScan LENS VALIDADVANCE crumble_you_are_no_longer_protected
If #result = #true
{
  finditem %lens C_ , #backpackid
  if #findcnt = 0
  {
    display out of lenses, halting
    halt
  }
}
set #lobjectid #findid
finditem * C_ , #charid ;onnly gorget and lens should be left in paperdoll
For #findindex 1 #findcnt
{
if #findkind = -1
break
  event property #findid
  if Gorgon_Lens_Charges notin #property
  {
    set #ltargetid #findid
    set #ltargetkind 1
    event macro 17 0
    target 3s
    event macro 22 0
    ignoreitem #findid 2
  }
  ignoreitem reset 2
  wait 10
  if #contsize = 291_99 && #conttype = generic_gump
  {
    menu text euoedit3 problem detected, please report to baldielocks on scriptuo.com
    halt
  }
}
goto Gorgonlens
halt

Scrripty

  • Guest
Re: Gorgon lens charge scanner / charger
« Reply #38 on: August 04, 2010, 08:38:51 AM »
0
Im on my cell in the docs office but browsing your code it looks like your wait 10 there should be a wait 20 and be moved inside the if statement with the actual targetting... you dont want to wait when executing a script unless necessary.. I even find ways to utilize the time in a wait to execute code sometimes.  Theres no reason to perform a wait right after targetting unless you are performing another action that requires a wait.  Sometimes Ill just set a timer for the wait timer and check that timer when another action néds to be performed, that way you are really using your time better and spéding up ur script.

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 #39 on: August 04, 2010, 09:50:10 AM »
0
wow, that is AWEEESOMMEEE :o *scampers off to sliem quester to change timers*

As to the wait 20 vice a wait 10, why would that be? I have seen that in some scripts you also use a wait 5 after find item. should I incorporate that too?

Scrripty

  • Guest
Re: Gorgon lens charge scanner / charger
« Reply #40 on: August 04, 2010, 11:27:53 AM »
0
wow, that is AWEEESOMMEEE :o *scampers off to sliem quester to change timers*

As to the wait 20 vice a wait 10, why would that be? I have seen that in some scripts you also use a wait 5 after find item. should I incorporate that too?

If I ever used a wait 5 after a finditem, it was an accident.  No reason to do that.

Scrripty

  • Guest
Re: Gorgon lens charge scanner / charger
« Reply #41 on: August 04, 2010, 12:10:09 PM »
0
Here's what I do for things like yours now.  At the top of your script you'd need to "initialize" or set the variable %timer to #systime.  Or "set %timer #systime".  That way your first run of the script has a variable to compare the while statement below to.  Also, findkind is outdated.  You should really be using #findcnt.  #findcnt is reliable because if you find the item, it's > 0.  If not, It's 0.  Easy.  Anyways, doing the timer like this allows the script to continue to execute, but waits the appropriate time before allowing the action to happen again.  Does that make sense?  So instead of forcing a wait AFTER an action, you can do all manner of others things, and before the action can happen again, it checks to see if the wait is up or not FOR another action to be able to take place.  Allows you to do all sorts of things in between waits.  Like calculate stuff.  Or check for overweight... or whatever really.  Anything you can think of.  I hate wasting time, and also like to optimize things to their fullest.  I'm gonna go through the PVM Dexer eventually and do this with ALL waits, so the script will be more responsive than a script of that size should be.

Code: [Select]
For #findindex 1 #findcnt
{
  if #findcnt < 1
  break
  event property #findid
  if Gorgon_Lens_Charges notin #property
  {
    while %timer > #systime
      wait 1
    set #ltargetid #findid
    set #ltargetkind 1
    event macro 17 0
    target 3s
    event macro 22 0
    set %timer #systime + 1000
    ignoreitem #findid 2
  }
  ignoreitem reset 2
  if #contsize = 291_99 && #conttype = generic_gump
  {
    menu text euoedit3 problem detected, please report to baldielocks on scriptuo.com
    halt
  }
}

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 #42 on: August 04, 2010, 08:53:01 PM »
0
Thanks Twinkle McNugget! really appreciate it. Gonna work it in and see if that helps the targetting issue. Been considering a single click on findx , findy as a work around.

Tags: