Author Topic: auto gheal pot  (Read 4167 times)

0 Members and 1 Guest are viewing this topic.

Offline txixuxTopic starter

  • Newbie
  • *
  • Posts: 4
  • Activity:
    0%
  • Reputation Power: 0
  • txixux has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
auto gheal pot
« on: October 21, 2008, 07:31:28 AM »
0
I'M trying to make my "own" (i read a lot of macros that make the same and take the best for me of each)  autoheal script, but I'm not good at all scripting, my question is why this script doesn't work?

  event macro 24 1
  finditem UUF C_ , #backpackid
  set #lobjectid #findid
  event macro 17
  wait 20
  event macro 37

I'M trying to make my macro disarm drink and arm, but it just disarm and arm  :-[

thank you

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: auto gheal pot
« Reply #1 on: October 21, 2008, 08:17:24 AM »
0
One thing that you will run into when disarm/rearm is that it's pretty slow using EasyUO.  So you need to put in safeguards to be sure you are doing it slow enough to not cause "you must waits".  Best thing for this is to put in checks to be sure you have completely disarmed, and the rearmed before allowing the code to continue.

Some recommendations I would make:

1) So when you disarm, put a loop that will wait until your armed weapon appears in your backpack
2) Put a check to see if you have any pots left; don't assume you have some
3) When you re-arm, put a loop in to be sure the weapon appears in your paperdoll.
4) After both disarm/rearm sequences, put an additional "'''wait" in and play with this value until you find something that works 100%.

So your psudocode would be:

0) check for pots, if none are available, no need to disarm; fail and warn of no pots
1) disarm
2) wait until disarm
2a) wait a bit more
3) check for pots
4) drink a pot since you know they are available
5) wait 20
6) rearm
7) wait for rearm
8 ) wait a bit more.

If you do this, then you should have a pretty lag-independent way of chugging.


I deliberately didn't code this for you.  If you still need help, I can post some code snippets.  I know some people like to try and figure it out for themselves.  So if you need some more info, just say so.  ;)
« Last Edit: October 21, 2008, 08:19:23 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

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: auto gheal pot
« Reply #2 on: October 21, 2008, 08:55:57 AM »
0
I'M trying to make my "own" (i read a lot of macros that make the same and take the best for me of each)  autoheal script, but I'm not good at all scripting, my question is why this script doesn't work?

  event macro 24 1
  finditem UUF C_ , #backpackid
  set #lobjectid #findid
  event macro 17
  wait 20
  event macro 37

I'M trying to make my macro disarm drink and arm, but it just disarm and arm  :-[

thank you
TM's got it right. The problem is with lag and connection. If you just put in set delays, then it might work 80% of the time. But to make it work 100% you need to have checks.

Check to make sure weapon appears in pack, THEN drink.

If you just want a simple drinker then you can use delays. Remember it's not going to work 100%.

Code: [Select]
event macro 24 1
wait 10 ; adjust this if needed
findItem UUF C_ , #backpackID
if #findKind = -1
  return
set #lobjectID #findID
set #ltargetKind 1
event macro 17 0
wait 5 ; adjust this if needed
event macro 37

May I ask what you are holding that you need to disarm one hand? Whats in your off hand you don't want to disarm?
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 txixuxTopic starter

  • Newbie
  • *
  • Posts: 4
  • Activity:
    0%
  • Reputation Power: 0
  • txixux has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: auto gheal pot
« Reply #3 on: October 21, 2008, 09:37:02 AM »
0
thank you, I am gonna start working on it.



I just hold a xbow in my hand, i dont care if i disarm both hands, just that I just know how to do it with event macro 24 1  ::)

Offline txixuxTopic starter

  • Newbie
  • *
  • Posts: 4
  • Activity:
    0%
  • Reputation Power: 0
  • txixux has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: auto gheal pot
« Reply #4 on: November 14, 2008, 03:58:44 AM »
0

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: auto gheal pot
« Reply #5 on: November 14, 2008, 04:20:23 AM »
0
First thing:
Code: [Select]
if C #charstatus
Needs to be:
Code: [Select]
if C in #charstatusor
Code: [Select]
if #charstatus = c
That will fix the cure pots.

Code: [Select]
sub refresh
  finditem ZUF C_ , #backpackid
  if #findkind <> -1 && #time > %time4

Timer? for refresh pots? That's why it's not drinking them all the time.

A MUCH better way of doing a pot drinker is to make it ONE sub routine. Then just check for conditions in the main loop and send the information to the sub routine. Here's an example:

Code: [Select]
set %pot_hits XX ; the HP's to drink a heal potion
set %pot_stamina XX ; the stamina to drink a total refresh
set %timer_pot_heal #sCnt ; sets the heal potion timer

TM:
repeat
if C in #charStatus
  gosub DrinkIt NUF

if #stamina < %pot_stamina
  gosub DrinkIt ZUF

if #hits < %pot_hits && #sCnt > %timer_pot_heal
  {
    gosub DrinkIt UUF
    set %timer_pot_heal ( #sCnt + 10 )
  }

until #CharGhost = YES
while #CharGhost = YES
  wait 0
GoTo TM

sub DrinkIt
  wait 5
  findItem %1 C_ , #backpackID
  if #findKind = -1
    return
  set #lobjectID #findID
  set #ltargetKind 1
  event macro 17 0
  wait 5
return

You'll have to add in your arm/disarm routines to that, but you can see the basics of it. The gosub line can include information to sent to the sub routine (%1, %2, %3 etc...) so we just send the potion TYPE to the sub. If the potion isn't found (as checked in the sub) then it returns to the mainloop to check the other conditions.

I think you'll find this is much easier to work with then your first attempt. You did a good job of keeping the script flowing, but you used the same coding over and over. This way you can reuse the drinking portion.
« Last Edit: November 14, 2008, 04:27:36 AM by Cerveza »
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.

Tags: