ScriptUO

Scripting Resources & Utilities => Stealth Client => Stealth archive => Topic started by: Vlek on August 19, 2014, 05:41:31 PM

Title: Stealth Python Reference
Post by: Vlek on August 19, 2014, 05:41:31 PM
Can I get a reference for the built-in stealth functions for python? It's in pascal on the website, but that doesn't help too much.

Here's the pascal reference I'm talking about: http://stealth.od.ua/Doc:Manual/Reference
Title: Re: Stealth Python Reference
Post by: Crome969 on August 20, 2014, 12:31:12 AM
Can I get a reference for the built-in stealth functions for python? It's in pascal on the website, but that doesn't help too much.

Here's the pascal reference I'm talking about: http://stealth.od.ua/Doc:Manual/Reference
they are the same. Its just that codesamples are in Pascal because the major use Pascal.
Title: Re: Stealth Python Reference
Post by: Boydon on August 21, 2014, 02:11:04 PM
As Chrome said, they are the same and when I had the chance I also added pythos samples.

Anyway you should have a look at the pydoc (https://docs.python.org/2/library/pydoc.html) module, at the hep() (https://docs.python.org/2/library/functions.html#help) built-in function, at the dir() (https://docs.python.org/2/library/functions.html#dir) built-in function and at the inspect (https://docs.python.org/2/library/inspect.html) module.

You can also output the list in the format you like with a snippet like this:

Code: [Select]
import stealth

stealth_funcs = [stealth.__dict__.get(func) for func in dir(stealth)]

for func in stealth_funcs:
    if callable(func):
        print (func.__doc__)

If you want to contribute, you can add Python samples where missing (as example refer to FindType (http://stealth.od.ua/Doc:Api/FindType)).
Title: Re: Stealth Python Reference
Post by: Vlek on August 23, 2014, 08:02:18 AM
I really don't get why they'd choose to use pascal. The basic "stuffs" that are in a UO game, like items, mobiles, gumps, etc, are all objects that inherit from the basic "thing" or item class. It makes tons more damn sense to make classes and methods for them, and python is a very decent choice for doing so. Also, why would you have two of each function for player's/other mobile's status checks? Instead, why not have an IsPoisoned that defaults to the player when a serial isn't specified?

I'm currently working on converting the stealth semi-russian functions into intelligible classes with methods (going off of runuo internals to get as close to a server-side representation as possible) that more closely resemble the functionality and wordage of the built-in steam functions since they better fit with a western understanding of the words used for function names.

Thanks Boydon, I'll give that list a try and see if I can't finish this up.
Title: Re: Stealth Python Reference
Post by: Boydon on August 23, 2014, 10:09:21 AM
In my mind I have something really similar and somewhere on my HD i also have a draft for this. My problem is that i never have time to work on making stealth APIs more Pythonic. :)
Title: Re: Stealth Python Reference
Post by: Crome969 on August 23, 2014, 10:22:08 AM
Title: Re: Stealth Python Reference
Post by: slyone on August 24, 2014, 10:19:36 AM
I really don't get why they'd choose to use pascal. The basic "stuffs" that are in a UO game, like items, mobiles, gumps, etc, are all objects that inherit from the basic "thing" or item class. It makes tons more damn sense to make classes and methods for them, and python is a very decent choice for doing so. Also, why would you have two of each function for player's/other mobile's status checks? Instead, why not have an IsPoisoned that defaults to the player when a serial isn't specified?

I'm currently working on converting the stealth semi-russian functions into intelligible classes with methods (going off of runuo internals to get as close to a server-side representation as possible) that more closely resemble the functionality and wordage of the built-in steam functions since they better fit with a western understanding of the words used for function names.

Thanks Boydon, I'll give that list a try and see if I can't finish this up.

Orich was working on a ScriptAPI in C# a while back.  He used it in his tutorial as a wrapper for the Stealth functions.  I haven't been keeping up with the .NET dll but here (https://bitbucket.org/Orich/orune/src/0614685de08481f6ef9073fbaf6d8ff0790bc08a/oRune/bin/Debug/ScriptAPI.cs?at=master) is the link to his bitbucket.org page for the source. 

Being able to use Python in Stealth is awesome.  A while ago, I was working on a Python version of the Orich's ScriptAPI.cs.  I might be wrong but it sounds like you are working on something similar.

You mentioned using the Stealth Documentation Manual.  Hopefully you are also referencing the API function list (http://stealth.od.ua/Doc:Api).  Some of the functions have some good examples and others just have the function prototype with a short description.

Anyways, hopefully some of these references help.