Important! Please read the announcement at http://myst.dustbird.net/uru-account.htm
Also! Please read the retirement announcement at http://myst.dustbird.net/uru-retirement.htm

UAM/Python

From UamWiki
Revision as of 23:48, 19 October 2010 by Dustin (talk | contribs)

This page lists some of the many things you can do with the "uam" Python module!

General Information

Although the examples show the "import uam" line all the time, you can normally just write that one time, at the top of the file.

Commands

SetAgeChronicle and GetAgeChronicle

These are variables that are stored in an Age. They are shared between all players in an Age. If one of them hasn't been set, and you try to get it, you'll get "".

Here's an example of setting the value to "red" if it is currently set to "green":

    import uam
    puzcolor = uam.GetAgeChronicle("PuzzleColour")
    if puzcolor=="green":
        puzcolor = "red"
        uam.SetAgeChronicle("PuzzleColour",puzcolor)


LinkToAge

This links the player to an Age immediately.

Here is an example, for if you want to link to the Age "EderRiltehInaltahv". You could also have specified another spawnpoint, but LinkInPointDefault is the normal starting point in an Age.

    import uam
    uam.LinkToAge("EderRiltehInaltahv","LinkInPointDefault")


PrintKiMessage

Print's a message onto the player's KI.

E.g.

    import uam
    uam.PrintKiMessage("Hello player!")


SetTimer

This is a sane alternative to Cyan's PtAtTimeCallback function. This is much cleaner and simpler to use. Just tell it when you want it to call you back, and what function to call at that time.

This example will have it wait 4.0 seconds, at which time it will print a message to the screen. Notice that the function "SayHello" takes no arguments. Note that all of this, including the definition for "SayHello", can all be inside another function.

    import uam
    def SayHello():
        uam.PrintKiMessage("Ah my friend, you've returned!")
    uam.SetTimer(SayHello, 4.0)


DisplayJournal and DisplayBook

This will display a journal to the player. DisplayJournal shows the version that has lined paper inside, whereas DisplayBook shows the old brown papered book. The "isOpen" argument tells it whether to show the journal already open or not. You can only have one book open at a time.

To show an open journal:

    import uam
    uam.DisplayJournal("Thanks for reading me!", True)