Server Help

ASSS Questions - Python Set list

Bassnectar - Sun May 08, 2011 11:05 pm
Post subject: Python Set list
I was wonder what was holding back sending to a set or list of players using python. I notice in chat.h its noted that there isn't support for it yet, what would it take to get this feature working?
JoWie - Mon May 09, 2011 6:38 am
Post subject:
This was added 2 years ago. The comment in chat.h is old and should probably be removed.

In python you need to use a asss.PlayerListType object.
It goes like this:
Code: Show/Hide

import asss
chat = asss.get_interface(I_CHAT)

list = asss.PlayerListType()
list.append(p)
list.append(another_p)
chat.SendSetMessage(list, "bla")


This object can be used anywhere where you would normally pass a LinkedList containing Player's (look for pyint: playerlist)
Bassnectar - Tue May 10, 2011 3:39 pm
Post subject:
Oh interesting!

Is there a way to not have to append each player, say I wanted to send to the entire arena? Or would I have to do list.append(p) for each player that enters. and list.remove(p) for when they leave?
JoWie - Tue May 10, 2011 4:57 pm
Post subject:
There is SendArenaMessage and SendArenaSoundMessage:

Code: Show/Hide

chat.SendArenaMessage (arena, "bla bla")
chat.SendArenaSoundMessage(arena, asss.SOUND_GIRL, "bla bla")


If you want to send a custom message you will have to loop over every player
Code: Show/Hide

list = asss.PlayerListType()
def getMyPlayers(p):
   if (p.arena == arena):
      list.append(p)
asss.for_each_player(getMyPlayers)
chat.SendAnyMessage(list, asss.MSG_SYSOPWARNING, 0, None, "bla bla")

rose61 - Sat Mar 14, 2015 11:36 am
Post subject:
I wanted to send to the entire arena? Or would I have to do list.append(p) for each player that enters.
__________________
You can easily check out our high quality Testking pmp certificate which prepares you well Testking compass test questions for the You can also get success in real fmuniv.edu with the quality
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group