[Crossfire-wiki] [Crossfire DokuWiki] page changed: insult_generator_source_code
no-reply_wiki at metalforge.org
no-reply_wiki at metalforge.org
Fri Sep 8 20:45:25 CDT 2006
A page in your DokuWiki was added or changed. Here are the details:
Date : 2006/09/08 20:45
User : rednaxela
Edit Summary: Update script for CFPython 2.0
@@ -1,7 +1,7 @@
====== Insult Generator Source Code ======
- **This code is out of date and will need to be updated to CFPython 2.0 t
o run on a recent crossfire server**
+ **This has been updated for CFPython 2.0, but has not been tested since
conversion.**
The crossfire version of the Shakspearean Insult Generator:
<code>
@@ -14,12 +14,13 @@
# http://www.zope.org/Members/tfarrell/shakeinsult
#
#
# Adapted for use in Crossfire by Todd Mitchell
+ # Updated to CFPython 2.0 by Alex Schultz
#
# Please help by adding new styles of insults to this fine script.
- import CFPython
+ import Crossfire
from random import choice
def Insult(style):
@@ -54,29 +55,26 @@
else:
return "No such style stupid."
vowels = ['a', 'e', 'i', 'o', 'u']
- isvowel = 0
rnoun = choice(noun)
radj1 = choice(adj1)
radj2 = choice(adj2)
- for letter in vowels:
- if (radj1[0] == letter):
- rprefix = choice(prefixAn)
- isvowel = 1
- if (isvowel == 0):
+ if (letter in vowels):
+ rprefix = choice(prefixAn)
+ else:
rprefix = choice(prefixA)
insult = "%s %s %s %s!" % (rprefix, radj1, radj2, rnoun)
return insult
- activator=CFPython.WhoIsActivator()
- whoami=CFPython.WhoAmI()
+ activator=Crossfire.WhoIsActivator()
+ whoami=Crossfire.WhoAmI()
#style of insult desired to hurl in event options
- style = CFPython.GetEventOptions(whoami,1) # 1 is apply event
+ style = Crossfire.ScriptParameters()
- CFPython.Write(Insult(style),activator)
+ activator.Write(Insult(style))
</code>
IP-Address : 66.222.158.169
Old Revision: http://wiki.metalforge.net/doku.php/insult_generator_source_
code?rev=1157765520
New Revision: http://wiki.metalforge.net/doku.php/insult_generator_source_
code
--
This mail was generated by DokuWiki at
http://wiki.metalforge.net/
More information about the crossfire-wiki
mailing list