Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
<py> autoprize

 
Post new topic   Reply to topic Printable version
 View previous topic  <c> zombie Post :: Post Ctf  View next topic  
Author Message
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Thu Sep 30, 2004 5:04 pm    Post subject: <py> autoprize Reply to topic Reply with quote

This module will prize the whole arena a certain amount of the same prize at regular intervals.

Since the python modules don't have an equivalent functions to load/unload you may see errors where stuff hasn't been initialised or cleaned up properly. Also I'm not sure if I should be using eval() to convert strings to ints but I couldn't get atoi() or num() to work.

Edit: removed old code.


Last edited by Smong on Tue May 22, 2007 6:46 am, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Fri Oct 01, 2004 2:11 am    Post subject: Reply to topic Reply with quote

Cool. Here are my suggestions:

You don't need to "return 1" from your timer event; the default (no return) is to continue. You can if it makes you feel better, though.

I would get rid of the ap_status field and just use the presence of the timer handle to determine if you're on or off for an arena.

You can write "if m:" instead of "if m != None:"

Use "int(s)" instead of eval to turn strings into integers. Using eval is dangerous: if you're not extremely careful, someone might be able to get you to run code that they typed as part of the command. Better to avoid eval entirely.

Note that int will raise an exception if the string can't be converted into an integer. You can handle it if you want, or if you don't, asss will handle it and log an error. In the case of user input, it's probably better to handle it yourself.

It's probably overkill for this example, but you could look into using the getopt or optparse libraries to handle options. You can get a list of words to pass to one of those with "params.split()".
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Tue May 22, 2007 6:52 am    Post subject: Reply to topic Reply with quote

Update
More robust loading (can be loaded after arena has been created)
Added support for named prizes (got fed up of finding the numbers)
Added ?ap command (got tired of typing out ?autoprize)

Plus all that stuff in Grelminar's post has been fixed long ago if anyone is wondering.
_________________
ss news




r4

ap.py - 3.77 KB
File downloaded or viewed 88 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Custom Projects All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 673 page(s) served in previous 5 minutes.

phpBB Created this page in 0.519718 seconds : 30 queries executed (83.4%): GZIP compression disabled