Server Help

ASSS Custom Projects - noise upon entering

tcsoccerman - Fri Apr 06, 2007 3:16 pm
Post subject: noise upon entering
could someone make me a module that would send a private "bong" upon entering the zone. I pretty sure a bot can do this, but a as3 module would probably be better. ty.
Dr Brain - Fri Apr 06, 2007 8:42 pm
Post subject:
Look at the messages module. That should be a good place to start for example code.
BDwinsAlt - Fri Apr 06, 2007 10:42 pm
Post subject:
In python you could use the playeraction.

Code: Show/Hide

from asss import *

chat = get_interface(I_CHAT)

def paction(p, action, arena):

    if action == PA_ENTERARENA:
        chat.SendSoundMessage(p, SOUND_GIRL, "Welcome to my sexy zone, %s." % (p.name) )

cb1 = reg_callback(CB_PLAYERACTION, paction)


Or something similar. The code is untested but should work. You could replace the SOUND_GIRL with a number if you wanted to.

If you only want a bong and no message just leave the message as "" with no text inside.
tcsoccerman - Sat Apr 07, 2007 4:31 pm
Post subject:
Don't you need a .dll along with it since it's py..how do you do that without compiling?
Chambahs - Sat Apr 07, 2007 5:24 pm
Post subject:
No, python doesnt compile. You simply write a python module, put it in your bin, and add it in your modules.conf or ?insmod <py> name. And thats it, no compiling nessecary, thats why I love python lol.
BDwinsAlt - Sat Apr 07, 2007 6:01 pm
Post subject:
Exactly. Thanks Chamby. All you do is create soundenter.py (or name the file something else) in your bin folder.

Somewhere after pymod:pymod in your module.conf add: <py> soundenter

DO NOT ADD TO ARENA.CONF

Only add that if you add mm_attach to the module so it only works in one arena.

You can add this to the code above if you want it to attach to an arena.

Code: Show/Hide

def mm_attach(arena):
    arena.cb1 = reg_callback(CB_PLAYERACTION, paction, arena)

def mm_detach(arena):
    arena.cb1 = None


Then remove the old one --> cb1 = reg_callback(CB_PLAYERACTION, paction)

Good luck icon_smile.gif

EDIT:
Tested the first code I made in a post before this one. It worked perfectly. I'll attach both of the modules. Just place them in your bin folder or copy and paste the code yourself.
(Assuming you haven't done so already)

Be sure pymod:pymod is enabled and working.
Anonymous - Sun Apr 08, 2007 9:11 am
Post subject:
E <pymod> python error calling callback CB_PLAYERACTION

I got that error in "soundenter", not "soundenter2". I'll paste my edited version i have...

Code: Show/Hide
from asss import *

chat = get_interface(I_CHAT)

def paction(p, action, arena):

    if action == PA_ENTERARENA:
        chat.SendSoundMessage(p, 33, "" % (p.name) )

cb1 = reg_callback(CB_PLAYERACTION, paction)


ty again in advance.. also what would i do in "soundenter2" to make it only in public, arena "0" i believe?. ty .
Animate Dreams - Sun Apr 08, 2007 9:30 am
Post subject:
I was going to say you forgot an interface, but playeraction is in core.h, isn't it? Anyway, Python actually does compile. Try checking your /bin after using a python module, you should see another file with the same name, but a .pyc extension. It gets done automatically, though.
BDwinsAlt - Sun Apr 08, 2007 9:30 am
Post subject:
Try adding a space inbetween the "" I guess.

To make it appear on the second one simply attach it to the arena.conf.

Where it says stuff like fg_wz \, add soundenter2
Solo Ace - Sun Apr 08, 2007 9:47 am
Post subject:
Code: Show/Hide
chat.SendSoundMessage(p, 33, "" % (p.name) )


Wtf?! There's no format for p.name to be put into.

Code: Show/Hide
chat.SendSoundMessage(p, 33, "")

Animate Dreams - Sun Apr 08, 2007 2:46 pm
Post subject:
Lol, I just assumed the error had to do with the callback itself, not the function called by the callback, so I didn't even bother to check. >_<
Smong - Sun Apr 08, 2007 4:07 pm
Post subject:
When python throws an error it's a good idea to check the console since there is more info there that doesn't find its way into the logs (such as exact line number).
BDwinsAlt - Sun Apr 08, 2007 7:22 pm
Post subject:
Solo: He just didn't understand that %s was later defined by p.name.

Use this to help you. http://docs.python.org/lib/typesseq-strings.html

I should have thought about there being no % (p.name). It's my fault. I didn't think ahead.

Sorry.

Good luck.
tcsoccerman - Mon Apr 09, 2007 8:50 am
Post subject:
Ty solo ace icon_smile.gif. that fixed it. I can kinda see what the problem was, i only code C. ty bdwinsalt for making it too. ty to everyone else who tried.
Hakaku - Mon Apr 09, 2007 9:28 am
Post subject:
I had tried this earlier myself, but I couldn't figure out why it wouldn't work. I later figured out that I had forgotten to change ?sound=0. tongue.gif

Comparing with BD's version, what's the difference between PA_ENTERARENA and PA_ENTERGAME ?
tcsoccerman - Mon Apr 09, 2007 11:11 am
Post subject:
i guess game=zone and arena=arena. arena is just more specific? don't ask me
Animate Dreams - Mon Apr 09, 2007 11:47 am
Post subject:
I believe entergame is kind of like enter ship. Basically, any time someone goes from spec > ship, or enters the zone in a ship(after he is connected and starts sending/receiving packets as normal), PA_ENTERGAME will be called.
BDwinsAlt - Mon Apr 09, 2007 4:47 pm
Post subject:
I've run into issue with ENTERGAME. I just use ENTERARENA now. I guess it doesn't really matter. What ever floats your boat.
Smong - Mon Apr 09, 2007 7:59 pm
Post subject:
The enter game action is called when the player has fully entered the arena, ie: downloaded all the lvz files.
tcsoccerman - Mon Apr 09, 2007 8:53 pm
Post subject:
I'm using entergame now, since i have a custom bong. i replaced it with 12, so when i used enterarena, it played that chick, and my brother's(little were in room) not good ....lol, i turned down volume fast enought though.
Animate Dreams - Mon Apr 09, 2007 8:58 pm
Post subject:
tcsoccerman wrote:
I'm using entergame now, since i have a custom bong. i replaced it with 12, so when i used enterarena, it played that chick, and my brother's(little were in room) not good ....lol, i turned down volume fast enought though.


LOL
BDwinsAlt - Mon Apr 09, 2007 9:42 pm
Post subject:
LOL. I modified it a bit and decided to use ENTERGAME also. I have an eletric zapping sound though.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group