Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - slyone

Pages: 1 2 [3] 4 5 ... 9
31
Stealth archive / Re: How do you get a target cursor in Stealth?
« on: November 09, 2013, 07:51:57 AM »
Excellent examples, thank you!

For reference, I found the point in the video tutorial that you describe the bag setup.  Also, the ChooseBag function starts on line 43 in Program.cs from the C# tutorial.

Thanks again,
S

32
Stealth archive / How do you get a target cursor in Stealth?
« on: November 08, 2013, 07:34:13 PM »
In my easyuo scripts I like to use the cursor to get the ID of an item I plan to use.  An example of the code I usually use is:
Code: [Select]
set #TARGCURS 1
target ;wait 3s for target cursor to appear
; loop until the player targets an item
while #TARGCURS = 1
    wait 0
; save the id into %myvar
set %myvar #LTARGETID

How would you write similar code in Stealth?

33
Stealth archive / Re: Clarification of TUIWindowType
« on: November 06, 2013, 05:19:23 PM »
Excellent, thank you all for the feedback!

34
Stealth archive / Clarification of TUIWindowType
« on: November 05, 2013, 06:48:10 PM »
What does wtCharProfile refer to?  I've provided some context below.

I see that there is an enum for TUIWindowType.  An example of where TUIWindowType is used is in the Container class in ScriptAPI.cs:

Code: [Select]
#region Container
public class Container : Item
{
    ...

    public void Close()
    {
         Stealth.Script_CloseClientUIWindow(TUIWindowType.wtContainer, _id);
    }
}
#endregion

The TUIWindowType includes
Code: [Select]
wtCharProfile, wtContainer, wtPaperdoll, wtStatus
wtContainer is used in the example above.

wtPaperdoll and wtStatus are pretty self explanatory.  I could close my paperdoll and my status bar by doing the following:

Code: [Select]
Stealth.Script_CloseClientUIWindow(TUIWindowType.wtPaperdoll, Stealth.Script_GetSelfID());
Stealth.Script_CloseClientUIWindow(TUIWindowType.wtStatus, Stealth.Script_GetSelfID());

So what does wtCharProfile refer to?

Thanks,
S

35
Stealth Snippets\Library / [V6.1.3, Python] Script Snippet
« on: November 03, 2013, 07:59:49 PM »
I haven't seen many Python script snippets using Stealth so I figured I'd post a simple example.  Hopefully this helps other people who are getting into Stealth and want to use Python.

Below is a snippet that opens your character's backpack and then opens all of the backpacks within your characters backpack.  Copy and paste the code into a text file with the .py extension.  Then load it up in Stealth and run it.

Code: [Select]
import stealth

stealth.AddToSystemJournal("Begin")

#Open Backpack
backpackID = stealth.Backpack()
stealth.UseObject(backpackID)
stealth.Wait(1000)

#Find all backpacks within your backpack
backpackType = 0x0E75
allColors = 0xFFFF

# Search character backpack for backpacks of all colors, don't search recursively
stealth.FindTypeEx(backpackType, allColors, backpackID, False)

#Loop over all backpacks found and open them
result = stealth.GetFindedList()
stealth.AddToSystemJournal("Backpacks found:\t%d" %(stealth.FindCount()))
for bpID in result:
    stealth.UseObject(bpID)
    stealth.Wait(1000)
   
stealth.AddToSystemJournal("All Done")

I'm using Python 2.7 but this snippet should work in either Python 2.x or Python 3.x.


36
One of my co-workers showed me this website today. 

http://www.informationisbeautiful.net/visualizations/million-lines-of-code/

It's a visualization comparing the number of lines of code of various software projects.  My software engineering classes taught me not to use lines of code as a metric for software development but I thought the visualization was pretty interesting all the same.  Someone had to be misquoted for the last entry for 500 million lines of code.

37
Scripting Chat / Re: Wearable item id list
« on: October 26, 2013, 04:10:10 PM »
I don't have the list but from this post at easyuo.com there is a database you can search by name.  I just typed in "shirt" in the search box on the item type db.  It produced a list of all the types that contained "shirt".  This may be one way of getting a list of the items you are interested in.

38
Thanks for posting this wrapper.

I just loaded it up in Eclipse PyDev and saw an error in reference to 
Code: [Select]
TTilePichueI see the disclaimer of the Tile wrapping not being complete and this may be part of what you were referring to but I thought I'd post in an effort to be helpful.  I also don't know all the differences between Python3.x and Python2.x.  I currently run with Python2.7 and the error I see in PyDev may not be an error in Python3.x.  Anyways, I haven't tried to test this specific code in a script yet to see if it fails at these locations due to Python's case sensitivity.  So hopefully I'm not crying wolf.

On line 407 you defined the
Code: [Select]
class TTilePichue(Structure): with lowercase 'hue' and then you refer to a
Code: [Select]
TTilePicHue with uppercase 'Hue' on lines 1376, 1378, 1379, and 1380.  Then you refer to a
Code: [Select]
ttilepichue all lowercase on lines 1382 and 1383. 

Here are the lines I'm refering too:
Code: [Select]
407 class TTilePichue(Structure):
408     _pack_ = 1
409     _fields_ = [
410         ('x', c_int),
411         ('y', c_int),
412         ('id', c_int),
413         ('color', c_int),
414         ('Page', c_int),
415         ('ElemNum', c_int),
416    ]

Code: [Select]
1376        # TilePicHue : array of TTilePicHue
1377        if tmp.value > 0:
1378            # print('TilePicHue : array of {} TTilePicHue'.format(tmp.value))
1379            gump_elements = (TTilePicHue * tmp.value )()
1380            memmove(addressof(gump_elements), addressof(byte_array) + stream_position, ( sizeof(TTilePicHue) * tmp.value ))
1381            Result['TilePicHue'] = [
1382                {'x' : ttilepichue.x, 'y' : ttilepichue.y, 'id' : ttilepichue.id, 'color' : ttilepichue.color,
1383                'Page' : ttilepichue.Page, 'ElemNum' : ttilepichue.ElemNum, } for ttilepichue in gump_elements]
1384            stream_position += sizeof(TTilePicHue) * tmp.value

Thanks again.

-S

39
Stealth archive / Re: Documentation on FindTypesArrayEx?
« on: October 25, 2013, 04:45:57 PM »

40
Stealth archive / Documentation on FindTypesArrayEx?
« on: October 24, 2013, 06:29:04 PM »
I've been working through each of the functions in Orich's ScriptAPI.cs and am interested in the following FindItems() method:

Code: [Select]
        /// <summary>
        /// Searches for items of Types[], in Containers[], and of Colors[]
        /// </summary>
        /// <param name="Types">Array of Item Types to search for</param>
        /// <param name="Containers">Array of Containers to search in [new uint[] = {0x00000000};] for Ground</param>
        /// <param name="Colors">Array of Colors to search for [new ushort[] = { 0xFFFF };] for all colors</param>
        /// <param name="Recursive">[Optional] Search Sub-Containers Recursively [Default: False]</param>
        /// <returns>List of Items Found</returns>
        public static List<Item> FindItems(ushort[] Types, uint[] Containers, ushort[] Colors, bool Recursive = false)
        {
            Stealth.Script_FindTypesArrayEx(Types, Colors, Containers, Recursive);
            uint[] findlist = Stealth.Script_GetFindList();
            List<Item> AllList = new List<Item>();
            foreach (uint item in findlist)
                AllList.Add(new Item(item));
            return AllList;
        }

I'm not the most fluent in C# so if my questions/observations are wrong please correct me.

I see three FindItems methods in the Find class.
1)
Code: [Select]
public static Item FindItem(ushort Type, uint Container = 0x00000000, bool Recursive = false, ushort Color = 0xFFFF)  Purpose:  Return the last item found of the type specified.

2)
Code: [Select]
public static List<Item> FindItems(ushort Type, uint Container = 0x00000000, bool Recursive = false, ushort Color = 0xFFFF)  Purpose:  Returns the list of Item instances returned by GetFindedList().

3)
Code: [Select]
public static List<Item> FindItems(ushort[] Types, uint[] Containers, ushort[] Colors, bool Recursive = false)  Purpose: 
Quote
Searches for items of Types[], in Containers[], and of Colors[] - From Orich's Summary comment.

I think my understanding of the first two FindItems methods is solid but I can't find more documentation on the third.  From Orich's code in ScriptAPI.cs, a call is made to the function:
Code: [Select]
Stealth.Script_FindTypesArrayEx(Types, Colors, Containers, Recursive);
I can't find this function listed in the Stealth Doc:Api.

The first two methods have default values for Container, Color, and Recursive while the third handles Lists which, I guess, don't lend themselves to the default parameters of 0x0000, and 0xFFFF.  I found a suggestion on StackOverflow for passing an empty array as a default value.

Does anyone have anymore details on the Stealth.Script_FindTypesArrayEx() function?

When calling the Stealth.Script_FindTypesArrayEx() function, do I need to set the Container parameter to a list with the first entry as 0x0000 to search the ground and set the Color parameter to a list with the first entry of 0xFFFF to search all colors?

Thanks for the help, this code is awesome!

-S


NOTE:  I dowloaded ScriptAPI.cs from Orich's C# Tutorial.  If there is a more up to date version of it posted somewhere else please let me know.

41
First, thanks to Orich for putting the time in to make the awesome tutorials.

I thought it might be helpful to post some reference information concerning Visual Studio since Orich uses VS2012 in his tutorial.  Note:  I've mostly used Visual Studio Express editions for C++ projects in the past.  My first introduction to C# was from Orich's tutorial. 


Multiple Versions of Microsoft Visual Studio
Microsoft's Recommendation
I have run into issues in the past with compatibility of multiple Microsoft Visual Studio installations on my computer.  To avoid compatibility issues, I recommend following Microsoft's advice: 

Quote
We recommend that you install Visual Studio versions in the order in which they were released. For example, install Visual Studio 2010 before you install Visual Studio 2012. -http://msdn.microsoft.com/en-us/library/ms246609.aspx

.NET Compatibility
When I downloaded Orich's sample oRune code, I noticed that his solution was saved in VS2012.  Then I went back and read his post more closely and sure enough he lists the code as

oRune Project   oRune BitBucket Project    Full VS2012 Source Code

I tried to open the oRune solution file and it seemed like my computer just sat there and did nothing.  So I tried opening VS2010 and opening the solution file from the file->open menu and I was prompted that it was an incompatible file version.  Well I wasn't going to let Visual Studio stop me from getting started.  Visual Studio Solution and Project files are just text files so I opened the solution file up in Notepad++ and changed the version number from
Code: [Select]
Microsoft Visual Studio Solution File, Format Version 12.00to
Code: [Select]
Microsoft Visual Studio Solution File, Format Version 11.00This change tricks Visual Studio into thinking the solution file is a different version.  v11 corresponds to VS2010 while v12 corresponds to VS2012.

After that change, I was able to open the solution with VS2010.  Then I got a message stating that I did not have the .NET Framework 4.5 installed.  Again I double checked Orich's post but this time his post for the .NET dll.  Sure enough it requires .NET 4.5. 

Built on .NET 4.5 (Requires 4.5)

So I set out to figure out how to get .NET 4.5 installed.

I looked into downloading VS2012 and saw that it installs .NET Framework 4.5.  As a result of a couple Google searches on .NET framework compatilibity and VS2010 and VS2012, I found a good StackOverflow post discussing that very topic.  Basically, my understanding is that VS2010 can be compatible upgrading to .NET Framework 4.5 if you install VS2010 service pack 1.  I checked "Windows Update" for VS2010 SP1 and was able to update.  I also searched around and found a download for VS2012 Express edition along with its update.

After installing VS2012 with .NET Framework 4.5, I was able work through Orich's tutorial and get it working on my computer.

In summary:
1)  Installing multiple versions of Visual Studio on your computer can create compatibility issues.  These issues can be avoided if you follow the advice from Microsoft and install Visual Studio versions in the order of their release. 
2)  If you have VS2010 already and install VS2012, the .NET Framework 4.0 will be replaced by .NET Framework 4.5 and you will need to install VS2010 SP1 to make sure VS2010 can still see the .NET Framework 4.0.

Below are some helpful links to Visual Studio downloads:
2013 Express
2012 Express
2012 Express Update
2010 Express
2008 Express (C++)

For the Moderators:  If you think this post is in the wrong board please move it as you see fit.

42
Crafting / Re: Runebook Copier
« on: July 17, 2013, 05:28:41 PM »
It does rename it. Problem is the script renames it again and again again and again again and again

Post Merge: July 17, 2013, 03:20:18 PM
this script works exept it doesn't read the current runebook so i need to manually type in what to name the runes, other than that it works great.  This get so tireing of typing out each rune every time i want to start copying books.  Maybe this code will help you fix it for me.

~snip~


Glad that it is working for you then.  A few posts ago I posted some test code to try and see if the #PROPERTY variable in EASYUO was working properly.  I only meant the test code to be used for debugging.

If #PROPERTY doesn't contain the name you are trying to rename the rune to then the script will go into a loop.  On some free shards, the event property doesn't populate #PROPERTY with reliable info.  This sounds like it may be the problem you were experiencing.  

The script may try to rename the rune a couple of times in a laggy situation but normally it renames the rune within a try or two.  As for reading the names of the rune book, I initially stayed away from the optical character recognition (OCR) code.  Gonzo's script uses Kal's OCR subs.  I tried to use them a while ago with no success.  I'll take another look but can't make any guarantees.

-S

43
Crafting / Re: Runebook Copier
« on: July 13, 2013, 03:06:30 PM »
If the text in the box that pops up does not contain the new name of the rune then the #PROPERTY variable is probably unreliable on the shard you are on.  I attached a picture of my message box when I renamed a rune "Brit Bank West".  Does your message box look similar?

44
Crafting / Re: Runebook Copier
« on: June 15, 2013, 11:07:30 AM »
I am having problems with this.  Can anyone help me out?
Script recalls to a spot, marks it, renames the rune, then just loops at renaming the rune.

...

From your intro, http://www.scriptuo.com/index.php?topic=11307.0, you say you play on UO Forever.  I believe on some shards, the #PROPERTY variable in EUO is unreliable.  I'm not sure if this is the case on UO Forever.  You may be having an issue with the event property command on line 99.  To debug your problem, you might try to add a line to display what #PROPERTY contains.  A snippet of the test code would look something like this:

(starting at line 92)
Code: [Select]
      RenameRune:
      set #LOBJECTID #FINDID
      event macro 17 0 ; last object
      wait 10 ; wait for prompt to mark rune
      msg  %runeName . %curRune , $
      wait 10 ; wait for rune to change names
      ; check that the rune actually was renamed
      event property #FINDID                              <--------- line 99
      display #PROPERTY                                    <--------- Added line
      if %runeName . %curRune notin #PROPERTY
      {
        goto RenameRune
      }

If you add that line and run the script, you should get a message box that displays the contents of the #PROPERTY variable.  The text in the message box should be the rune name.  The script looks for the expected rune name in #PROPERTY.  So if this test works, then we'll have to try something else.  Give this a try and reply with the results.

Thanks,
S

45
Resource Farming / Re: Ter Mur Lumberjack
« on: May 17, 2013, 08:58:09 AM »
ok, after reading the comments, good praises, i decided it may be a little better than Neo's walking lumberjack so i downloaded both parts, ran the 'mytrees.txt' part 2x (for Ter 16 & Mur 16), pasted the script into script at appropriate sections, hit play and i get this little window that pops up says 'Working...' in bright blue font but it never progresses any further.
i'm running OSI shards, and i'll try any and all suggestions.

PS: i really do hate that i seem to find all the glitches in scripts, and if at all possible, i'll run them if they only goof up a little and i'll never complain, especially resource farmers, but when i can't get them to function at all i have to ask for help. You all have really made me feel welcome here and i do sincerely appreciate all the help!!!

Thanks for the reply.  This script should still work.  Please let me know if you end up using it.  I'll admit that I started using Ne's Ter Mur Lumberjacker.  His script http://www.scriptuo.com/index.php?topic=8255.0 is awesome.

Pages: 1 2 [3] 4 5 ... 9