ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Remaker on October 06, 2009, 03:30:11 PM
-
can anyone give me some tips on how to go about writing a script to stack boards into 60k piles, i got a few hundred stacks to deal with.
thx
-
I was thinking of trying to write the same script, but I dont know enough yet lol.
-
I'd say the easiest way to do it would be to drop stacks of lumber into a secure and let the stacking system get them close and then top them off manually. It's what I do with the boards that I get from my lumberjack.
-
thats what i do now, but i have a few hundred stacks that are 59xxx. just trying to save tedious work :P
-
Here is a bit of code .. it doesnt cover every senario... but if you run it a rew times it should do the job.
It pulls boards from teh last stack found to fill in the other stacks. The portion not done is when the laststack becomes empty.. is doesnt start using the 2nd to last etc... So run it a few times if it doesnt fill them all the first time.
100% untested code, written off top of the head
Finditem %Boards
If #findcnt > 1
{
set #findindex #Findcnt
set %PullFromIndex #Findcnt
set %Pullfromstack #findid ; Last stack
For #Findindex 1 #findcnt
{
If #findindex < %PullFromIndex && #Findstack < 60000
{
set !get 60000 - #findstack
exevent drag %PullFromStack !get
wait 10
exevent dropC #Findindex
wait 10
}
}
}
-
that one just picks up boards and drops them on the same stack. me and my friend tried writing one but so far its doing the same thing, picking up so many boards and dropping them on the same stack. here is what we came up with. Any help to fix it would be sweet.
start:
set %find TLK
set %full 60000
set %wait 10
gosub getboards
gosub stacking
return
sub getboards
finditem %find
if #findstack < %full
{
set %pile #findid
return
}
ignoreitem
return
sub stacking
finditem %find
if #findid = %pile
{
ignoreitem
return
}
loop:
set %source #findid
finditem %pile
wait 5
set %count ( %full - #findstack )
exevent drag %source %count
wait 10
exevent dropC %pile
wait 10
finditem %pile
if #findstack = %full
{
goto start
}
goto loop
-
Opps i made a mistake is probably why it didnt work
change
exevent dropC #Findindex
to
exevent dropC #FindID
So it would be
Finditem %Boards
If #findcnt > 1
{
set #findindex #Findcnt
set %PullFromIndex #Findcnt
set %Pullfromstack #findid ; Last stack
For #Findindex 1 #findcnt
{
If #findindex < %PullFromIndex && #Findstack < 60000
{
set !get 60000 - #findstack
exevent drag %PullFromStack !get
wait 10
exevent dropC #FindID
wait 10
}
}
}
-
I actually got a working script a few days ago but i didnt want to post it since it uses subs that are 5 years old lol. My friend Necro (wrote the popular poisoning script on easyuo) wrote it for me.
regardless of that here is the code.
set %debug #false
exevent dropC %targetBox
set %whatToMove TLK
set %tot 0
if %debug
{
set %sourceBox FSWVDRD
set %targetBox SDOTNND
goto Debug
}
redoSB:
gosub setTargToVar sourceBox Select the box with the source of boards you want to move
if #result = failed
halt
if ! #result
goto redoSB
redoTB:
gosub setTargToVar targetBox Select the box you would like to move board to
if #result = failed
halt
if ! #result
goto redoTB
gosub setupDesktop %sourceBox 0 0 %targetbox 250 0
Debug:
MainLoop:
gosub findStack
gosub moveStack #findid %moveAmount
goto MainLoop
sub findStack
finditem %whatToMove C_ , %sourceBox
if #findkind = -1
{
display OK no more boards
halt
}
if %tot >= 60000
set %tot 0
if %tot + #findstack > 60000
set %moveAmount 60000 - %tot
if %tot + #findstack <= 60000
set %moveAmount #findstack
set %tot %tot + %moveAmount
return #findid
sub moveStack
exevent drag %1 %2
wait 22
exevent dropC %targetBox
wait 22
return
;==================================
; Script Name: sub setTargToVar
; Author: Necro|FS
; Version: x.xx
; Client Tested with:
; EUO version tested with:
; Shard OSI / FS: OSI
; Revision Date:
; Public Release: 01-21-05
; Global Variables Used:
; Purpose: Setup variable for whatever you target, plus shows given message.
;==================================
sub setTargToVar
; %1 = name of the variable without the "%"
; %2 = Message to display (optional)
; if #result = failed - user cancelled the target #result = #true if it worked
; example -
; gosub setTargToVar regContainer Please target your REAGENT supply container..
; Purpose - Will set whatever you target to the variable you specify, and uses the message you specify
nameSpace Push
nameSpace local sTTV
if %0 < 1 || %0 = n/a
return
set !0 %0
for !_cnt 1 !0
{
set ! . !_cnt % . !_cnt
}
if !0 = 1
goto sTTVskip
for !_cnt 2 !0
{
if !_msg = n/a
set !_msg ! . !_cnt
else
set !_msg !_msg , #spc , ! . !_cnt
}
str left !_msg 1
set !_msgLetter #strres
str del !_msg 1 1
str lower #strres
set !sysMessages SYS in #opts
if !sysMessages
event sysmessage !_msgLetter , #strres
else
display ok !_msgLetter , #strres
sTTVskip:
set #ltargetid notpick
set #targcurs 1
sTTVTargLoop:
wait 0
if #targcurs <> 1 && #ltargetid = notpick
{
nameSpace Clear
nameSpace Pop
return #false
}
if #ltargetid = notpick
goto sTTVTargLoop
set % , !1 #ltargetid
nameSpace Clear
nameSpace Pop
return #true
;==================================
; Script Name: sub SetupDesktop
; Author: Necro|FS
; Version: 1.10
; Client Tested with: 4.0.3e
; EUO version tested with: 0096
; Shard OSI / FS: OSI / FS
; Revision Date: 08/01/04
; Public Release: 08/01/04
; Global Variables Used: n/a
; Purpose: Opens & Moves gumps to specified locations.
;==================================
sub SetupDesktop
;%1 - Gump request ( #contname )
;%2 - #ContPosX request
;%3 - #ContPosY request
;%4 - %* = optional
;@Purpose: Opens & moves gumps to specified locations;
; Can be included or called; Supports more than one container to open
;@by Necro|FS
;@Possible values for %1 = "ABCDEF" (ID of the Container) / "menu_ABCDEF" (Menu means you
; will be using a gump like the alchemy gump, the id is for the object to be used (a mortar)) /
; optionsgump (configuration) / paperdoll_gump (paperdoll) / status_gump (status) /
; text_gump (journal) / skill_gump (skills list) / spellbook_gump (spellbook) / container_gump
; (Inventory) / radar_gump (Overview) / normal_gump (UO Messenger) / PartyGump (Party Manifest)
nameSpace Push
nameSpace local subSD
set !_parm1 optionsgump_paperdoll_gump_status_gump_text_gump_
+skill_gump_spellbook_gump_container_gump_radar_gump_normal_
+gump_partygump
for !cnt2 1 %0
{
set ! . !cnt2 % . !cnt2
}
set !Runs %0 / 3
for !cnt 1 !Runs
{
set !_useEM #true
set !Parm1 3 * !cnt - 2
set !Parm2 !Parm1 + 1
set !Parm3 !Parm2 + 1
set !Parm1 ! . !Parm1
set !Parm2 ! . !Parm2
set !Parm3 ! . !Parm3
if !Parm1 notIn !_parm1
{
set !_useEM #false
goto openitSUD
}
if !Parm1 = optionsgump
set !macro 0
if !Parm1 = paperdoll_gump
set !macro 1
if !Parm1 = status_gump
set !macro 2
if !Parm1 = text_gump
set !macro 3
if !Parm1 = skill_gump
set !macro 4
if !Parm1 = spellbook_gump
set !macro 5
if !Parm1 = container_gump
set !macro 7
if !Parm1 = radar_gump
set !macro 8
if !Parm1 = normal_gump
set !macro 9
if !Parm1 = PartyGump
set !macro 10
openitSUD:
if !_useEM
event macro 8 !macro
else
{
if menu in !parm1
{
set !_menu #true
str del !parm1 1 5
set !parm1 #strres
}
set #lobjectid !Parm1
event macro 17
}
scanjournal
if You_must_wait in #journal
{
deletejournal
goto openitSUD
}
wait 10
WFSVL:
if !_menu
gosub waitForSysVar contname = generic_gump 2
if !_useEM
gosub waitForSysVar contname = !Parm1 2
if ! !_useEM && !_menu <> #true
gosub waitForSysVar contid = !Parm1 2
if ! #result
goto WFSVL
WFSV2:
else
contpos !Parm2 !Parm3
gosub waitForSysVar contposx = !Parm2 contposy = !Parm3
if ! #result
goto WFSV2
}
nameSpace Clear
nameSpace Pop
return
sub waitForSysVar
; Author: Quintok / Raziel
{
nameSpace Push
nameSpace local WFSV
set !cnt %0 / 3
if ( %0 % 3 = 1 )
set !timeOut #scnt + % . %0
else
set !timeOut #scnt + 5
for !i 1 !cnt
{
set !offset 3 * !i - 2
set !evaluation !offset + 1
set !value !offset + 2
if ! ( # . % . !offset % . !evaluation % . !value )
set !i 0
if #scnt > !timeout
{
nameSpace Clear
nameSpace Pop
return #false
}
}
}
nameSpace Clear
nameSpace Pop
return #true
-
You know, I was poo-pooing this script until I found a use for it. Efficient, thanks.
:)