;===================================================================
;===================================================================
; Script Name: Crisis Carpentry Trainer
; Author: Crisis
; Version: 1.0
; Client Tested with: 7.0.34.6
; EUO version tested with: 1.5 (version 247)
; Shard OSI / FS: FS (runuo Version 2.2, Build 4925.27724)
; Release Date: 01/03/2013
; Revision Date: N/A
; Purpose:
; .Train Carpentry 0-100
;
; Revisions:
; . N/A
;
; Requirements:
; . Make sure that you do not have colored ingots in your secure, keep only iron ingots in your secure.
; . You need to have a secure resouce bag and an axe.
; . You must have at least one tinker tool in your backpack.
; . You must have enough tinkering to craft tinker tools and fletcher tools
; . If you are using the bank, you must be at the bank and say "bank" before starting the script. I will adjust the script to include this in a future update.
;
; Future Updates:
; . Suggest some :)
;
; Special Thanks:
; . Ximan for helping me work out some of the bugs.
;
; Copyright: 2014 Crisis
;===================================================================
;===================================================================
gosub offsetclick 27 110 ; Wooden Items 27 130 ; tools
and
gosub offsetclick 235 90 ; Jointing Plane 235 210 ; saw
sub MakeCarpTools
menu delete scriptstatus
Menu Font BGColor Black
menu Font Color Lime
menu text scriptstatus 95 100 Getting New Carpenter's Tool
finditem %boards C_ , #BackpackID
if #findstack >= 50
goto _makecarptool
set %_diff 50 - #findstack
finditem %boards C_ , %ResourceSecure
if #findstack < 50
{
display You have used up most of your ingots. Halting...
set *request END
return
}
gosub moveit #backpackid %ResourceSecure #findid %_diff
_makecarptool:
finditem %tinkertool C_ , #Backpackid
if #findcnt = 0
{
display You are out of tinker tools. Get a tinker tool and restart script.
set *request END
halt
}
set #lobjectID #Findid
gosub actionblock
event macro 17 0
gosub tinkwait
gosub offsetclick 27 110 ; Wooden Items 27 130 ; tools
wait 5
gosub tinkwait
gosub offsetclick 235 90 ; Jointing Plane 235 210 ; saw
wait %postcraftwait
makelast:
gosub tinkwait
gosub offsetclick 280 450 ; make last
wait %postcraftwait
finditem %carptool C_ , #Backpackid
if #findcnt < 8
goto makelast
gosub tinkwait
gosub offsetclick 30 450 ; exit
wait 10
return
Funny timing, I decided this morning to train up carpentry so I can make some suits. I was going to write my own but decided I'd go ahead and test for ya.
Just a couple things I've run into so far-
1) The first thing I did was to get rid of all the opening of my journal, pack, skills, etc in the Setup sub. Not sure why you go through all of that but I always find it annoying when a script moves all my stuff around and I couldn't figure out a reason for it :) That could just be a XIIx-ism though.
2) It pulled Shadow Iron ingots out of my secure instead of regular ingots. I paused and moved some Iron into my pack so I could keep testing, it was able to keep going but it did pull more shadow ingots out since it had already set the %ingots to my stack of Shadow. You should either add some color checking when setting the %ingots var or just make it clear in your instructions that only Iron ingots should be in your secure.
3) After this it made a box, axed it, then made 9 Moulding Planes before I hit stop.
Keep it coming!!
X
gosub moveit #backpackid %ResourceSecure %boards 200
event macro 8 7 ; open pack to remove ghosting
gosub hardwait %postregmovewait
Ver 1.1 is up and running.
Not that is your fault, I'm having this issue from time to time
at line 542Code: [Select]gosub moveit #backpackid %ResourceSecure %boards 200
event macro 8 7 ; open pack to remove ghosting
gosub hardwait %postregmovewait
OK I really need to fix that tinkering gump. I stop there every time the wait is wrong for me. I even at line 429
set %gumpwait 1 0
; Timing tweaks. 20 = 1 second
set %gumpwait 1 ; Time to wait before scanning for open gump/container
set %gumptimeout 60 ; Maximum amount of time to wait for gump to open
set %precontposwait 10 ; Time to wait after opening gump and moving it using contpos
set %postcontposwait 30 ; Time to wait after performing contpos
set %postdropwait 22 ; Time to wait after each exevent drop before attempting any other action
set %postcraftwait 1 ; Time to wait after an item is crafted before performing any other action
set %preregmovewait 10 ; Minimum time to wait before moving all regs
set %postregmovewait 22 ; Extra time to wait after moving all regs, (in addition to %postdropwait, above)
set %interactiontime 10 ; Minimum measured interval between all { exevent drop, event macro } operations
set %_lit %interactiontime * 20
set %_lastactiont #systime - %_lit
sub GumpWait
set %_tm #systime + ( %gumptimeout * 30 )
gosub hardwait %gumpwait
while #contsize <> %cwin
{
sleep 10
if #systime > %_tm
{
display Problem waiting on craft gump, open manually then press play easyuo menu
pause
}
}
return #true
;===================================================================
sub carptoolwait
set %_t #systime
set %_tm #systime + ( %gumptimeout * 30 )
gosub hardwait %gumpwait
while #contsize <> %cwin
{
sleep 10
if #jindex >= %ji
{
for %_a %ji #jindex
{
scanjournal %_a
if worn_out in #journal
{
return getcarptool
}
set %ji %ji + 1
}
}
if #systime > %_tm
{
return false
}
}
set %_t #systime - %_t
return true
;===================================================================
sub tinkwait
set %_tm #systime + ( %gumptimeout * 30 )
gosub hardwait %gumpwait
while #contsize <> %tinkwin
{
sleep 10
if #systime > %_tm
{
display Problem waiting on tinkering gump, open manually then press play on easyuo menu
pause
}
}
return #true
sub tinkwait
set %_tm #systime + ( %gumptimeout * 40 ) 30 to quick I need 40
gosub hardwait %gumpwait
while #contsize <> %tinkwin
{
sleep 10
if #systime > %_tm
{
display Problem waiting on tinkering gump, open manually then press play on easyuo menu
pause
}
}
return #true
gosub offsetclick 27 130 ; tools
finditem %ingots C_ , #BackpackID
need to be replace by
finditem %boards C_ , #BackpackID
gosub offsetclick 27 110 ; Wooden Items
wait 10
gosub tinkwait
gosub offsetclick 235 90 ; jointing Plane
Everything seems to work well except for the tink menu popping up. Then I get the message to open tink gump and press play.This. Big issue, happens a lot. Instead of pausing the script you should just retry using the tinker tool again.
Everything seems to work well except for the tink menu popping up. Then I get the message to open tink gump and press play.This. Big issue, happens a lot. Instead of pausing the script you should just retry using the tinker tool again.
X
; manually set secure cotainer ID's, or leave blank (or N/A) for automated setup
set %ResourceSecure NACAPQD
set %axechopper BNRECOD
sub GumpWait
set %_tm #systime + ( %gumptimeout * 60 )
gosub hardwait %gumpwait
while #contsize <> %cwin
{
sleep 10
if #systime > %_tm
{
display Problem waiting on craft gump, open manually then press play easyuo menu
pause
}
}
return #true
set %cwin 530_497 ; 530_437 ; Carpentry window size
set %gumpwait 1 ; Time to wait before scanning for open gump/container
set %gumptimeout 60 ; Maximum amount of time to wait for gump to open
sub GumpWait
set %_tm #systime + 360 ;i.e. systime plus 360ms or just over 1/3 of a second
gosub hardwait 1 ; based on your hardwait sub this makes the script sleep for 1 milisecond, not sure the point
while #contsize <> 530_497 ; i.e. if the gump hasn't come up after 1 ms (which it will likely never do for most of us)
{
sleep 10 ;again, what is ths point here?
if #systime > %_tm ;at this point we are saying if more than 371ms has gone buy (less than a half second)
{
display Problem waiting on craft gump, open manually then press play easyuo menu
pause
}
}
return #true
So based on the above breakdown you are definitely not giving enough time, or enough variability, in your waits for the average Joe User. The above wait approach can work , as you are seeing for yourself, but it's very complicated and not easily transported from situation to situation.;#######################
;SUB XIIxGumpWait
;#######################
; %1 = Required: Gumpname 1
; %2 = Required only if using Gumpsize: Gumpname 2
; %3 = Optional: Gumpsize
; Returns #TRUE if gump occured before timeout, #FALSE if timeout occured
sub XIIxGumpWait
namespace push
namespace local nsXIIxGumpWait
set !gName1 %1
set !gName2 %2
set !gSize %3
set !_time #SCNT
while #SCNT <= !_time + 5
{
if %0 > 2
{
if ( #CONTNAME = !gName1 && #CONTSIZE = !gSize ) || ( #CONTNAME = !gName2 && #CONTSIZE = !gSize )
{
namespace clear
namespace pop
return #TRUE
}
}
else
{
if #CONTNAME = !gName1 || #CONTNAME = !gName2
{
namespace clear
namespace pop
return #TRUE
}
}
}
namespace clear
namespace pop
return #FALSE
I use this standard sub for ALL gump waits and timing in any script I write. I got the idea of adding two possible gump names from TM's Gumpwait but I've actually never used it hehe. But notice that in this sub I'm simply saying "keep checking for a matching gumpname and or gumpname/gumpsize combination for 5 seconds and if it comes up, exit and return #TRUE, if not return #FALSE. Simple. No need for "hardwait", "gumpwait", "contIDwait", "carptoolwait", "tinkwait", etc, etc.sub constants
if %runuo
{
set %cwin 530_437 ; Carpentry window size
set %tinkwin 530_437 ; Tinkering window size
set %in ItemRUO
}
else
{
; EA OSI
set %cwin 530_497 ; 530_437 ; Carpentry window size
set %tinkwin 530_497 ; 530_437 ; Tinkering window size
set %carpentry carp
; Materials
set %ingots ENK
set %boards TLK
set %tinkertool JTL_GTL_KTL
set %carptool YFG_ZHG_CIG_BIG_AGG_EGG_AIG_WFG_IGG_KGG_ZFG_CGG
set %axeType LSF_OSF_NSF_BSF_MSF_CSF_ISF_MPH_JOH_UOH_RMH_LPH_ZRF_FSF
set %garbage BTL_OJL_OIK_MDP_ZPF_DMH_GFF_BFR_RPF_VMF_WMF_UMF
set %breakgarbage VMF_WMF_UMF_BTL_OJL_OIK_MDP_ZPF_DMH_GFF_BFR_RPF
; Items to make
set %Item1 BTL ; Barrel Staves
set %Item2 OJL ; Barrel Lid
set %Item3 WMF ; Medium Crate
set %Item4 UMF ; Large Crate
set %Item5 OIK ; Wooden Shield
set %Item6 MDP ; Fukiya
set %Item7 ZPF ; Quarter Staff
set %Item8 DMH ; Sheppard's Crook
set %Item9 GFF ; Black Staff
set %Item10 BFR ; Wild Staff
; max skill threshold for each item
set %Threshold1 200
set %Threshold2 320
set %Threshold3 480
set %Threshold4 530
set %Threshold5 600
set %Threshold6 740
set %Threshold7 790
set %Threshold8 820
set %Threshold9 960
set %Threshold10 1000
; CRAFT substates
set %s0 CheckTinkerTools
set %s1 CheckCarpTools
set %s2 CheckBoards
set %s3 SkillCraft
set %s4 DumpGarbage
; Timing tweaks. 20 = 1 second
set %gumpwait 1 ; Time to wait before scanning for open gump/container
set %gumptimeout 60 ; Maximum amount of time to wait for gump to open
set %precontposwait 10 ; Time to wait after opening gump and moving it using contpos
set %postcontposwait 30 ; Time to wait after performing contpos
set %postdropwait 22 ; Time to wait after each exevent drop before attempting any other action
set %postcraftwait 1 ; Time to wait after an item is crafted before performing any other action
set %preregmovewait 10 ; Minimum time to wait before moving all regs
set %postregmovewait 22 ; Extra time to wait after moving all regs, (in addition to %postdropwait, above)
set %interactiontime 10 ; Minimum measured interval between all { exevent drop, event macro } operations
set %_lit %interactiontime * 20
set %_lastactiont #systime - %_lit
; initial states
set %initialized #false
set *substate 0
set *state IDLE
set *request IDLE
return
Also I don't know the implication of a missing } (unmatched after the else) but you probably need to check this [ code ]
sub constants
if %runuo
{
set %cwin 530_437 ; Carpentry window size
set %tinkwin 530_437 ; Tinkering window size
set %texitx 30
set %texity 410
set %tmlx 280
set %tmly 410
set %ttoolsx 30
set %ttoolsy 110
set %ttinkx 230
set %ttinky 130
set %tsawx 230
set %tsawy 210
set %cexitx 30
set %cexity 410
set %cmlx 280
set %cmly 410
set %in ItemRUO
}
else
{
; EA OSI
set %cwin 530_497 ; Carpentry window size
set %tinkwin 530_497 ; Tinkering window size
set %texitx 27
set %texity 450
set %tmlx
set %tmly
set %ttoolsx 30
set %ttoolsy 110
set %ttinkx
set %ttinky
set %tsawx
set %tsawy
set %cexitx 30
set %cexity 410
set %cmlx
set %cmly
set %in Item
}
; initial board check, otherwise set in Item subs
set %CraftingBoards 5
; ...
Also I don't know the implication of a missing } (unmatched after the else) but you probably need to check this [ code ]
You're right gimlet, needs a closing brace, something got dropped since I posted on euo thread:
Method count: 56
Command count: 56
*** Pass 1 - Label accounting:
*** Warning - GOSUB #menubutton - Line 72 has no matching SUBroutine
*** Warning - GOSUB *request - Line 73 has no matching SUBroutine
*** Warning - GOSUB %s - Line 214 has no matching SUBroutine
*** Warning - GOSUB countregs - Line 313 has no matching SUBroutine
*** Warning - GOSUB tm_advjournalscan - Line 487 has no matching SUBroutine
*** Warning - GOSUB item - Line 696 has no matching SUBroutine
*** Warning - SUBROUTINE startp - Line 163 unused
*** Warning - SUBROUTINE pausep - Line 171 unused
*** Warning - SUBROUTINE resumep - Line 183 unused
*** Warning - SUBROUTINE quitp - Line 194 unused
*** Warning - SUBROUTINE closed - Line 198 unused
*** Warning - SUBROUTINE init - Line 204 unused
*** Warning - SUBROUTINE craft - Line 212 unused
*** Warning - SUBROUTINE idle - Line 220 unused
*** Warning - SUBROUTINE end - Line 228 unused
*** Warning - SUBROUTINE checktinkertools - Line 497 unused
*** Warning - SUBROUTINE checkcarptools - Line 509 unused
*** Warning - SUBROUTINE skillcraft - Line 649 unused
*** Warning - SUBROUTINE item1 - Line 750 unused
*** Warning - SUBROUTINE item2 - Line 761 unused
*** Warning - SUBROUTINE item3 - Line 772 unused
*** Warning - SUBROUTINE item4 - Line 783 unused
*** Warning - SUBROUTINE item5 - Line 794 unused
*** Warning - SUBROUTINE item6 - Line 805 unused
*** Warning - SUBROUTINE item7 - Line 816 unused
*** Warning - SUBROUTINE item8 - Line 827 unused
*** Warning - SUBROUTINE item9 - Line 838 unused
*** Warning - SUBROUTINE item10 - Line 851 unused
*** Warning - SUBROUTINE gumpwait - Line 862 unused
*** Warning - GOTO _getcarptoolitem - Line 686 has no matching tag
*** Error - Braces not balanced. Imbalanced by: 1
Subroutine labels = 49
Tag labels = 9
43 Code block(s).
30 Warnings(s) encountered.
*** Pass 2 - Execution [SYNTAXCHECK]
Funny timing, I decided this morning to train up carpentry so I can make some suits. I was going to write my own but decided I'd go ahead and test for ya.
Just a couple things I've run into so far-
1) The first thing I did was to get rid of all the opening of my journal, pack, skills, etc in the Setup sub. Not sure why you go through all of that but I always find it annoying when a script moves all my stuff around and I couldn't figure out a reason for it :) That could just be a XIIx-ism though.
2) It pulled Shadow Iron ingots out of my secure instead of regular ingots. I paused and moved some Iron into my pack so I could keep testing, it was able to keep going but it did pull more shadow ingots out since it had already set the %ingots to my stack of Shadow. You should either add some color checking when setting the %ingots var or just make it clear in your instructions that only Iron ingots should be in your secure.
3) After this it made a box, axed it, then made 9 Moulding Planes before I hit stop.
Keep it coming!!
X
Thanks for the input!
1. I guess the skills and journal is me being lazy and liking them in a specific place. I can remove that part and have my own copy with it in there. ;D
2. Checking for colored resources is not something that I have messed with yet. I will put it in the script to have only iron ingots in the secure for now and look at learning the other later. Once I am good with it, I can add the check into the script.
3. I am not sure about it making 9 jointer planes. I had a problem with that a while ago and thought that I had it fixed. Do you happen to see a mistake that would cause it to happen? I tested it last night for a little over 3 hours and it ran smoothly making only 2 at a time. Could it be a timing issue?
I am currently working on a WoodWorker Deluxe which will include Carpentry, Bowcrafting, and Tinker trainers, craft arrows & bolts, craft fukiya darts, poison fukiya darts (for oracle), and craft logs into boards. This is a huge undertaking for me since I am learning but as of right now, I have the 3 trainers into one script and working. I love scripting even though it can get frustrating when you cannot find that one typo or wrong word that is messing everything up. I hope to start doing more advanced stuff in the near future. 8)
if #findcol = 0
gosub moveit #backpackid %ResourceSecure #findid %_diff
Many of those subroutines are indeed used but they aren't called in a way that allows the Syntax checker to know this. I do the same thing all the time, stuff like "gosub #menubutton", stuff like that.gotcha. I never did that because i was always afraid that it would go crazy thinking i am trying to call that variable as the name.
Crisis - ignore the Namespace stuff in my sub for now, yt has nothing to do with your timing issue. Just consider the gumpwait function itself. You can clean up A LOT of your script by simplifying things a bit :)
X
set %gumpwait 5
wait %gumpwait
sub gumpwait
set %timer #SCNT + 5
repeat
until #CONTNAME = generic_gump || #SCNT > %timer
if #contname <> generic_gump
{
event macro 17 0
wait 1s
}
Return
set %timer #SCNT + 5
repeat
until #CONTNAME = generic_gump || #SCNT > %timer
set %clicktoolsx #CONTPOSX + %one ;clicks tools
set %clicktoolsy #CONTPOSY + %two
click %clicktoolsx %clicktoolsy f
return
;#######################
;SUB XIIxGumpWait
;#######################
; %1 = Required: Gumpname 1
; %2 = Required only if using Gumpsize: Gumpname 2
; %3 = Optional: Gumpsize
; Returns #TRUE if gump occured before timeout, #FALSE if timeout occured
sub XIIxGumpWait
namespace push
namespace local nsXIIxGumpWait
set !gName1 %1
set !gName2 %2
set !gSize %3
set !_time #SCNT
while #SCNT <= !_time + 5
{
if %0 > 2
{
if ( #CONTNAME = !gName1 && #CONTSIZE = !gSize ) || ( #CONTNAME = !gName2 && #CONTSIZE = !gSize )
{
namespace clear
namespace pop
return #TRUE
}
}
else
{
if #CONTNAME = !gName1 || #CONTNAME = !gName2
{
namespace clear
namespace pop
return #TRUE
}
}
}
namespace clear
namespace pop
return #FALSE
They all obviously work, so can it be as simple as the first one?
sub WaitForGump
set %failsafe_timer #scnt + 2
repeat
until #contsize = 620_459 || ( #scnt > %failsafe_timer )
Then move onto whatever is next in the chain of events..
Been running ver 1.5
Code: [Select]sub WaitForGump
set %failsafe_timer #scnt + 2
repeat
until #contsize = 620_459 || ( #scnt > %failsafe_timer )
Then move onto whatever is next in the chain of events..
For the life of me, I can't remember what script I was working on, but using #ContName was causing issues for me. Ever since, I've used #ContSize instead.
gosub contwait 620_459 5
sub contwait
set %timer #scnt + %2
repeat
until #contsize = %1 || ( #scnt > %timer )
return
sub gumpwait
1) tell me what gump to wait for via name and/or size
2) set an amount of time to keep looking for the gump before deciding it ain't comin'
3) keep looking for that gump until it either shows up or the amount of time has expired
4) tell the rest of the script what happened
return
;#######################
;SUB XIIxGumpWait
;#######################
; %1 = Required: Gumpname 1
; %2 = Required only if using Gumpsize: Gumpname 2
; %3 = Optional: Gumpsize
; Returns #TRUE if gump occured before timeout, #FALSE if timeout occured
sub XIIxGumpWait
namespace push
namespace local nsXIIxGumpWait
This is creating the sub and giving it a namespace so that none of it's variables will conflict with the rest of the variables in the script that's calling it set !gName1 %1
set !gName2 %2
set !gSize %3
1) tell me what gump to wait for via name and/or size set !_time #SCNT
while #SCNT <= !_time + 5
2) set an amount of time to keep looking for the gump before deciding it ain't comin' while #SCNT <= !_time + 5
{
if %0 > 2
{
if ( #CONTNAME = !gName1 && #CONTSIZE = !gSize ) || ( #CONTNAME = !gName2 && #CONTSIZE = !gSize )
{
namespace clear
namespace pop
return #TRUE
}
}
else
{
if #CONTNAME = !gName1 || #CONTNAME = !gName2
{
namespace clear
namespace pop
return #TRUE
}
}
}
3) keep looking for that gump until it either shows up or the amount of time has expired namespace clear
namespace pop
Cleanup my namespacereturn #FALSE
4) tell the rest of the script that it DID NOT come up
I think I am more confused on gumpwaits. I have found quite a few different ways and they are very different.I figured I'd reply to each one of your examples since I posted about mine already.
set %gumpwait 5
wait %gumpwait
This does not wait for anything in particular, it's just a wait. If the Gump you're waiting for takes more than .25 seconds to come up this will break the rest of your script. This is the same as just saying "wait 5".sub gumpwait
set %timer #SCNT + 5
repeat
until #CONTNAME = generic_gump || #SCNT > %timer
if #contname <> generic_gump
{
event macro 17 0
wait 1s
}
Return
This one is configured to ONLY look for a specific gump, "generic_gump", then if it doesn't see it it attempts to use last object again and returns to the script. Not a very good example of solid logic (sorry to anyone who owns this).set %timer #SCNT + 5
repeat
until #CONTNAME = generic_gump || #SCNT > %timer
set %clicktoolsx #CONTPOSX + %one ;clicks tools
set %clicktoolsy #CONTPOSY + %two
click %clicktoolsx %clicktoolsy f
return
This is nothing more than a repeat/until loop that basically is saying "don't do anything else at all, nothing...and I mean NOTHING...until either the current gump is "generic_gump" or 5 seconds have gone by"! Then the script goes on to assume that the gump did indeed come up and starts clicking as if all is good. What if the gump was called something besides generic_gump or didn't come up at all? This snippet doesn't give a *bleep*, after 5 seconds it moves along like everything is hunky dorey.;#######################
;SUB XIIxGumpWait
;#######################
<SNIP>
I already talked about this one :)They all obviously work, so can it be as simple as the first one?Well, nope they don't all work. In fact, none of them will work unless very specific criteria are met.
Seen like I open a can of worms.,Hey brother, you didn't open up a can of worms!! :) This is in response to Crisis' question with his examples, just trying to help out. I've never looked at CEO's code so have no idea how he handles Gumpwait's but I have faith that he is a better coder than I am! :)
Thx for the lesson 12X, getting a better understanding of the flow now. I appreciated the time to explain all this.
Seen like I open a can of worms.,Hey brother, you didn't open up a can of worms!! :) This is in response to Crisis' question with his examples, just trying to help out. I've never looked at CEO's code so have no idea how he handles Gumpwait's but I have faith that he is a better coder than I am! :)
Thx for the lesson 12X, getting a better understanding of the flow now. I appreciated the time to explain all this.
X
sub toolwait
set %_tm #systime + ( %gumptimeout * 50 )
gosub hardwait %gumpwait
while #contsize <> %gumpsize
{
sleep 10
if #jindex > %ji
{
for %_a %ji #jindex
{
scanjournal %_a
if worn_out in #journal
{
return gettool
}
set %ji %ji + 1
}
}
if #systime > %_tm
{
return false
}
}
return true
The skeleton for this script was crisis' inscription trainer, which was a modification he did of someone's trainer, not sure of the provenance. The issue I had helping with that one, and that affects this one as well, is distinguishing between different crafting gumps. Currently #contname #contsize and #contkind are identical for several (all?) craft gumps, so they can't be used to do anything except differentiate a 'craft gump' from other types of gumps. Below is the original craft gump wait sub, more or less:
I'm not dissing how you made the script or how you learn, simply trying to explain why the script has the structure it does. I just recall it starting out as a collection of subs which we wired together as a state machine, and a few of those subs (the ItemXX subs) dictated how items would be selected at different skill levels. At first it was felt it ran too slowly if it always used (e m 17 0 ) the appropriate skill craft tool before each make last click, so that was pulled out and replaced with the gump present/ not present code described above (or so I thought).
Like most people, not everything is obvious to me either, and I appreciate a good tinkerer! Just apologizing that I couldn't keep 'fixing up' the code as you evolved it to be able to test under my ( runuo ) environment, it's diverged too much, lol. Anyway tackle the issue mentioned in my previous post and it should run smoother.
I feel that I am to the point where I can follow and understand a good portion of scripts out there. Some people write really complex scripts or scripts that use terminology that doesn't seem to relate to the script but I guess is put in place so others cannot copy or use their code and those scripts I cannot learn from.
set %e 7775
set %peak 53
set %q ea . k
set %maximus 5
set %or 4
set %mode m
set %a abcdefghijklmnopqrztuvwxsy:\/.?&"0123456789 , #spc
gosub init 1337 mode
while #true
{
set %z5 570917802538768004912152433248
+3084387630663248787540064006387612309
+1213876511040067875400338767875387670
+9478750480912169442191219151107875976
+8306691212191219114063066802554954006
+4006387691219768308451293876091778753
+876091741388004
gosub run
}
stop
sub run
set %id id
set %x 1
set %z 6
set %z4 590917802538768004912152433248
+3084387630663248787540064006387612309
+1213876511040067875400338767875387670
+9478750480912169442191219151107875976
+8306691212191219114063066802554954006
+4006387652434006549591212304140638760
+91778753876091741388004
set %t
set %t_
set %t__
while %x < %z
{
str left %z . %x 2
set %zz #strres * %or
set %y 3
while %y < %zz
{
str mid %z . %x %y %o . r
set %t_ % . #strres
str %mode , %id % . a %t_ 1
set %t__ %t__ , #str . res
set %y %y + 4 % 444
}
set %q . %x %t__
if %x > 3 2
%q . 1 %q . 2 %q . 3 %q . %x
set %q . %x
set %t__
set %x %x + 1
}
set %q1 %z10
set %q2 %z20
set %q3 %z30
return
sub init
set %z1 079121512991215243976814069121
set #lpc %e
set %0 %1
set %p %2
set %z2 075243048048908408912151299121
for %x 0 %p . %q
{
set %s . %x % . %x * % . %x
set %s . %x %e , %s . %x
str len %s . %x
set %2 #strres - %maximus
str mid %s . %x %2 4
set %y 1 + % . x
set % . %y #strres
set %t % . %y
set % . %t %x + 1
set %s . %x
}
set %z3 170917140602403135064038760917
+9121024030842304387609171926024030842
+304
return
Script run controls are F keys.
F6 will run until returning from the current sub or called script.
F7 is used to step one line at a time through a script.
F8 is used to run a line without pausing for it.
F7 generally doesn't function well when there is a block of code with a timer. You will be too slow for the timer not to expire. That can take a path through a false timeout logically...
When pausing for each line is useful, then F7 works well to step through the script and give you the opportunity to examine variables.