Author Topic: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!  (Read 26716 times)

0 Members and 1 Guest are viewing this topic.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • 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: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
0
Code: [Select]
---------------------------------------------------------------
-- Script Name: TrailMyx's Subroutine Collection
-- Author: TrailMyx
-- Version: v8
-- Shard OSI / FS: unk
-- Revision Date: 9/29/2010
-- Purpose: Collection of routines to help the scripter automate UO
--
--          TM_SecondTimer
--            local timer = TM_SecondTimer:New{duration = 5} -- creates a 5 SECOND non-blocking countdown timer (automatically starts)
--            timer:Start(10) -- restarts existing timer with new time
--            timer:Check() -- returns true if time has expired, false otherwise
--
--          TM_msTimer
--            local timer = TM_msTimer:New{duration = 50} -- creates a 50 MILLISECOND non-blocking countdown timer (automatically starts)
--            timer:Start(500) -- restarts existing timer with new time
--            timer:Check() -- returns true if time has expired, false otherwise

--          TM_IDtoEUO(id) -- converts an OEUO numerical ID value to the classic EUO base-26 text value
--          TM_EUOtoID(str_in) -- converts the classic EUO base-26 item id into an OEUO-compatible numerical ID value
--
--          TM_ItemInfo -- includes all necessary item information as returned by UO.GetItem
--            TM_FindItemsByID(id) -- locates items by ID (either EUO or OEUO format)  Returns count and table of items
--            TM_FindItem(ids, locations, containers, dist, ignore) -- locates multiple IDS/TYPES on either ground or container, and at specific distances
--                                                                     return count(sum of items), stacks(sum of stacks), matches(table of all matching items)
--                                                                     ignore - table of items previously ignored
--
--          TM_GumpWait(c1, c2) -- waits for either gump c1 or gump c2 to pop up within 7 seconds.  Returns true on success
--          TM_GumpWaitAndSize(c1, x, y) -- waits for gump c1 that is size (x,y) within 7 seconds.  Returns true on success
--
--          TM_IgnoreItem(ignore, findid) -- maintains an "ignore" list.  This table can be passed to TM_ItemInfo
--
--          TM_OpenPaperdoll(x,y)
--          TM_OpenStatusBar(x,y)
--          TM_OpenBackPack(x,y)
---------------------------------------------------------------

This is going to be my main subs distribution file for those functions that don't have a specific location.  I will implement a version number query subroutine so that you can make sure you are using the expected version of this file.  Didn't do that yet.

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
tm_subs_collection9.lua
« Last Edit: October 29, 2010, 07:42:05 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • 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: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Subroutine collection foro OEUO
« Reply #1 on: August 30, 2010, 12:45:02 PM »
0
I forgot to add in the color matching for this.  It would be nice for this sub to find all your frostwood, and sum up all the stacks.  ;)

Really, it's pretty easy to do that by hand, so I might as well leave that be.  I can put up the sample code if you'd like.
« Last Edit: August 30, 2010, 12:48:14 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • 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: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Subroutine collection foro OEUO
« Reply #2 on: August 31, 2010, 01:07:49 PM »
0
I decided this was stable enough to put out into the public.  Enjoy
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • 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: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!
« Reply #3 on: September 13, 2010, 11:33:21 PM »
0
Playing with OEUO is much easier with these routines, especially if you need to use the finditem function.  With the property information also embedded within each item, you have a very powerful toolset.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • 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: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!
« Reply #4 on: September 15, 2010, 08:55:00 AM »
0
Another nice feature of these functions is the non-blocking timers.

Code: [Select]
local timer = TM_SecondTimer:New{duration = 5} -- creates a 5 SECOND non-blocking countdown timer (automatically starts)
 while timer:Check() == false do
   -- do something else until timer fires.
 end

 if timer:Check() == true then
   print("your timer expired for some reason")
 end
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • 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: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!
« Reply #5 on: September 30, 2010, 10:32:16 AM »
0
Version 7:
Added IGNOREITEM feature into TM_FindItem.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +786
  • Referrals: 1
    • View Profile
Re: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!
« Reply #6 on: September 30, 2010, 05:20:49 PM »
0
Version 7:
Added IGNOREITEM feature into TM_FindItem.


Twinkle McNugget is just getting spoiled rotten these days.. ;)
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • 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: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!
« Reply #7 on: September 30, 2010, 06:30:27 PM »
0

Twinkle McNugget is just getting spoiled rotten these days.. ;)

Lol, yeh.  It's time to start put'in out!

Also included in these subs:

TM_OpenPaperdoll(x,y)
TM_OpenStatusBar(x,y)
TM_OpenBackPack(x,y)

The names are explanatory.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • 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: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!
« Reply #8 on: September 30, 2010, 06:51:39 PM »
0
BTW, upgraded to V8.  I released without testing...  Oops.  Works now for TM_IgnoreItem
« Last Edit: September 30, 2010, 06:57:15 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!
« Reply #9 on: October 01, 2010, 06:08:20 AM »
0
Version 7:
Added IGNOREITEM feature into TM_FindItem.


Twinkle McNugget is just getting spoiled rotten these days.. ;)

My cancer treatment comes before UO.  Sorry. :)  The last 2 days I've been at the docs for 8+ hours each.  I have to go Saturday too, then I should be free for 5 days or so.  We'll see.  Yesterday was a benedryl filled day where I slept with the laptop on my lap most of the day. heh

Offline NObama

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +325
  • Referrals: 2
    • View Profile
Re: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!
« Reply #10 on: October 13, 2010, 09:21:45 PM »
0
Ok, I don't understand.

If I want to use this to, say, find and count all powder of fort in containers near my character...I think this is the syntax:

Code: [Select]
count = TMFindItem (4102)
if count > 0 then
  print("Found:"..count)
end 

What I don't understand is how to call the subroutine library...plus, I'm not entirely sure I've got the syntax right above...

*head hurts, time for bed*

 :-[

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • 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: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!
« Reply #11 on: October 13, 2010, 10:46:33 PM »
0
Please take a look at the sample code that's included in the comments.  But you're looking for something like this:

Code: [Select]
dofile("tm_subs_collection8.lua")

temp = {} -- will contain all found items as objects (see tm_subs_collection8.lua for a description of all information stored in the object)
count = 0 -- this is the count.
count, temp = TM_FindItemsByID(4102) -- you can also have a string here representing the EUO-style value like "POF"
if count > 0 then
  print(string.format("Found = %d",count))
  for x,v in ipairs(temp) do
    print(string.format("Finditem is %d",v.findid))
  end
end


This is untested code since I'm traveling I can't test, but it should be close to working.

BE SURE TO SAVE THIS SNIPPET TO A FILE FIRST!! OTHERWISE OEUO WILL NOT WORK

Similar sample code is in the file to use the full-blown finditem.  Please take the time to go over and see what's inside tm_subs_collection8.lua
« Last Edit: October 13, 2010, 10:49:41 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline NObama

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +325
  • Referrals: 2
    • View Profile
Re: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!
« Reply #12 on: October 14, 2010, 06:25:40 AM »
0
Thanks, TM.  Believe it or not, I did read your comments...I am just completely lost.  EUO syntax made sense to me, this still does not.  I am not sure UO will be around long enough for me to become literate in Lua.

I told myself I was going to successfully code a snippet that would do something simple, like find the Ant Queen.  Then, I discovered how hard that is in OEUO and I died a little inside.

Scrripty

  • Guest
Re: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!
« Reply #13 on: October 14, 2010, 07:06:02 AM »
0
 Its far from all that hard, most people are just overcomplicating it for themselves.  Try to write your own finditem routine so you understand how it works a bit better in oeuo before you try to use tms tools.  They are always a bit more complicated than the new user should start with imo.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • 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: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Subroutine collection foro OEUO - Includes FINDITEM!
« Reply #14 on: October 14, 2010, 09:18:28 AM »
0
Well not in this case. If you know EUO syntax, then these just work.  Everything I've put out so far has the old EUO scripter in mind.
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: OEUO Tools