Official ScriptUO EasyUO Scripts > Scripting Tutorials
Failing Hard
(1/1)
chasemac140:
So I read through these scripting tutorials.
I can't get my script to work. I even scrapped it and just copy and pasted his tutorial script for healing on F10. Got no where. Here was my initial script trying to make my guy just auto heal when lower than 90 HP.
;==============================================================
; Chase's Auto Healer
; version 1.0
; Shard OSI
; Purpose: AFK healing while being attacked by sheep
; Globals none
;==============================================================
;==========================Setup===============================
set %healpotHP ( #maxHits - 80 ) ; change this for how many points down to drink your heal pot
set %healbandagesHP ( #maxHits - 10 ) ; change this for how many points down to bandage yourself.
;=========================Main Loop============================
SUO:
repeat
onhotkey F10
gosub UseBandage
if c in #charstatus
gosub DrinkIt NUF
if #hits < %healbandagesHP && #sCnt > %timer_bandages_heal
{
gosub UseBandage
set %timer_bandages_heal ( #sCnt + 60 )
}
if #hits < %healpotHP && #sCnt > %timer_pot_heal
{
gosub DrinkIt UUF
set %timer_pot_heal ( #sCnt + 10 )
}
until #CharGhost = Yes
while #CharGhost = Yes
wait 0
GoTo SUO
;===========================Subs=================================
sub UseBandage
findItem ZJF C_ , #backpackID
if #findkind = -1
return
set #lobjectID #findID
set #ltargetKind 1
event macro 17 0
target 3
event macro 23 0
wait 5
Return
sub DrinkIt
namespace push
namespace local DIT ; short for DrinkIt
finditem %1 C_ , #backpackID
if #findkind = -1
return
set #lobjectID #findID
set #ltargetKind 1
event macro 17 0
wait 5
namespace clear
namespace pop
Return
Can someone pick this apart and show me where I've been stupid or just not paid close enough attention?
update. I know the sub is being called. Just to test I added
onhotkey F10
gosub HealME
then in the sub I added
display Hello there!
the message pops up on the screen just fine. Its like it cant use the event macros or doesnt recognize the itemtype.
Endless Night:
do you have your backpack open.
chasemac140:
yea, its open. I think. Hold on gonna go try again.
Yea no dice, it doesnt work.
;==============================================================
; Chase's Auto Healer
; version 1.0
; Shard OSI
; Purpose: AFK healing while being attacked by sheep
; Globals none
;==============================================================
;==========================Setup===============================
set %healpotHP ( #maxHits - 80 ) ; change this for how many points down to drink your heal pot
set %healbandagesHP ( #maxHits - 10 ) ; change this for how many points down to bandage yourself.
;=========================Main Loop============================
SUO:
repeat
onhotkey F10
gosub UseBandage
if c in #charstatus
gosub DrinkIt NUF
if #hits < %healbandagesHP && #sCnt > %timer_bandages_heal
{
gosub UseBandage
set %timer_bandages_heal ( #sCnt + 60 )
}
if #hits < %healpotHP && #sCnt > %timer_pot_heal
{
gosub DrinkIt UUF
set %timer_pot_heal ( #sCnt + 10 )
}
until #CharGhost = Yes
while #CharGhost = Yes
wait 0
GoTo SUO
;===========================Subs=================================
sub UseBandage
findItem ZJF C_ , #backpackID
if #findkind = -1
return
set #lobjectID #findID
set #ltargetKind 1
event macro 17 0
target 3
event macro 23 0
wait 5
Return
sub DrinkIt
namespace push
namespace local DIT ; short for DrinkIt
finditem %1 C_ , #backpackID
if #findkind = -1
return
set #lobjectID #findID
set #ltargetKind 1
event macro 17 0
wait 5
namespace clear
namespace pop
Return
Trigs:
Nothing stands out at a quick glance
It's usually really helpful to step through the code to see what's not working. With the code stopped, you can hit F7 or F8 to step through the code line by line, one of them will "step in" to subs and follow the code, the other will just call the sub.
So while your char is damaged, and you have the EUO window up / focused you could hit F8 F8 F8 and walk through the code line by line, you should be able to logic mistakes or calls that are not working as intended.
I'll try to remember to test it out at home tonight
chasemac140:
I appreciate it, Ill do this tomorrow.
Navigation
[0] Message Index
Go to full version