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
Difference between revisions of "UAM/Python"
Line 17: | Line 17: | ||
This links the player to an Age immediately. | 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. | |
<source lang="python"> | <source lang="python"> | ||
import uam | import uam | ||
uam.LinkToAge("EderRiltehInaltahv","LinkInPointDefault") | uam.LinkToAge("EderRiltehInaltahv","LinkInPointDefault") | ||
</source> | </source> | ||
− | + | ||
+ | |||
+ | ==PrintKiMessage== | ||
+ | Print's a message onto the player's KI. | ||
+ | |||
+ | E.g. | ||
+ | <source lang="python"> | ||
+ | import uam | ||
+ | uam.PrintKiMessage("Hello player!") | ||
+ | </source> | ||
+ | |||
+ | ==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. | ||
+ | <source lang="python"> | ||
+ | import uam | ||
+ | def SayHello(): | ||
+ | uam.PrintKiMessage("Ah my friend, you've returned!") | ||
+ | uam.SetTimer(SayHello, 4.0) | ||
+ | </source> |
Revision as of 23:42, 19 October 2010
This page lists some of the many things you can do with the "uam" Python module!
Contents
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.
import uam
def SayHello():
uam.PrintKiMessage("Ah my friend, you've returned!")
uam.SetTimer(SayHello, 4.0)