All pastes #48611 Raw Edit

Miscellany

public text v1 · immutable
#48611 ·published 2006-04-08 05:39 UTC
rendered paste body

; TO DO
; Add schedlued tasks
; add random choice tasks
; add some smart rail walking
; Create standardised Subs < started
; Error Handling
; Single Location FOr crafting safely? << Done
; auto buying of needed items, EG bottles, reags, scrolls, tooks
; Monitoring of recalls lefto n all books
; Auction monitor, Bid on needed items
; Cash Monitor, dont attempt to buy with no cash
; Ride Taming <, Done
set %ScheduleMethod Task ; Task or AI

Gosub Setup
Gosub Taming

halt

Main:
Gosub CHooseTask
Gosub #result
if #result <> #true
gosub #result
Goto Main



; Sub Update Stats
;Useage:
; %1 Item Type
; %2 VarName
Sub UpdateStat
UpdateStat:
Finditem %1 C_ , #backpackid
if #findid = x 2
ignoreitem reset 2
return #true
set %ReCnt %2 , %prefix
set * , %recnt * . %recnt + #findstack
ignoreitem #findid 1
Goto UpdateStat


sub DarkLotus
set %Task1 Buying
set %taskrepeat1 400s
set %task2 Taming
set %taskrepeat2 1800s
set %task3
set %taskrepeat3
set %backgroundTask Mining

set %priority1 Buying
set %priority2 Mining
set %priority3 Scribe
set %priority4 Alch
set %priority5 Smithy
set %priority6
set %priority7
set %priority8
set %prefix DL
;Vendor setup
set %vendorid
set %itemname1 Constantan , #spc , Armor
set %itemid1 CUD
set %itemprice1 30000
set %itemname2 Drakes
set %itemid2 CKF
set %itemprice2 25000
set %itemsToMonitor 2
set %BankStockCOntainer
; Taming
set %PetIDs EG
set %tamingbook VAQDKMD
set %tamelocs 2
set %PetChest JASDKMD
set %PetItemId GKM_

; BookSetup
set %homebook RBCSJMD
set %homerune 15

Return





Sub Setup
if #charname = n/a
gosub %1
else
Gosub #Charname
Return


Sub Taming
for %T_A 1 %tamelocs
{
gosub recall %tamingbook %T_A 2
if #result <> #True
Goto EndTamingLoop
Gosub MainCheck
Gosub Tame
if #result = #true
Gosub TamingDrop
EndTamingLoop:
}
Return #true

Sub Tame
Tame:
Gosub CheckMain
if #result <> #true
{
if #result = #false
Return #false
if #result <> #true && #result <> #false && #result <> N/A
Gosub #result
}
Finditem %PetIDs G_15
if #findid = x
Return #false
Gosub Move #findx #findy 1
event macro 13 35
target 2s
set #ltargetid #findid
event macro 22 0
wait 10
For %Tame_B 1 12
{
gosub move #findx #findy
if line_of in #sysmsg
goto Tame
Gosub WaitForSysMsg Accept Fail_to_tame n/a
if #Result = #true
return #true
if #Result = #false
goto Tame
wait 1s
}
Goto Tame


; Checks Vendors stock, and counts prices
Sub VendorCheck
VendorCheck:
Gosub MainCheck
Finditem %vendorid G_
Gosub Move #findx #findy 1
msg KKLOLK Stock$
Gosub Waitgump ASEB 10
if #return <> #true
goto vendorcheck
Gosub PosGump 10 10
VendorCheck:
for %vendor 1 %itemstomonitor
{
set %itemid %itemid . %vendor
set %itemprice %itemprice . %vendor
Finditem %itemid C_
if #findid = x
Gosub StockVendor %itemid 5






; %1 Items ID
; %2 AMount of the item to stock
SUb StockVendor


; %1 X or Rail number
; %2 Y or Accuracy
; %3 Accuracy
SUb Move
move %1 %2 %3
return

; %1 Gump Kind
; %2 Timeout in Seconds
Sub WaitGump
set %timeout 0
Wait_gump:
set %timeout %timeout + 1
if %timeout > %2
return #false
       if #contkind <> %1 2
       wait 1s
       goto wait_gump
return #true

; %1 x
; %2 y
Sub PosGump
ContPos 10 10
return


; Main Check FOr Dead D'C other all purpose checks
SUb mainCHeck
if #charghost = yes
display ok DEAD
return


; Recall
; %1 Bookid
; %2 Rune Number
Sub Recall
set %attempts %3
Recall:
set %attempts %attempts + 1
set %curx #charposx
set %cury #charposy
set %rune %2 + 1
Finditem %1 C_ , #backpackid
if #findid = x
return #false
msg ,recall %1 %rune , $
for %runey 1 15
{
wait 10
if ( #charposx <> %curx ) || ( #charposy <> %cury )
Return #true
if needs_time in #sysmsg
Goto Recall
}
if %3 <> n/a && %attempts < %3
goto recall
Else
Return #false

; %1 Succes
; %2 Fail
; %3 OPTIONAL timeout in seconds
Sub WaitforSysMsg
if %3 <> N/A
set %timeout #time + %3
WaitforSysMsg:
if %3 <> N/A && %timeout < #time
return
if %1 in #sysmsg
return #true
if %2 in #sysmsg
return #false
if %3 = N/a
Return
Goto WaitforSysMsg

Sub TamingDrop
TamingDrop:
msg all come$
Gosub MainCheck
Gosub Recall %homebook %homerune 2
if #result <> #true
goto tamingDrop
Tdrop:
Finditem %petchest G_
if #findid = x
goto tdrop
set #lobjectid #Findid
event macro 17 0
gosub WaitGump ASEB 5
if #result <> #true
Goto TDrop
contpos 10 10
Finditem WUF C_ , %petchest
exevent drag #findid 1
exevent dropc #backpackid
wait 25
FindShrink:
Finditem WUF C_ , #backpackid
if #findstack > 1 2
ignoreitem #findid
goto findshrink
set #lobjectid #findid
finditem %PetIDs G_2
set #ltargetid #Findid
event macro 17 0
target 2s
event macro 22 0
wait 2s
finditem %PetItemId G_2
exevent drag #findid 1
exevent dropc %petchest
wait 25
return