Version 3.5.1 uploaded includes Frneo's code to craft pens. I do not have a scribe with tinkering to test the code, so please try out the new version and provide feedback.
Thanks,
JaF
Hi JaF, thx for trying out my code, I was really happy to see it in such a great script...
However, I was taking a look at my code, and I saw several flaws in it. Like I said, I wrote it kind of in a hurry...
For example, if you would run out of scrolls, the script would go into a loop making pens until your resource container was full...
Same thing would happen if your secure was full of books...
Anyways, I re-wrote some of the code, and improved it a little bit, and also fixed these issues.
So here goes the fixed version of the code.
First of all, you should change "sub button2" back to it's original form, my code won't use it anymore.
sub button2
set #menubutton n/a
menu delete status
menu window color white
menu text status 40 245 PAUSED
while #menubutton = n/a
wait 10
gosub #menubutton
return
What I did change was "sub getpen". It should be changed to this:
sub getpen
if #menubutton <> n/a
gosub #menubutton
menu delete status
menu text status 40 245 Getting Pen
finditem pbg C_ , %resource
if #findcnt < 1
{
if %tinker = #true
{
menu delete status
menu text status 40 245 Making Pens
gosub frneopen
return
}
menu delete status
menu text status 40 245 Out of Pens
set #menubutton button2
event ExMsg #charID 3 0 GET MORE PENS and hit RESUME
return
}
Exevent Drag #findid
Wait 10
Exevent Dropc #BACKPACKID
wait 10
finditem pbg C_ , #BACKPACKID
wait 10
while #findcnt < 3
{
finditem pbg C_ , %resource
if #findcnt < 1
{
menu delete status
menu text status 40 245 Out of Pens
set #menubutton button2
event ExMsg #charID 3 0 GET MORE PENS and hit RESUME
return
}
Exevent Drag #findid
wait 10
Exevent Dropc #BACKPACKID
wait 10
}
set #menubutton BUTTON4
return
And also, I redid the rest of the code in accordance to these changes, so the previous version I posted here should also be deleted. This is the new version of the code, and should be inserted anywhere in the script:
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++
sub frneopen
namespace push
namespace local frneopen
set !ingots ENK
set !tinker JTL
set !pen PBG
finditem !ingots C_ , %resource
if #findcnt < 1
{
namespace pop
return
}
if #findstack > 30
{
exevent drag #findid 30
wait 20
exevent dropc #backpackid
wait 20
}
if #findstack <= 30
{
exevent drag #findid #findstack
wait 20
exevent dropc #backpackid
wait 20
}
finditem !tinker C_ , #backpackid
if #findcnt < 1
{
namespace pop
return
}
if #findcnt = 1
{
finditem !ingots C_ , #backpackid
if #findcnt < 1
{
namespace pop
return
}
finditem !tinker C_ , #backpackid
set #lobjectid #findid
event macro 17
wait 25
gosub frneowait generic_gump
}
frneotinker:
finditem !tinker C_ , #backpackid
if #findcnt < 2
{
finditem !ingots C_ , #backpackid
if #findcnt < 1
{
namespace pop
return
}
set !clickx #contposx + 30
set !clicky #contposy + 130
click !clickx !clicky f
gosub frneowait generic_gump
set !clickx #contposx + 235
set !clicky #contposy + 130
click !clickx !clicky f
gosub frneowait generic_gump
goto frneotinker
}
finditem !tinker C_ , #backpackid
set #lobjectid #findid
event macro 17
wait 25
gosub frneowait generic_gump
frneopen:
finditem !ingots C_ , #backpackid
if #findcnt < 1
{
namespace pop
return
}
finditem !pen C_ , #backpackid
if #findcnt < 4
{
finditem !ingots C_ , #backpackid
if #findcnt < 1
{
namespace pop
return
}
set !clickx #contposx + 30
set !clicky #contposy + 130
click !clickx !clicky f
gosub frneowait generic_gump
set !clickx #contposx + 385
set !clicky #contposy + 270
click !clickx !clicky f
gosub frneowait generic_gump
set !clickx #contposx + 385
set !clicky #contposy + 270
click !clickx !clicky f
gosub frneowait generic_gump
set !clickx #contposx + 235
set !clicky #contposy + 110
click !clickx !clicky f
gosub frneowait generic_gump
goto frneopen
}
finditem !ingots C_ , #backpackid
exevent drag #findid #findstack
wait 20
exevent dropc %resource
wait 20
namespace pop
return
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++
sub frneowait
namespace push
namespace local frneowait
wait 10
set !timeout #SCNT
waitforgump:
if #contname = %1
{
namespace pop
return
}
if #SCNT > !timeout + 5
{
finditem JTL C_ , #backpackid
set #lobjectid #findid
event macro 17
wait 25
namespace pop
return
}
goto waitforgump
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++
And last, I added a "switch code" for the tinker option. So, if you want to use the tinker option, you should add this to the very beginning of the script:
set %tinker #true ; can be changed to #false if you don't want to craft pens
So, I guess the issues I could think of are all covered in this new code... If any bugs should still appear, I'd be more than happy to try and help fix them...
Sorry for the inconvenience of having to change the code again...
And thanks again for giving it a try...
Cheers!
EDIT 08/01: Added a security code to the gumpwait sub to avoid endless loops, in case something weird happens while you're crafting and you lose your gump... Also fixed some flaws in case for some reason you ran out of ingots in the middle of crafting....
EDIT 08/02: Used namespace to avoid any possible issues with var names...