Skip to content

jiabiao/mushpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mushpy

mushpy : Encapsulate the [MUSHclient][1] API via Python script. write 'synchronous' code, and excute asynchronously. [1]: http://www.mushclient.com/ "a mud client"

sample

@async
def Jobs(name):

    count = 0

    while True:        
        yield work()
        yield sleep()
        count+=1
        world.Note('work done. (%s times)' % count)

@async
def work():
    world.Note("working 1")
    yield TimerTask(0,0,5)
    world.Note("working 2")

    world.DoAfter(3,'hi')
    yield MatchTask(u'^你双手抱拳,作了个揖道:各位英雄请了!$')



@async
def sleep():
    world.send('sleep')
    yield TimerTask(0,0,5) #or yield MatchTask(u'^你一觉醒来......$')
    world.note('awake')


#then call in command line:work("name").begin()

references

[mushpy][2]: another Python framework on top of Mushclient's API [2]:http://mushclient.com/forum/?id=10283

About

a Python framework on top of Mushclient's API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages