Mitsukaru Main Administrator
Admin '10 : GFX Crew '10 : Recruiter '10 : Posts : 1328 HWPoints : 1548 Join date : 2008-06-14
| Subject: High/Low Python Script Fri Feb 18, 2011 9:19 pm | |
| Started scripting in python recently. This is my first real code in it. - Code:
-
__module_name__ = "High Low" __module_version__ = "1.0" __module_description__ = "Yea yea yea"
import xchat,random
checkmsg=0 highlow=0 def check_number(word, word_eol, userdata): global checkmsg global highlow guess = xchat.get_info(word[1]) server = xchat.get_info('server') channel = xchat.get_info('channel') if (server == "irc.pawngame.com" and channel == "#Cookies" and checkmsg == 1 and word[1].isdigit()): guess = float(word[1]) if (highlow > guess): xchat.emit_print("Channel Message",word[0],word[1]) xchat.command("msg #cookies Your number was too low!") if (highlow < guess): xchat.emit_print("Channel Message",word[0],word[1]) xchat.command("msg #cookies Your number was too high!") if (highlow == guess): xchat.emit_print("Channel Message",word[0],word[1]) xchat.command("msg #cookies Congradulations! " + word[0] + " has guessed the correct answer!") checkmsg = 0 return xchat.EAT_XCHAT
def turn_on(word, word_eol, userdata): global checkmsg global highlow if (checkmsg == 0): checkmsg = 1 print "High Low Turned on" xchat.command("msg #cookies High/Low Turned On. Type the number to make a guess. 1-100") highlow = random.randint(1,100) else: checkmsg = 0 print "High Low Turned Off" xchat.command("msg #Cookies High/Low Turned Off") return xchat.EAT_ALL
xchat.hook_print("Channel Message", check_number) xchat.hook_command("turn_on", turn_on) print "Loaded "+__module_name__+" v"+__module_version__ What does it do? <@KiLLErMaN99_XC> High/Low Turned On. Type the number to make a guess. 1-100 <@KiLLErMaN99> 50 <@KiLLErMaN99_XC> Your number was too high! <@KiLLErMaN99> 75 <@KiLLErMaN99_XC> Your number was too high! <@KiLLErMaN99> 25 <@KiLLErMaN99_XC> Your number was too low! <@KiLLErMaN99> 40 <@KiLLErMaN99_XC> Your number was too high! <@KiLLErMaN99> 35 <@KiLLErMaN99_XC> Congradulations! KiLLErMaN99 has guessed the correct answer! I just wanted to show that off just cause. | |
|
Darkprism Wizard of the Marsh
Posts : 583 HWPoints : 4558 Join date : 2010-10-06
| Subject: Re: High/Low Python Script Fri Feb 18, 2011 9:47 pm | |
| It spells Congratulations wrong | |
|
Scrubby Lightning Thief
TDP4 Lead '10 : Posts : 783 HWPoints : 1387 Join date : 2010-08-14
| Subject: Re: High/Low Python Script Fri Feb 18, 2011 10:41 pm | |
| Lul. Can you script these type of things into the HW chat? | |
|
Mitsukaru Main Administrator
Admin '10 : GFX Crew '10 : Recruiter '10 : Posts : 1328 HWPoints : 1548 Join date : 2008-06-14
| Subject: Re: High/Low Python Script Fri Feb 18, 2011 11:00 pm | |
| - RedRaver wrote:
- Lul. Can you script these type of things into the HW chat?
no. | |
|
Sponsored content
| Subject: Re: High/Low Python Script | |
| |
|