Server Help

ASSS Questions - help?

Anonymous - Tue Dec 28, 2004 12:57 am
Post subject: help?
i got a source from catid, .dll for mervbot, was wondering if someone would like to convert it to an ASSS module for me? icon_smile.gif
Dr Brain - Tue Dec 28, 2004 10:27 am
Post subject:
Learn to program yourself. If you're going to use ASSS, you'll have to know how to program, or at least have a programming slave.

Oh, and you can use MERVBot in ASSS.
Anonymous - Tue Dec 28, 2004 11:12 am
Post subject:
current programming slave = SMong lol but hes lazy icon_razz.gif and also, my topic got deleted by someone, but i asked if anyone has an example i can follow of a module in python? it would help me learn alot faster if i can see what all these commands do icon_smile.gif
Smong - Tue Dec 28, 2004 1:59 pm
Post subject:
I think this is fairly simple:
Code: Show/Hide
# demo asss python module
# dec 28 2004 smong

# nearly always use this
from asss import *


# get some interfaces
# see chat.h for where I_CHAT comes from, see other .h files for more (fx:
#  game.h)
chat = get_interface(I_CHAT)


# a callback
# this function is called when a player enters/leaves, see core.h for PA_???
#  constants
def paction(p, action, arena):
    # start indenting
    if action == PA_ENTERARENA:
        # see chat.h for the names of more functions like SendMessage
        chat.SendMessage(p, "hello")
        # i'm not sure which one of these is correct, you will have to
        #  experiment. edit: ok i tested this, #2 works.
        # see player.h for more p.??? fields
        #chat.SendMessage(p, "1) hello %s", p.name)
        chat.SendMessage(p, "2) hello %s" % p.name)
        #chat.SendMessage(p, "3) hello ", p.name)
        #chat.SendMessage(p, ( "4) hello ", p.name ))

# tell asss to call 'paction' when CB_PLAYERACTION is signalled
# see .h files for CB_??? names
cb1 = reg_callback(CB_PLAYERACTION, paction)


# a command
# see cmdman.h for what each parameter does
def c_moo(cmd, params, p, targ):
# help text (?help moo)
    """\
Module: <py> demo
Targets: none
a sample command.
"""
    chat.SendMessage(p, "moo")

# tell asss to call 'c_moo' when a player types ?moo
# note: add cmd_moo to conf/groupdef.dir/default so players have permission to
#  use this command.
cmd1 = add_command("moo", c_moo)


# now make you own module
# i recommend writing on paper what you would do if you were hosting the event
#  manually, then look at the .h files to find the callbacks you need (like
#  shipchange, kill, etc) look at the asss console for execution errors, and if
#  that doesn't help, add some chat.SendArenaMessage("i'm at line ...") type
#  messages to locate the buggy piece of code.

Save this in bin/demo.py. Then ingame make sure pymod is loaded by using ?lsmod and ?insmod. Then add this module with the following command: ?insmod <py> demo. Re-entering the arena and typing ?moo should do some stuff.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group