ScriptUO

Scripting Resources & Utilities => Stealth Client => Stealth archive => Topic started by: slyone on October 04, 2014, 11:07:20 AM

Title: Stealth Documentation
Post by: slyone on October 04, 2014, 11:07:20 AM
Over the years, the EasyUO wiki (http://wiki.easyuo.com/index.php?title=Documentation) has been a valuable resource.

Stealth has similar wiki with a function list, usage descriptions, and tutorials.

Here are a few of the links:
Stealth Documentation by Category (http://stealth.od.ua/Doc:Manual/Reference)
Stealth Alphabetical Function Listing (http://stealth.od.ua/Doc:Api)

The wiki is editable by any user when logged into the site.

There is also a Russian version of the references which I think is mostly synchronized with the English version:
Stealth Documentation by Category [Russian] (http://stealth.od.ua/Doc:RU/Manual/Reference)
Stealth Alphabetical Function Listing [Russian] (http://stealth.od.ua/Doc:RU/Api)

As discussed in Vlek's post about the Stealth Python Reference (http://www.scriptuo.com/index.php?topic=12580.0), much of the documentation refers to the Pascal usage.  In some cases in the wiki, both the Pascal and Python versions of functions are shown.

Title: Re: Stealth Documentation
Post by: slyone on October 04, 2014, 11:16:32 AM
The Stealth embedded Python is documented with Python doc strings.  Below is a code snippet that will generate a listing of each of the functions and the other types and write it to a file.  It builds off of Boydon's recommendation (http://www.scriptuo.com/index.php?topic=12580.msg105045#msg105045) in Vlek's post about Stealth Python Documentation (http://www.scriptuo.com/index.php?topic=12580.0).  This code works in Python 2.  I have not tested it in Python 3 but see no reason why it wouldn't run in Python 3.

Code: [Select]
# Stealth UO Client Import
import stealth

# Python Library Imports
import inspect
import subprocess

# Test Code
# print help(CreateComponent)
# print CreateComponent.__doc__

func_lines = []
other_lines = []

# Get a listing of the member attributes of the Stealth library
functiondict = inspect.getmembers(stealth)

# Loop over each member and get its type and description
for k, v in functiondict:
    cur_line = "%s:\t%s\n" % (k, v)
    cur_doc = inspect.getdoc(getattr(stealth, k))
    if cur_doc:
        cur_line += "\t" + cur_doc + "\n"
    else:
        cur_line += "\tNo description\n"

    if inspect.isbuiltin(getattr(stealth, k)):
        # If the current member is a function add it to func_lines
        func_lines.append(cur_line)
    else:
        # else add the member and description to other_lines
        other_lines.append(cur_line)

with open("stealth_member_listing.txt", "w") as fh:
    # Write the functions to the file first
    for line in func_lines:
        fh.write(line)
    # Then write the other members to the file
    for line in other_lines:
        fh.write(line)

# Show the file in notepad
subprocess.call(["notepad", "stealth_member_listing.txt"])


I find it helpful to generate this listing each time Stealth is updated to a new version.

Title: Re: Stealth Documentation
Post by: Boydon on October 06, 2014, 05:19:33 AM
Nice post. :)

If you have time and will I also reccomend you to update the official stealth Wiki. :P