Author Topic: Need Help with my first script  (Read 4547 times)

0 Members and 1 Guest are viewing this topic.

Offline thekidnickTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Activity:
    0%
  • Reputation Power: 0
  • thekidnick has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Need Help with my first script
« on: November 20, 2008, 08:49:28 AM »
0
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

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
smith.txt

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Need Help with my first script
« Reply #1 on: November 20, 2008, 10:45:51 AM »
0
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:
Code: [Select]
wait5

should be:
Code: [Select]
wait 5

and also:
Code: [Select]
  findItem SQWLCOD C_ %Salvage; Checks Items in Salvage bag and Salvages

should be:
Code: [Select]
  findItem SQWLCOD C_ %Salvage ; Checks Items in Salvage bag and Salvages (note the space before the commend semicolon)

and also:
Code: [Select]
if #findct <2

should be:
Code: [Select]
if #findct < 2

and also:
Code: [Select]
findItem ENK C_, %Salvage

should be:
Code: [Select]
findItem ENK C_ , %Salvage ; note the space between the comma and the surrounding text


2. No multiple actions on a line
Code: [Select]
If #maxweight - #weight > 200 continue
If #maxweight - #weight < 200 goto OVERWEIGHT

should be:
Code: [Select]
If #maxweight - #weight > 200
  continue
If #maxweight - #weight < 200
  goto OVERWEIGHT

3. Be sure to name your tags correctly
Code: [Select]
goto IGNOTS:

should be:

Code: [Select]
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:

Quote
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
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline thekidnickTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Activity:
    0%
  • Reputation Power: 0
  • thekidnick has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Need Help with my first script
« Reply #2 on: November 20, 2008, 10:56:00 AM »
0
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?

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Need Help with my first script
« Reply #3 on: November 20, 2008, 02:04:39 PM »
0
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

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.
Code: [Select]
  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.
 
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline thekidnickTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Activity:
    0%
  • Reputation Power: 0
  • thekidnick has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Need Help with my first script
« Reply #4 on: November 20, 2008, 06:36:28 PM »
0
Salvage bag is a single click then options pop up.


Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Need Help with my first script
« Reply #5 on: November 20, 2008, 06:39:31 PM »
0
Can you list the item names that pop up in order?
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline thekidnickTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Activity:
    0%
  • Reputation Power: 0
  • thekidnick has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Need Help with my first script
« Reply #6 on: November 20, 2008, 06:41:04 PM »
0
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

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Need Help with my first script
« Reply #7 on: November 20, 2008, 08:06:38 PM »
0
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

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.
« Last Edit: November 20, 2008, 08:12:54 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline thekidnickTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Activity:
    0%
  • Reputation Power: 0
  • thekidnick has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Need Help with my first script
« Reply #8 on: November 20, 2008, 08:36:06 PM »
0
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.

« Last Edit: November 20, 2008, 08:42:07 PM by thekidnick »

Offline thekidnickTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Activity:
    0%
  • Reputation Power: 0
  • thekidnick has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Need Help with my first script
« Reply #9 on: November 20, 2008, 10:37:52 PM »
0
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.

Tags: