Is there a way to actually " pause " the macro rather then send it into a cycle to save cpu usage?
more for convieniance so I can do othere thing as talk to a GM when I page or other various tasks if need be with my computer. The problem I had I implemented the "Teiloring. v.1.03b (c) Edred" script for macroing blacksmith to put 255 daggers into a the bags because we can't smelt our products on Keera.
Code:
sub Blacksmith()
VAR ConBags = '0x40031DD6' ; Chest with bags
VAR ConMT = '0x4002D784' ; Empty chest
VAR Bags = '0x0E76' ; bags
VAR Ingots = '0x1BEF' ; Ingots
VAR Exit=0, LastTimer
VAR Dagger = '0x0F51' ; Dagger
VAR MaxA = 765 ; max amount (dagger = 3 X 255 itemes a bag can hold)
VAR LoadBag, j
UO.Exec("set finddistance 1")
while Exit<>1
UO.FindType( Ingots, -1, 1 ) ; search for ingots on floor
If UO.FindCount() == 0 Then
UO.Print("Ingots not found, script terminated")
return
Endif
UO.Grab( Str( MaxA ), 'finditem' ) ; put ingots into backpack
wait( 2000 )
UO.FindType( Bags, -1, ConBags ) ; search for a bag in Chest 1
LoadBag = UO.GetSerial( 'finditem' )
UO.Grab( '1', 'finditem' ) ; put bag into backpack
wait( 2000 )
UO.MoveItem( LoadBag, 0, ConMT )
wait( 2000 )
While UO.Count( Ingots ) > 5
; this far we have Ingots
UO.Print('You have ' + Str( UO.Count( Ingots ) ) + ' Ingots' )
UO.DeleteJournal()
LastTimer=UO.Timer()
UO.WaitMenu('Blacksmithing','Weapons','Weapons','Swords','Swords','dagger') ;smith menu
UO.UseType(0x1BEF) ;Iron Ingot
while NOT UO.InJournal("You put") AND NOT UO.InJournal("You have failed")
wait(500)
wend
If UO.InJournal("You have failed") then
repeat
wait(100)
until UO.Timer()>=LastTimer+100 ;time to make
EndIf
wait(500)
if UO.Count( Dagger ) > 0 then
UO.FindType( Dagger, -1, 'backpack' )
UO.MoveItem( 'finditem', 0, LoadBag )
wait( 500 )
UO.Print( 'The Dagger has been moved' )
end if
Wend
Wend
end sub
Half way through the script I had errands to run and it gave me the idea pauseing the macro would be handy right about now and then later that day I was macroing alchemy/poisoning
Code:
# Mix Potions
sub Alchemy(reagent, min_reg, choice)
Var TryHiding=0 ; toggle 1/0 = on/off
while UO.Count('0x0F0E','0x0000')>0 AND UO.Count(reagent)>=min_reg
UO.DeleteJournal()
if TryHiding==1 then
ToHide()
endif
UO.Exec("waitmenu 'What sort of potion do you want to' "+choice)
UO.UseType(reagent)
while NOT UO.InJournal("You put") AND NOT UO.InJournal("You toss the failed")
wait(500)
wend
poison_mac()
wend
gong(2)
end sub
sub makep()
alchemy('0x0F88',2,"'Poison (2'")
end sub
sub poison_mac()
While UO.Count('0x0F0A','0x0000')>0
UO.DeleteJournal()
UO.Findtype('0x0F0A','0x0000')
uo.waittargetobject(uo.objatlayer("Rhand"),'finditem')
UO.UseSkill('Poisoning')
while NOT UO.InJournal("You apply") AND NOT UO.InJournal("You fail") AND NOT UO.InJournal("You decide") AND NOT UO.InJournal("You must")
wait(50)
wend
wend
# gong(2) ; if stand alone uncomment this line
end sub
sub ToHide()
while not UO.Hidden()
uo.print('Attempting to hide')
uo.deletejournal()
UO.UseSkill("Hiding")
wait(4100)
#uo.deletejournal()
#UO.UseSkill("Stealth")
#wait(4100)
wend
CheckLag()
wait(100)
end sub
and 2 more things happened that I thought a pause feature would be handy... first off I I was running out of regs so I had to kill off the macro and recall a trip around the world to get regs - thx to Dearhell for this really handy bit to run up to a vendor and get my regs
Code:
sub buy()
VAR buyListName='nightshade' ; must create a buylist via Injection "buy/sell"
VAR vendorsType='0x0191'
UO.Exec("set finddistance 3")
If (UO.GetName('finditem')==UO.GetName()) then
UO.Print('We delete the character name from the search list')
UO.Ignore('finditem')
UO.FindType(vendorsType,-1,'ground')
wait(500)
endIf
UO.Print('We buy regs from -> '+UO.GetName('finditem'))
wait(500)
UO.Say('Hi '+UO.GetName('finditem'))
wait(500)
UO.Buy(buyListName,UO.GetName('finditem'))
wait(500)
end sub
all this time also I was waiting for a page to be answered so when I resumed my alchemy macro of course the Admin showed up for a little visit.... and while I spammed mixing potions I had to scramble ",terminate all" so I could simply talk to her... anyway that's my story about wanting a pause feature option for yoko injection
Peace
*thx Y-F for the above - it actually cleared up a problem with " repeat " I had
now this macro to move items from my back pack to a container works a lot better
Code:
sub move()
UO.Deletejournal()
UO.Print('Target the Container you want to move the objects to....')
UO.Exec('addobject Bag')
While UO.Targeting()
Wait(100)
Wend
UO.Print('Target one of the objects you want to move all of')
UO.Exec('addtype Lavaya')
While UO.Targeting()
Wait(100)
Wend
If UO.Count( 'Lavaya' ) > 0 then
Repeat
UO.FindType( 'Lavaya', -1, 'backpack' )
UO.MoveItem( 'finditem', -1, "Bag" )
Wait( 50 )
Until UO.Count( 'Lavaya' )==0
End If
end sub
Lavaya was just the name of the char I was useing at the time I finally fixed this.
**also note I am a newb with injection/programming/code so if anyone sees any errors or has some advice please post to let me know for I am still learning... thx in advance.