ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: thekidnick on November 20, 2008, 08:49:28 AM
-
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?
Here is what i have so far
-
Good first run!
There's a few little "quirks" you'll have to get used to with EasyUO.
1. Spaces required between tokens
So for example:
wait5
should be:
wait 5
and also:
findItem SQWLCOD C_ %Salvage; Checks Items in Salvage bag and Salvages
should be:
findItem SQWLCOD C_ %Salvage ; Checks Items in Salvage bag and Salvages (note the space before the commend semicolon)
and also:
if #findct <2
should be:
if #findct < 2
and also:
findItem ENK C_, %Salvage
should be:
findItem ENK C_ , %Salvage ; note the space between the comma and the surrounding text
2. No multiple actions on a line
If #maxweight - #weight > 200 continue
If #maxweight - #weight < 200 goto OVERWEIGHT
should be:
If #maxweight - #weight > 200
continue
If #maxweight - #weight < 200
goto OVERWEIGHT
3. Be sure to name your tags correctly
goto IGNOTS:
should be:
goto IGNOTS ; be sure to omit the colon.
You should rely on the syntax highlighting of EasyUO and ScriptUO to give you an idea of the correct syntax. ScriptUO syntax checker will help, but may still let some of these pass.
From syntax checker:
Method count: 56
Command count: 56
*** Pass 1 - Label accounting:
*** Warning - GOTO ignots: - Line 67 has no matching tag
*** Warning - GOTO loop: - Line 69 has no matching tag
Subroutine labels = 0
Tag labels = 4
0 Code block(s).
2 Warnings(s) encountered.
*** Pass 2 - Execution [SYNTAXCHECK]
** Error - Line 19: Unknown command wait5
** Error - Line 30: Unknown command wait5
** Error - Line 44: Unknown command MAKE
** Error - Line 48: Unknown command MAKE
** Error - Line 50: Unknown command Use
** Error - Line 52: Unknown command Create
** Error - Line 56: Unknown command SALVAGE
** Error - Line 59: Unknown command wait15
** Error - Line 62: Unknown command wait15
-
Thanks for the pointers. I actually just used notepad while at work.
What about how to use a tool and how to use salvage bag?
-
Well, using anything requires that you know what the #FINDID of the item.
#FINDID values are psudo-unique values assigned to every item/player/mobile in the game. #FINDTYPE values are associated with a specific type of value. For example, Gold has a #FINDTYPE of POF. If you don't know what the #FINDTYPE of a specific item is, you can "double-click" the item while EasyUO is running and you should get the associated #FINDID and #FINDTYPE. There are also scripts out there that will summarize the find information for you. You can use my script to find this information easily HERE (http://www.scriptuo.com/smf/index.php?topic=188.0)
So in order to manipulate an item, you first do a search for the type. In this example, I'll look for the fletching tool which is UFG.
finditem UFG C_ , #BACKPACKID ; using the #FINDTYPE of the item
if #FINDCNT = 0
{
display ok You are out of fletching tools
stop
}
set %fletching_tool #FINDID
set #LOBJECTID %fletching_tool
event macro 17 ; event macro 17 = USE LAST OBJECT
; wait for gump...
; start clicking...
I'm not sure about the salvage bag since I've never used one before. Does anyone know if there's a context menu involved with it? If so, then using it can be a bit more complex. Only a bit, though.
-
Salvage bag is a single click then options pop up.
-
Can you list the item names that pop up in order?
-
I dont know I am at work right now.
I think its just 3:
Salvage All
Salvage Iron
Salvage Cloth
I just always use salvage all
-
It's a bummer that you have to work with the context menu on your first script, because you need to understand that EasyUO is bugged when it comes to using it. EasyUO works great if you are running on RunUO, but there are issues with "exevent popup" on OSI.
I would suggest you look at the EasyUO Wiki information on "exevent popup" to get an understanding of what it does. For your example, you'd want to click the first selection in the menu. However, with the bug for OSI, you actually have to wait for the gump to pop up, and then manually click the correct location. It's pretty dumb.
So I suggest you look at the present documentation, but know it doesn't work as the documentation describes. I would also suggest that you take a look at my code posted here regarding how to manipulate the context menu. You can find that HERE (http://www.scriptuo.com/smf/index.php?topic=30.0)
Edit: In looking at my code, you won't get much from it because it's pretty vague. lol. I use the "exevent popup !findid" without a 4th parameter just to get the gump to pop up. The rest of the code is determining where the gump is at, and then clicking going down the Y-coordinate. Know that there is 18 pixels between each selection. That might help you with the math.
You are in more advanced scripting waters at this point.... Sorry.
-
lol crap Go figure All this just to save 1 ingot per royal circlet.
***EDIT***
Could I get this to work with moving my backpack and my salvage bag to a certain place then using the click method? It sounds it would be hard to make the script work for everyone but it might get it working for me until I figure this out more.
***END EDIT***
I do have another simple question. I thought in reading one the wiki it said try not to use the click method when scripting because it can error out.
With that being said how can i script to use a tool. I understand I can use contPos to move the tinker gump and click, but will this cause my mouse to be inactive? I am wanting this script to be minized while I work on tweaking this script.
-
Well I figured out how to use the salvage bag but its not pretty. If anyone can help me figure out how to do this without tieing up my computer it would be great.
sub Salvage
wait 10
event macro 8 7 ; opens backpack
wait 10
set #CONTPOSX 0
set #CONTPOSY 0
set %clickx #contposx + 67
set %clicky #contposx + 138
wait 10
click %clickx %clicky mc
set %clickx #contposx + 108
set %clicky #contposx + 160
wait 20
click %clickx %clicky mc
return
PS. Your salvage bag must be in the bottom right corner in order for this to work.