ScriptUO
Official ScriptUO EasyUO Scripts => Submit your Script => Inactive Submissions => Topic started by: bajathief on April 02, 2009, 09:58:48 AM
-
I am posting my Vesper Bank Remove Trap Trainer. I have not been able to find what I needed top work Remove Trap so this is what I came up with. I added heal and cure to this at work so it is not tested as of yet. I had it working before the healing added. I was using another healing but wanted to try to combine it. If it dosent work I will remove it. This scrip works in vesper bank with the 3 level2 chests in the south east room. It has distances set as not to go to the one that spawns in the northern room. You just stand in the center of the room and start the chest. It is simple remove trap only no detect or pick.
I will accept all comments but I am learning how to script so it may take me some time to figure it all out. I have another version that does not pathfind back to the start position for the North East room with 8 or 9 level1 chests but they only take you to around 60 or so skill.
Updated
I just found out after I switched shards it would not target the chests. If you manually do one first it works again as normal
; Script Name: Bajathief's Remove Trap Trainer in Vesper Bank
; Author: Bajathief
; Version: 1.0
; Client Tested with: EA 6.0.13.0
; EUO version tested with: 1.5 Version 148
; Shard OSI/FS: OSI
; Revision Date:
; Public Release: 4/1/09
; Purpose: Train Remove Trap
; Credits: TrailMyx for TrailMyx's Advanced Journal Scanner
; : Paladin for Ideas from Paladin's YewCrypt RemoveTrap Trainer
;
; Revisions
;
;+++++++++++++++++++++++++++++++++++Directions+++++++++++++++++++++++++++++++++++
;To set this up you need:
;-Go to Vesper Bank
;-Stand in Center of the South East room with 3 level #2 Chests
; (It will work other places if you change distances.)
;-Hit Play and Enjoy the Gains!
; NOTE: This is a remove trap only.
;
;+++++++++++++++++++++++++++++++++++
;++++++++++Start of Script++++++++++
;+++++++++++++++++++++++++++++++++++
set %ChestTypes AHP_BUD_DHP_GHP_HIF_IIF_IKF_JHP_JIF_KHP_KIF_KKF_LHP_MHP_TMF_UMF_VMF_WMF_
+XGP_YGP_ZGP_ZTD_BKF_ABG_JKF_QMJ_YBK_XBK
gosub Menu
set %returnposx #charposx
set %returnposy #charposy
gosub TM_AdvJournalSync result 100
Loop:
gosub Search
wait 5
gosub Move
wait 5
gosub Remove
wait 5
gosub Heal
wait 5
gosub Start
wait 5
menu delete _Status
menu text _Status 5 5 Waiting 5 seconds Before New Search.
wait 5s
goto Loop
; ++++++++++++++++++++++
; ++++++ Menu Sub ++++++
; ++++++++++++++++++++++
sub Menu
menu clear
menu window title Remove Trap Trainer in Vesper Bank
menu window size 350 20
menu window color White
menu Font Name Comic Sans MS
menu Font Size 10
menu font bgcolor white
menu font color blue
menu show
return
; ++++++++++++++++++++++
; +++++ Search Sub +++++
; ++++++++++++++++++++++
sub Search
_Searchloop:
menu delete _Status
menu text _Status 5 5 Looking for New Trapped Chest
wait 4
Finditem %ChestTypes
if #findkind = -1
{
wait 5
menu delete _Status
menu text _Status 5 5 All Chests Cleared.
wait 1s
goto _Searchloop
}
if #findkind <> -1
{
menu delete _Status
menu text _Status 5 5 New Trapped Chest Found!
set %ChestId #findid
set %ChestPosX #findx
set %ChestPosY #findy
wait 5
return
}
; ++++++++++++++++++++++
; ++++++ Move Sub ++++++
; ++++++++++++++++++++++
sub Move
if #finddist > 4
{
ignoreitem %ChestID
; goto Loop
return
}
if #finddist <= 2
{
wait 5
return
}
_Move:
menu delete _Status
menu text _Status 5 5 Pathfinding to New Chest.
wait 5
event pathfind %ChestPosX %ChestPosY
wait 40
finditem %ChestId
if #findkind = -1
return
wait 5
if #finddist > 2
{
goto _Move
wait 5
}
return
; ++++++++++++++++++++++
; +++++ Remove Sub +++++
; ++++++++++++++++++++++
sub Remove
set %Attempts 0
_Retry:
menu delete _Status
menu text _Status 5 5 Removing Trap on Chest.
if %RemoveAttempts = 10
return
finditem %ChestId
if #findkind = -1
return
wait 5
set #ltargetid %ChestID
event macro 13 48
while #TargCurs = 0
wait 1
event macro 22 0
wait 20
gosub TM_AdvJournalScan result VALID_ADVANCE purple gas flesh dart doesn't touch face
if #RESULT = #TRUE
{
gosub AdvJournalSync result
ignoreitem %ChestID
return
}
menu delete _Status
menu text _Status 5 5 Wait 9 seconds to Retry.
wait 9s
set %Attempts %Attempts + 1
goto _Retry
; ++++++++++++++++++++++++
; +++++++ Heal Sub +++++++
; ++++++++++++++++++++++++
sub Heal
menu delete _Status
menu text _Status 5 5 Checking Damage and Poison
_HealLoop:
if c in #charstatus
{
event macro 15 24
while #targcurs = 0
wait 1
event macro 23 0
wait 1s
goto _HealLoop
}
if #hits < #maxhits
{
event macro 15 28
while #targcurs = 0
wait 1
event macro 23 0
wait 1s
goto _HealLoop
}
return
; +++++++++++++++++++++++
; ++++++ Start Sub ++++++
; +++++++++++++++++++++++
sub Start
menu delete _Status
menu text _Status 5 5 Moving to Start
event pathfind %returnposx %returnposy
wait 60
return
;+++++++++++++++++++++++++++++++++++++++++++++
;+++++TrailMyx's Advanced Journal Scanner+++++
;+++++++++++++++++++++++++++++++++++++++++++++
;=================================================================
;------------------------ Call interface -----------------------
;=================================================================
set !TM_FunctionCalled #FALSE
if %0 = 1
gosub %1
if %0 = 2
gosub %1 %2
if %0 = 3
gosub %1 %2 %3
if %0 = 4
gosub %1 %2 %3 %4
if %0 = 5
gosub %1 %2 %3 %4 %5
if %0 = 6
gosub %1 %2 %3 %4 %5 %6
if %0 = 7
gosub %1 %2 %3 %4 %5 %6 %7
if %0 = 8
gosub %1 %2 %3 %4 %5 %6 %7 %8
if %0 = 9
gosub %1 %2 %3 %4 %5 %6 %7 %8 %9
if %0 = 10
gosub %1 %2 %3 %4 %5 %6 %7 %8 %9 %10
if %0 = 11
gosub %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11
if %0 > 11
{
display ok Too many arguments for "call", edit file.
stop
}
if !TM_FunctionCalled = #TRUE
exit
if %0 = N/A
display ok You may not run this script directly.
else
display ok Function " , %1 , " not found.
stop
;-------------------------------------------------------------------------------
sub TM_AdvJournalSync
namespace push
namespace local TM_AdvJS_ , %1
set !_jindex #jindex + 1
if %0 > 1
set !lpc_set %2
namespace pop
set !TM_FunctionCalled #TRUE
return
;-------------------------------------------------------------------------------
sub TM_AdvJournalScan
namespace push
namespace local TM_AdvJS_ , %1
set !args %2
set !temp_lpc #LPC
if !lpc_set = N/A
set #LPC 1000
else
set #LPC !lpc_set
set !num_args %0
set !first_arg 3
if !_jindex = N/A
set !_jindex #jindex
if !charname = N/A
{
set !charname #CHARNAME
AdvJournalScan_loop1:
str pos !charname #SPC
if #STRRES <> 0
{
set !val #STRRES - 1
str left !charname !val
set !left #STRRES
set !val !val + 1
str del !charname 1 !val
set !charname !left , _ , #STRRES
goto AdvJournalScan_loop1
}
}
set !index !first_arg
repeat
set !temp_jindex !_jindex
set !text % . !index
while !temp_jindex <= #jindex
{
scanjournal !temp_jindex
str pos #JOURNAL !charname 1
set !namepos #STRRES
str count #JOURNAL !charname
set !namecnt #STRRES
str pos #JOURNAL :_ 1
set !smcpos #STRRES
str pos #JOURNAL !text 1
set !textpos #STRRES
if !textpos < !smcpos && !smcpos <> 0 || !smcpos = 1 || :_ notin #JOURNAL || VALID notin !args
set !pass #TRUE
else
set !pass #FALSE
if ( !text in #journal && ( ( !namepos = 1 && !namecnt <= 1 ) || !pass ) )
{
set !temp_jindex !temp_jindex + 1
if ADVANCE in !args
set !_jindex !temp_jindex
set #LPC !temp_lpc
namespace pop
set !TM_FunctionCalled #TRUE
return #TRUE
}
set !temp_jindex !temp_jindex + 1
}
set !index !index + 1
until !index - !first_arg > !num_args - !first_arg
set #LPC !temp_lpc
namespace pop
set !TM_FunctionCalled #TRUE
return #FALSE
-
One quick observation....
When you use the journal scanner subs, you need to provide a way for the TM_AdvJournalScan to advance its pointer over text that's already been scanned. There are 2 separate ways to do this:
1) use TM_AdvJournalSync. Typically I do this:
gosub TM_AdvJournalScan result VALID purple gas flesh dart doesn't touch face
if #RESULT = #TRUE
{
gosub AdvJournalSync result
ignoreitem %ChestID
return
}
Also, if you know you are never going to search again for that particular instance, you can just have the TM_AdvJournalScan subroutine do it for you by adding this to the arguments of the 2nd argument:
gosub TM_AdvJournalScan result VALID_ADVANCE purple gas flesh dart doesn't touch face
if #RESULT = #TRUE
{
ignoreitem %ChestID
return
}
Quick thing to point out about why this is bad. If you don't re-sync the pointer to a current state, once you find a match and you don't re-sync, you will always match because you aren't acknowledging that you've already taken action on that particular journal entry.
-
My quick observation:
*** Pass 2 - Execution [SYNTAXCHECK]
** Error - Line 29: Unknown command AHP_BUD_DHP_GHP_HIF_IIF_IKF_JHP_JIF_KHP_KIF_KKF_LHP_MHP_TMF_UMF_VMF_WMF_XGP_YGP_ZGP_ZTD_BKF_ABG_JKF_QMJ_YB
** Error - Line 30: Unknown command K_XBK
Looks like you used notepad or something to edit. You know about splitting long lines? Using + ?
set %ChestTypes
AHP_BUD_DHP_GHP_HIF_IIF_IKF_JHP_JIF_KHP_KIF_KKF_LHP_MHP_TMF_UMF_VMF_WMF_XGP_YGP_ZGP_ZTD_BKF_ABG_JKF_QMJ_YB
K_XBK
just need to get that all merged on one line, or split it with +
-
If you haven't tried the syntax checker built into ScriptUO yet,you might give it a try. Help find issues like that.
-
I may of messed some of it up at work without UO or easyuo. I will check it again when I get home.
Post Merge: April 02, 2009, 01:52:18 PM
added the 2 changes. It must of been when I cut and paste it from notepad, the script was fine in easyuo but not my post. I just ran it and it works and cured but it hasent set off a dart or explosion to heal yet
I ran it last night for about 5 hours with no problems and got my skill up to 70.4 This has to be one of the hardest skills I ever tried to work. It does seem to trigger pathfinding and do nothing but I think it is what happens when it sees the chests that are out of range and ignores them but shows pathfind back to the spot you are already at. Other than that it does what I want it to do with no actions on my part. It goes faster than the chests spawn and has to wait but that is to be expected.
-
Nice work here! I had been tryin another one on my own that kept looping out the memory and getting stuck...this seems to work great after just 30 minutes of trying.
-
when setting a #ltargetid you also have to set the #ltargetkind. in the case of objects like monsters weapons and things like the chests you are untraping... you need to set it to type 1.
set #ltargetkind 1 when u set the target and before you do event macro 22 will solve the issue of sometimes having to target the chest to get it working again. when you manually target the chest you basically set targetkind.
Hope it helps some
-
Script moved to inactive scripts. (If you disagree with the move please pm me.)
Thank you for the script submission and we look forward to your return and this scripts finalization.