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.


Topics - Boydon

Pages: [1]
1
UO Client Modifications/Tools / Boydon's ID Converter
« on: May 15, 2015, 01:03:05 PM »
Hello everybody, Boydon here.
I just want to share with everyone a little and simple tool that I originally developer for my personal use, but that lately has saved me a lot of time: an ID converter between different formats.

Using this tool you can easily migrate script from different platforms. As you can see from the image preview the tool is quite simple; you past one or more ids in the fields and you covert it to the other formats. If you need you can also copy the result of conversion at the moment of conversion.

I am open if someone has ideas for new features. Here (courtesy of TM) you can find a multi antivirus scan result of the attached file (just to be sure).

Hope you enjoy it!
Oh and if there is any volunteer I am looking for a better icon. :D




View Screen Capture

2
Stealth Client / [Release] Stealth Python wrapper [UPDATED 2014-08-21]
« on: October 25, 2013, 03:47:57 AM »
Hello everybody,

the first release of Python wrapper for stealth is now available in the beta repository of Stealth:
https://bitbucket.org/Stealthadmin/stealth-beta-client/downloads

It was developed to be full compliant with the standard Python implementation already embedded within Stealth: in this way people can recycle already developed code while having the full power of Python.

I developed it using Python 3.X, but the code should be cross compatible with Python 2.7 (although I didn't have enough time to test it). Not all the function have been tested so please report any bug you meet.

Once you have imported it, you need to compile your .py project with your favorite freeze tool (cx_Freeze is my favorite) to be able to run it in Stealth.


Changelog
---------- 2014-08-03 ----------
Changed:
- Renamed StartStealthPipeInstance to StartStealthSocketInstance for compatibility with Stealt 6.5.2 and addes some backward compatibility


---------- 2014-08-03 ----------
Added:
- GetMoveTroughNPC
- SetMoveTroughNPC
- StealthPath

Fixed:
- The following methods are now returning a list and not a single CR/LF separed string
    + GetContextMenu
   + GetGumpButtonDescription
   + GetGumpFullLines
   + GetGumpShortLines
   + GetGumpTextLines
   + GetLastMenuItems
   + GetMenuItems
   + GetShopList
- TStaticItemRealXY is now correctly declared
- AddToSystemJournal arguments are handled correctly
- Added the missing Tile filed to the TStaticItemRealXY
   
Changed:
- Renamed TStaticCellRealXY into TStaticItemRealXY


---------- 2014-04-15 ----------
Added:
- StartStealthPipeInstance
- CorrectDisconnection
- FindTypesArrayEx
The first two method are now needed to start external scripts.

Removed:
- StelathPath
- GetMoveTroughNPC
- SetMoveTroughNPC
All this methods are not public yet and will be available with the next stealth release.

Fixed:
- GetStaticArtBitmap
- FoundedParamID
- SetStatState (thx Encelar for this)


---------- 2014-01-03 ----------
Added:
- GetMoveOpenDoor
- SetMoveOpenDoor
- ClearInfoWindow
- FillInfoWindow
- ClearSystemJournal

Removed:
- ConvertFlagsToFlagSet (better implementation is needed)

Fixed:
- fixes suggested from slyone at http://www.scriptuo.com/index.php?topic=11704.msg100039#msg100039
- some code cleaning

3
Stealth scripts / [Python] Simple suite totalizer
« on: August 17, 2012, 01:17:16 PM »
This is a very fast and simple yet useful script that will sum up all the caracteristics of the items you are currently wearing in less that 60 rows of code. :)
Intended to be used with Python 3.x

Code: [Select]
""" This small script will calculate the summ of the suite your char is currentrly wearing.
This will only run in Python 3.x"""

import stealth
import re

uo_layers = (ArmsLayer(), BeardLayer(), BraceLayer(), CloakLayer(), EarLayer(), EggsLayer(), GlovesLayer(), HairLayer(), HatLayer(), LegsLayer(),
LhandLayer(), NeckLayer(), PantsLayer(), RhandLayer(), RingLayer(), RobeLayer(), ShirtLayer(), ShoesLayer(), TalismanLayer(), TorsoHLayer(),
TorsoLayer(), WaistLayer())

properties = {}

def to_sum_up(prop : 'string') -> 'Boolean':
""" This sub will be used to get rid of unwanted properties like 'Insured' or such.
As argument it is expecting a string and it will retur either True (if the property should not be ignored) or False"""

# strigs to be ignored in tooltip. Add new if missing
ignores = ['Insured', 'durability', 'Weight', 'artifact rarity', 'strength requirement', 'two-handed weapon', 'skill required']

for ignore in ignores:
if prop.find(ignore) != -1 or prop == '':
break
else:
return True

return False

def sum_props(dressed_layers : 'dict') -> 'dict':
""" This sub will sum all the properties together.
As argument it is expeting a dictionary in this format {layer:[raw properties,]}
It is returning another dictionary with this format {prop name : total value}"""

totals = {}

# Property regex
reProps = re.compile(r"([a-zA-Z ].+?)[+]{0,}([\d]{1,})(%{0,1})")
for layer in dressed_layers:
if dressed_layers[layer]:
item = dressed_layers[layer][0]
props = dressed_layers[layer][1:]
for prop in props:
match = reProps.search(prop)
if match:
prop_name = match.group(1).strip()
prop_value = match.group(2)
totals[prop_name] = totals.get(prop_name, 0) + int(prop_value)

return totals

for uo_layer in uo_layers:
weared = ObjAtLayer(uo_layer)
if weared > 0:
properties[hex(uo_layer)] = [] + [x.strip() for x in GetTooltip(weared).split(' | ') if to_sum_up(x)]

totals = sum_props(properties)

for prop in sorted(totals.keys(), key=str.lower):
print(prop + ' --> ' + str(totals[prop]))

4
If you've ever tried to use tkinter from stealth you've probably found that it gives you a strange and bad error.

I'll try to make a sample to explain.
This is very basic sample that will run in a clean python 3.2 environment:
Code: [Select]
from tkinter import *

class App:

    def __init__(self, master):

        frame = Frame(master)
        frame.pack()

        self.hi_there = Button(frame, text="Hello", command=self.say_hi)
        self.hi_there.pack(side=LEFT)

    def say_hi(self):
        print ("hi there, everyone!")


root = Tk()

app = App(root)

root.mainloop()

If you run it int stealth you'll get this error:
Quote
16:04:58:079 []: File "C:\Python32\Lib\tkinter\__init__.py", line 1669, in __init__
baseName = os.path.basename(sys.argv[0])
AttributeError: 'module' object has no attribute 'argv'

So the only way you have to go is to force sys.argv to an empty list:
Code: [Select]
from tkinter import *
import sys

class App:

    def __init__(self, master):

        frame = Frame(master)
        frame.pack()

        self.hi_there = Button(frame, text="Hello", command=self.say_hi)
        self.hi_there.pack(side=LEFT)

    def say_hi(self):
        print ("hi there, everyone!")

sys.argv = [""]

root = Tk()

app = App(root)

root.mainloop()

I think this is a bug in stealth, but in the way showed before you can bypass it. :)

Thanks to Crome969 that pointed out the problem and gave me an idea on how to solve it. :)

5
Stealth Client / How to debug Python Scripts
« on: February 19, 2012, 10:24:10 AM »
Hello everyone,

I'm going to show how you can debug yours Stealth scripts written in Python using Pydev.
If you have any question or something is not clear please let me know.

This guide has also been posted on the official stealth board, but I'm posting it here cause on their board the majority of user-base is russian.

Prerequisites

  • Any PC able to run the Eclipse IDE (this is the platform on the top of witch we'll run our debugger);
  • The Python environment compatible with Stealth (for this tutorial I've used 2.7.x, but this has also been tested and proved to work with 3.2.x with some small changes). If you're reading this probably you know what I'm speaking of :D;
  • Pydev extension for Eclipse (this is where the sweet part of debug takes place ;)). At the moment of writing I'm using 2.4 version.
Preparation Steps

Installing Eclipse

Download a version of Eclipse that suits your PC and install it (for this tutorial I've used the Eclipse IDE for Java EE Developers).

Installing PyDev on top of Eclipse


Configuring PyDev

Add the Python interpreter
  • From the menu choose Window -> Preferences


    View Screen Capture
  • Expand the PyDev tree (step 1), choose "Interpreter Python" (step 2), click on the "New" Button (step 3) and point Eclipse to your python.exe path (on my machine as you can see is "D:\Python27\python.exe", the screen has been taken after configuring so you see the result of it).


    View Screen Capture

Add the PyDev perspective to Eclipse


Add the remote debugger start and stop buttons

  • Be sure to be in PyDev perspective and click on a empty spot on you toolbar and from the menu choose "Customize Perspective...";


    View Screen Capture
  • In the "Commands Group Availability" tab put the check on the PyDev Debug option;


    View Screen Capture
  • Now you should see the remote debugging buttons in you toolbar:


    View Screen Capture
  • Click on the green one and start the remote debugger (you can be sure that the debugger is started checking at the bottom of Eclipse interface in the Console log).


    View Screen Capture

Make Stealth interact with PyDev remote debugger

Now that everything is set up in PyDev we need to address Stealth to interact with it.

Referencing the pysrc module inside Stealth installation

  • The first thing to make here is to find where the original pysrc module (bundled inside PyDev) has bee installed on our machine. The path changes depending on the installation. Typically it is in a sub folder of the Eclipse installation; in my machine it was ...\eclipse\plugins\org.python.pydev.debug_2.3.0.2011121518\pysrc on your machine should be something very similar.
  • Once you've found it make a copy of the whole pysrc folder and place it wherever you like it. On my machine i putted it in the following path "D:\stealth\script\pydebug\pysrc" being "D:\stealth\" the path where my Stealth installation resides;
  • Now go inside the newly created directory ("D:\stealth\script\pydebug\pysrc") and create a new empty file and name it "__init__.py".

Call the Remote Debugger from within you code

Now everything is ready and you only need to make your script aware of the remote debugger. To make this happen add this snippet in the header of your Python script (I'm going to comment it line by line later on) before launching it from Stealth (not PyDev!):
Code: [Select]
REMOTE_DBG = True

if REMOTE_DBG:
sys.path.append('D:\\stealth\\script\\pydebug')
sys.path.append('D:\\stealth\\script\\pydebug\\pysrc') #this is only needed if you run Python >= 3.2.x
print str(sys.path)
import pysrc.pydevd as pydevd
pydevd.settrace('localhost', stdoutToServer=True, stderrToServer=True)
Code: [Select]
REMOTE_DBG = TrueHere you define a Boolean variable to be able to switch the debugger as you like (see the if condition soon after after)

Code: [Select]
sys.path.append('D:\\stealth\\script\\pydebug')
sys.path.append('D:\\stealth\\script\\pydebug\\pysrc') #this is only needed if you run Python >= 3.2.x
Those two lines are really important. They are the lines that tells to Python where to look for the pysrc module that we have created in the step before. As you can see (the first of the two lines) is the parent directory of the one where we copied the pysrc module "D:\stealth\script\pydebug\pysrc" and the slash characters are escaped. To be sure that the path has been correctly added we also issue a print statement (you can never be sure... :P). If you are using Python 3.2.x you also need to explicitly specify the pysrc folder; this is due to differences in the way that Python 3.x handle the imports.
Code: [Select]
import pysrc.pydevd as pydevdHere you import the pydevd class from the pysrc module. If you have an error here you did not added the pysrc path correctly in the previous step.
Code: [Select]
pydevd.settrace('localhost', stdoutToServer=True, stderrToServer=True)This line will try to connect Stealth to the remote debugger (be sure to have started it) so you can start debugging. If everything is set up correctly you'll be prompted for where to find the script to debug: point it to you current script folder, swith to the Debug Perspective and you are done. :)

Known Issues
PyDev, will only promt you one time asking where to look for debug source and then will save the location and use it for following debug sessions. This is good if you are debugging the same script, but if you want to debug another script you'll have to make the following steps:

Credits and references

References
This guide has been inspired from the following pages:

Credits
Thank to Alex (from the Stealth comunity) that in this post gave me the initial tips on how to start.
Thanks to Crome969 that pointed out troubles with Python 3.2.x

6
New member introductions / Hi to everyone.
« on: December 30, 2008, 09:46:58 AM »
Hi to everyone!

I read about this site on UOAI board and it seems to be very interesting although it is not possible to run scripts yet.

I'm a very old UO player and EasyUO scripter (most of my work is published in their site) and I've been waiting for OpenEUO for a long time now and I belive it will never see the light so I'm very interested in projects like this and UOAI.

I hope I'll find my way to contribute also here.

Tank you.
Bye. :)

Pages: [1]