;skill set must be 3-4 numbers 1200 means 120.0 ect.
SET %SKILL 1200
gosub menu
menu hide
gosub setup
gosub main
halt

;*************Setup******************
sub Setup
SET #DISPRES N/A
display yesno Do you wish to save the items you make?
if #dispres = yes
set %f 1
else
set %f 0
if #dispres = yes 2
display msg Click ok and target the container you wish to put the stuff in.
set #targcurs 1
tt:
wait 10
if #targcurs = 1
goto tt
set %aaa #cursorx
set %bbb #cursory
SET %LOOP 0
set %gump 0
set %bones guf
set %resources CUI_JJG
set %back %resources
set %kit hag
set %band zlf
key p alt
	event macro 8 1
   	wait 1s
  	 set #contposx 600
   	set #contposy 0

   	event macro 8 7
  	 wait 1s
  	 set #contposx 610
   	set #contposy 339
   	set %mainpack #contid

SET #TARGCURS 1
display msg Click ok and target the item you PRE-MADE
	rest:
	if #targcurs = 1
    	 goto rest
     	SET %X #CURSORX
     	SET %Y #CURSORY
    	 wait 10
finditem #ltargetid c_ , %mainpack
     	wait 5
     	SET %MAKE #findtype
     	set %inicut #findid
finditem KAG_jag c_ , %mainpack
	if #findkind = -1
      	halt
      	set %scissors #findid
    	 SET #LOBJECTID %SCISSORS
    	 WAIT 10
    	 event macro 17
   	 wait 30
     	set #lobjectid %inicut
    	 event macro 22

SET #TARGCURS 1
display msg click ok and target the container with supplies

res:
if #targcurs = 1
goto res

     set %xx #cursorx
     set %yy #cursory
     wait 10
     set %toolbag1 #LTARGETID
     set #lobjectid %toolbag1
     set #nextcopsx 600
     set #nextcopsy ( - 50 )
     event macro 17
     wait 20
     contpos 600 -50
     WAIT 40

tryagain:
finditem %kit C_ , %mainpack
if #findkind = -1
{
gosub gettools
goto tryagain
}
   	set #lobjectid #findid
  	 event macro 17
ensure:
if #contsize = 530_437
	{
	set %gump #contkind
	set %modx 27 + #contposx
set %mody 414 + #contposy
click %modx %mody x1
wait 10
goto ensure
	}

return
;******************Main Sub******************************************
sub Main
top:

chooseSkill TAIL
if #skill => %SKILL 2
Display msg Skill or amount level met
halt
if %once <> 1
{
set %once 1
finditem %bones c_ , %mainpack
if #findid <> x
{
set %found 1
Display mgs Bone Found please target your trash barrel now
set #targcurs 1
wait 10
barrel:
if #targcurs = 1
goto barrel
set %barx #cursorx
set %bary #cursory
}
}
finditem %bones c_ , %mainpack
if #findid <> x && %once = 1
{
set %resources %boneS
event property #findid
	str POS #PROPERTY #SPC
	IF #STRRES >= 4
	GOTO JUMPP
	SET %TEMP2 #STRRES
	event property #findid
	STR LEFT #PROPERTY %TEMP2
STR LEFT #STRRES 1
IF 2 IN #STRRES || 1 IN #STRRES || #findkind = -1
gosub getresource
set %resources %back
}
jumpp:
finditem %resources C_ , %mainpack
	event property #findid
	str POS #PROPERTY #SPC
	IF #STRRES >= 4
	GOTO JUMP
	SET %TEMP2 #STRRES
	event property #findid
	STR LEFT #PROPERTY %TEMP2
STR LEFT #STRRES 1
IF 2 IN #STRRES || 1 IN #STRRES || #findkind = -1
gosub getresource
JUMP:
   finditem %kit C_ , %mainpack
    if #findkind = -1
     gosub gettools

 finditem %kit C_ , %mainpack
   set #lobjectid #findid
   event macro 17
waitforgump:
if #contkind <> %gump
goto waitforgump
wait 5
set %modx 285 + #contposx
set %mody 414 + #contposy
 click %modx %mody x1
wait 45
CHECK:
finditem %make C_ , %mainpack
SET %LOOP %LOOP + 1
if #findid <> x && %LOOP >= 15
{
IF %FOUND = 1
{
GOSUB TRASHIT
GOTO JUMPOUT
}
if %f = 1
{
gosub dropoff
GOTO JUMPOUT
}
set %cut #findid
set #lobjectid %scissors
wait 5
event macro 17
wait 10
SET #LTARGETID %CUT
event macro 22
wait 10
GOTO CHECK
set %loop 0
}
JUMPOUT:
   finditem %band C_ , %mainpack
   if #findstack > 500
{
CLICK 69 454 x1
CLICK 69 454 x1
   finditem %band C_ , %mainpack
   dropoff2:
   event drag #findid
   wait 17
   msg $
wait 20
   click %xx %yy p
 click %xx %yy p
   wait 17
}
goto top
return
******************SEWING KIT GRAB********************
sub gettools
set %loop 0
finditem %kit C_ , %MAINPACK
   if #findID = 1
GOTO ENDTOOL
          getkit2:
finditem %kit C_ , %toolbag1
   if #findkind = -1
     halt
set %loop %loop + 1
SET #LOBJECTID #FINDID
   event drag #LOBJECTID
   click 737 222 p
click 737 222 p
click 737 222 p
   wait 17
if %loop < 1
goto getkit2
ENDTOOL:
return

;***********Resource Grab**************
sub getresource
if #curskind <> 0
goto clickit
set %loop 0
   finditem %resources C_ , %toolbag1
   if #findkind = -1
      halt
   getresource2:
   event drag #findid
   wait 30
   msg 200$
wait 20
clickit:
   click 737 222 p
click 737 222 p
click 737 222 p
   wait 30
return

sub trashit
WAIT 40
FINDITEM %KIT C_ , %MAINPACK
SET #LOBJECTID #FINDID
EVENT MACRO 17 0
WAIT 40
set %modx 27 + #contposx
set %mody 414 + #contposy
 REMOVEIT:
click %modx %mody x1
IF #CONTSIZE = 530_437
{
WAIT 30
GOTO REMOVEIT
}
moretrash:
finditem %make C_ , %mainpack
wait 10
if #findid = x
goto alldone
if #findid <> x
{
set #lobjectid #findid
if #lliftedkind <> 1
 event drag #lobjectid
finditem bkf g_2
drops
click %barx %bary p
click %barx %bary p
wait 20
if #lliftedkind = 1
goto drops
}
goto moretrash
alldone:
return

sub dropoff
set %modx 27 + #contposx
set %mody 414 + #contposy
 REMOVEITT:
click %modx %mody x1
IF #CONTSIZE = 530_437
{
WAIT 30
GOTO REMOVEITT
}

CONTIN:
FINDITEM %MAKE C_ , %MAINPACK
IF #FINDID <> X
{
SET #LOBJECTID #FINDID
IF #LLIFTEDKIND <> 1
EVENT DRAG #LOBJECTID
WAIT 10
CLICK %AAA %BBB P
CLICK %AAA %BBB F
GOTO CONTIN
}
return

sub menu
menu Clear
set #menubutton n/a
	menu Window Title Single Minded Tailor
	menu Window Color Highlight
	menu Window Size 334 164
	menu Font Transparent #true
	menu Font Align Right
menu Font Name Arial
	menu Font Size 10
	menu Font Style
	menu Font Color WindowText
	menu Font Align Left
	menu Font BGColor Highlight
menu Font Color Yellow
menu text 0 240 msg Skill Set
menu Font Color Silver
menu Font BGColor white
	menu Edit skill 295 0 40 120
	menu Shape EUOShape1 224 132 113 33 3 7 1 Black 7 AppWorkSpace
	menu Shape EUOShape2 272 132 21 13 3 7 1 Black 7 Teal
	menu Shape EUOShape3 224 88 113 49 3 7 1 Black 7 CaptionText
	menu Shape EUOShape4 224 52 117 21 2 7 1 Black 7 Silver
	menu Shape EUOShape5 224 64 113 21 3 7 1 Black 7 Gray
	menu Shape EUOShape6 224 84 113 5 3 7 1 Black 7 3DDkShadow
	menu Shape EUOShape7 276 56 13 9 3 7 1 Black 7 Teal
	menu Shape EUOShape8 240 108 17 17 1 7 1 Black 7 InfoBk
	menu Shape EUOShape9 244 112 9 9 1 7 1 Black 7 White
	menu Shape EUOShape10 248 116 5 5 3 7 1 Black 7 Blue
	menu Shape EUOShape11 244 112 5 5 3 7 1 Black 7 Red
	menu Font Name Arial
	menu Font Size 8
	menu Font Style
	menu Font Color WindowText
	menu Font Align Left
	menu Font BGColor Highlight
	menu Text EUOLabel1 224 88 Sewing kit
	menu Shape EUOShape12 292 104 33 25 3 2 1 Black 1 Olive
	menu Text EUOLabel2 284 88 Resources
	menu Font Name Perpetua Titling MT
	menu Font Style b
	menu Font Color Silver
	menu Font Transparent #false
	menu Font BGColor Background
	menu Text EUOLabel3 88 0 Singel Minded Tailor
	menu Shape EUOShape13 168 56 41 37 1 7 1 Black 7 InfoBk
	menu Shape EUOShape14 176 64 9 9 1 7 1 Black 7 Aqua
	menu Shape EUOShape15 188 64 9 9 1 7 1 Black 7 Aqua
	menu Shape EUOShape16 172 80 29 5 2 7 1 Black 7 White
	menu Shape EUOShape17 184 92 5 53 3 7 1 Black 7 White
	menu Shape EUOShape18 160 108 49 5 3 7 1 BtnFace 7 White
	menu Shape EUOShape19 204 100 5 5 3 7 1 BtnFace 7 3DDkShadow
	menu Shape EUOShape20 208 100 5 5 3 7 1 BtnFace 7 3DDkShadow
	menu Shape EUOShape21 204 104 5 5 3 7 1 BtnFace 7 3DDkShadow
	menu Shape EUOShape22 208 96 5 5 3 7 1 BtnFace 7 3DDkShadow
	menu Shape EUOShape23 212 96 5 5 3 7 1 BtnFace 7 3DDkShadow
	menu Shape EUOShape24 212 100 5 5 3 7 1 BtnFace 7 3DDkShadow
	menu Shape EUOShape25 216 100 5 5 3 7 1 BtnFace 7 3DDkShadow
	menu Shape EUOShape26 208 104 5 5 3 7 1 BtnFace 7 3DDkShadow
	menu Shape EUOShape27 212 104 5 5 3 7 1 BtnFace 7 3DDkShadow
	menu Shape EUOShape28 208 108 5 5 3 7 1 BtnFace 7 White
	menu Shape EUOShape29 188 144 5 5 3 7 1 Black 7 White
	menu Shape EUOShape30 192 148 5 5 3 7 1 Black 7 White
	menu Shape EUOShape31 196 152 5 5 3 7 1 Black 7 White
	menu Shape EUOShape32 196 156 5 5 3 7 1 Black 7 White
	menu Shape EUOShape33 196 160 5 5 3 7 1 Black 7 White
	menu Shape EUOShape34 200 160 5 5 3 7 1 Black 7 White
	menu Shape EUOShape35 180 144 5 5 3 7 1 Black 7 White
	menu Shape EUOShape36 176 148 5 5 3 7 1 Black 7 White
	menu Shape EUOShape37 172 152 5 5 3 7 1 Black 7 White
	menu Shape EUOShape38 172 160 5 5 3 7 1 Black 7 White
	menu Shape EUOShape39 172 156 5 5 3 7 1 Black 7 White
	menu Shape EUOShape40 168 160 5 5 3 7 1 Black 7 White
	menu Shape EUOShape41 280 136 5 5 3 7 1 Black 7 White
	menu Font Name MS Sans Serif
	menu Font Style
	menu Font Color Yellow
	menu Font BGColor Highlight
	menu Text EUOLabel4 0 32 2. Set skill level to stop at top of script
	menu Text EUOLabel5 0 20 1. Make 1 of the item you wish the script to make
	menu Text EUOLabel6 0 44 3. Have 1 sewing kit and scissors on you
	menu Text EUOLabel7 0 56 4. Have some resources on you
	menu Text EUOLabel8 0 68 5. Have extra of both in a chest
	menu Text EUOLabel9 12 80 Next to you.
	menu Text EUOLabel10 0 92 6. Start Script and follow prompts
	menu Font Color WindowText
	menu Text EUOLabel11 0 108 You may want a trash barrell for
	menu Text EUOLabel12 0 120 bone items. Script will cut up any
	menu Text EUOLabel13 0 132 like item in pack!!!.
	menu Font BGColor Yellow
	menu Button start 92 136 63 29 Start
	menu Show 0 0
w:
if #menubutton = n/a
goto w
menu get skill
set %skill #MENURES , 0
return