ScriptUO
Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: The Ghost on November 06, 2011, 08:23:35 PM
-
I have been working on a script to help me collect egg for Medusa. for some reason, my " event SysMessage Target your Hold " work find and other time it just get stuck in a loop. I wrote this to remove s few clicking. The only think I required to target is the Nest hold. Can you guy have a look at this Plx and provide any feedback.
set %nest PBN
set %flute RGP ; Charmer Flute
set %snakes QE_JD_FB
; *********************************
start:
event SysMessage Target your Hold
set #targcurs 1
while #targcurs = 1
wait
set %nest #ltargetid
if #findkind = -1
goto start
; **************************************
flute:
finditem RGP C_ , #Backpackid
set #lobjectID #findID
set #ltargetkind 1
wait 5
event macro 17
wait 5
; ***********************************
repeat
finditem %snakes G_8
if #findkind = -1
until #charghost = yes
{
wait 1s
set %snake #findid
wait 1s
set #ltargetid #findid
set #ltargetkind 1
event macro 22
}
ignoreitem %snakes
;halt
; *************************************
; repeat
; finditem %nest G_4
; if #findkind <> -1
; until #charghost = yes
{
wait 1s
set %nest #findid
set #ltargetid #findid
set #ltargetkind 2
event macro 22
wait 10
}
{
scanjournal %i
if You_don't_seem_to_be_able_to_persuade_that_to_move. in #journal || Someone_else_is_already_taming_this. in #journal || The_animal_walks_where_it_was_instructed_to.
{
goto flute
}
}
goto start
-
; *********************************
start:
event SysMessage Target your Hold
set #targcurs 1
while #targcurs = 1
wait
set %nest #ltargetid
if #findkind = -1
goto start
; **************************************
; *********************************
start:
event SysMessage Target your Hold
set #targcurs 1
Target 5s
while #targcurs = 1
wait
set %nest #ltargetid
FindItem #lTargetID G_2 ; Look for the clicked Nest on the ground 2 Tiles around the Paperdoll
if #FinCnt = 0 ; #findkind = -1 <- To use any result, like FindKind or FindCnt, you have to FindItem something before, otherwise you end up working with "old" results from any FindItem action you have done before !?
goto start
; **************************************
-
Just a quickie? Why would you want to target the nest, as the 10% of nests hidden in the mountains(are out of sight)? So you collect the eggs bit slower.. Anyway, lets look at what you got.
set %nest PBN
set %flute RGP ; Charmer Flute
set %snakes QE_JD_FB
; *********************************
start:
event SysMessage Target your Hold
set #targcurs 1
while #targcurs = 1
wait
set %nest #ltargetid
if #findkind = -1 ;< -------- as rana70 said, there is no finditem before this code, so it's useless
goto start
; **************************************
flute:
finditem RGP C_ , #Backpackid
; we are missing if statement check
; if #findcnt > 0
; {
set #lobjectID #findID
set #ltargetkind 1
wait 5
event macro 17
wait 5
; }
; ***********************************
repeat
finditem %snakes G_8
if #findkind = -1 ; if #findkind = - 1 <----we are doing what? There are no statement lines, it would just stuck in a repeat until #chargost = no looop..
until #charghost = yes
{
wait 1s
set %snake #findid
wait 1s
set #ltargetid #findid
set #ltargetkind 1
event macro 22
}
ignoreitem %snakes ; <---- do you really want to ignore %snakes(types of snakes), not %snake(current found snake)?
;halt
; *************************************
; repeat
; finditem %nest G_4
; if #findkind <> -1
; until #charghost = yes
{ ; <---- as we dont have a staement here, we are just wasting our lines with the brackets.
wait 1s
set %nest #findid
set #ltargetid #findid
set #ltargetkind 2
event macro 22
wait 10
} ; <---- the same here.
{
scanjournal %i ; <---- you dont even have a i% setup anywhere..
if You_don't_seem_to_be_able_to_persuade_that_to_move. in #journal || Someone_else_is_already_taming_this. in #journal || The_animal_walks_where_it_was_instructed_to.
{
goto flute
}
}
goto start
Please take a look at these topics.
http://wiki.easyuo.com/index.php?title=Sub
http://wiki.easyuo.com/index.php?title=Repeat..until
http://wiki.easyuo.com/index.php?title=JIndex
http://www.scriptuo.com/index.php?topic=8759.0
http://www.scriptuo.com/index.php?topic=978.0
-
why use the snake charm, just click on the nest and put your hand isnt faster?
-
Don't seen to be faster , last time I try have on egg in 1 Hrs and friend got 6 with the flute,
I when back to basic and thx camotbik for pointing the mistake and taking ur time to explain them, made me understand a bit more. I will expand from this build and see what I can do, Still have to traget manually but it 80% better then I was.
;
set %nest PBN
set %flute RGP ; Charmer Flute facing east
set %snakes QE_JD_FB
; *********************************
start:
gosub charming
goto start
; **************************************
sub charming
wait 10
Finditem %flute C_ , #BACKPACKID
Set #lobjectid #findid
event macro 17
; ***********************************
;set %snake #findid
finditem %snakes G_10
set #ltargetid #findid
set #ltargetkind 1
set %snake #findid
target
event macro 22
wait 8s
ignoreitem %snake
return
Been using this version for the last 2hrs andwork it fine. Need to tweak the ignoreitem a bit that about it.
;
set %nest PBN
set %flute RGP ; Charmer Flute
set %snakes QE_JD_FB
; *********************************
start:
gosub charming
goto start
; **************************************
sub charming
for %1 %journalindex #jindex
{
scanjournal %i
if The_charm_seems_to_wear_off. in #Journal
{
gosub ignore
}
}
wait 10
Finditem %flute C_ , #BACKPACKID
Set #lobjectid #findid
event macro 17
; ***********************************
finditem %snakes G_10
set #ltargetid #findid
set #ltargetkind 1
set %snake #findid
target
event macro 22
wait 8s
ignoreitem %snake
return
sub ignore
deletejournal
ignoreitem reset
return
-
You are still not using brackets on finditems, that can mess up your whole script!! I have wrote a tutorial, take a look here - http://www.scriptuo.com/index.php?topic=8759.0