ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: thekidnick on November 18, 2008, 09:34:23 AM

Title: New Smith Script
Post by: thekidnick on November 18, 2008, 09:34:23 AM
I have been trying to find a script with no luck so I will be creating one soon unless someone can point me in the right directions.

Basically I am going to Create Royal Circlets over and over.

1.  Select a secure box (will have 100k iron ingots)
2.  Select Salvage bag.


What I want is to drag ingots into the salvage bag, then create about 75 circlets, salvage, drag the ingots from my bag back into my salvage bag, and loop.



I am new to UO scripting but I do not think it will be that hard.
Title: Re: New Smith Script
Post by: TrailMyx on November 18, 2008, 10:37:05 AM
That's a great first script!  Best thing to do is to break down your idea into blocks.  Selecting your secure and the salvage bag is simple: (do for each container)

Code: [Select]
  display ok Please select your container
  set #TARGCURS 1
  repeat
  until #TARGCURS = 0
  set %container #LTARGETID

You'll want to open both of these containers, so you should do (2x)

Code: [Select]
  set #LOBJECTID %container
  event macro 17 ; use last object
  wait 20

After that, you need to find the #FINDTYPE for the tool, and the #FINDTYPE for the circlets. You "use" the tool like you did in the above snippet to open the crafting gump.  After that, you need to click some places.  I think for now I'll let you play a bit, but that'll get you started.

Things you'll need to read up on are:
finditem
exevent DRAG/DROP
click
#CONTNAME/#CONTSIZE for waiting for gumps you want.
Title: Re: New Smith Script
Post by: thekidnick on November 18, 2008, 10:43:33 AM
another quick question.

Can I try scripts without being in UO.  I wanted to try this at work where I have no internet.
Title: Re: New Smith Script
Post by: TrailMyx on November 18, 2008, 11:33:42 AM
Not really.  I do script testing all the time by setting up my own RunUO server on the computer I'm running the client on, so I just connect to my own server located at 127.0.0.1.  That's been my easiest way to test things, but sometimes setting up a RunUO server is a pain if you've never done it before.  They say it's easy, and they are correct but sometimes there are issues.
Title: Re: New Smith Script
Post by: OMGBurgers on November 18, 2008, 04:46:02 PM
I always wondered when a new tailoring/blacksmith script that would use salvage bags would come out :P

If you're just making one simple like that it shouldn't be too tough at all.  Mostly just using finditem and the basic event drag/drop and a little math.  The only obstacle may be the usage of the context menu.
Title: Re: New Smith Script
Post by: thekidnick on November 18, 2008, 08:54:35 PM
So since I dont know anything about scripting more coding this is the layout i came up with tell me what ya think.

SETUP:
1.  Target Secure with Ingots
2.  Target Salvage Bag

Script:
1.  Pull 2500 Ingots from Secure
2.  Place 2500 Ingots in Salvage Bag
3.  Check for Tinker Tool If <2 make 1
4.  Check for Smith Tool If <1 make 1
5.  Use Smith Tool
6.  Create Royal Circlet
7.  Check Salvage Bag item/weight  IF > 100/400 SALVAGE ALL
8.  Move Ingots from backpack to Salvage Bag
9.  If Ingots <1000 Pull 1500 from Secure place in SALVAGE
10. Check SKill if 1200 GO TO 12
11. GO TO 3
12. END
Title: Re: New Smith Script
Post by: TrailMyx on November 18, 2008, 09:19:58 PM
I like how you think about your structure.  Great way to psudocode your script flow; I wish more people were this thoughtful. 

One thing you might want to do is to do a little math when you are looking at dragging ingots from your secure:

1. Note how many ingots you have in your salvage bag ->  %salvage_count
2. Drag 1500 - %salvage_count ingots ; to always give you a total of 1500 ingots.

If you don't do this, then the supply of ingots will explode in your salvage bag.

But if you can get this script working, you'll have a very popular script and can be incorporated into an overall skillgainer.
Title: Re: New Smith Script
Post by: thekidnick on November 18, 2008, 10:04:06 PM
Thanks man.

I was going for 2500 ingots in salvage bag hence <1000 add 1500.
Title: Re: New Smith Script
Post by: thekidnick on November 19, 2008, 05:22:10 PM
After reading for a few hours I jumped in head first.  This is what I have so far tell me what you think.

Also if you could point me in the right directions I have a couple of questions:

1.  How do I use tools?  Tinker and Smith
2.  How do I use my Salvage bag?