Update of /cvsroot/wpdev/xmlscripts/scripts/system
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15263/system
Modified Files:
regionchange.py
Log Message:
sound support
Index: regionchange.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/system/regionchange.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** regionchange.py 20 Sep 2004 14:31:56 -0000 1.4
--- regionchange.py 22 Oct 2004 23:18:59 -0000 1.5
***************
*** 8,11 ****
--- 8,40 ----
import wolfpack
import string
+ import random
+
+ def playmusic(socket, command, arguments):
+ packet = wolfpack.packet(0x6d, 3)
+ packet.setshort(1, int(arguments))
+ packet.send(socket)
+
+ def onLoad():
+ wolfpack.registercommand('playmusic', playmusic)
+
+ def changeMusic(char, oldregion, newregion):
+ oldMusic = oldregion.midilist
+ newMusic = newregion.midilist
+
+
+ if oldMusic != newMusic:
+
+ try:
+ if len(newMusic) != 0:
+ id = int(random.choice(newMusic.split(','))) # Choose randomly
+ else:
+ id = 0
+
+ packet = wolfpack.packet(0x6d, 3)
+ packet.setshort(1, id)
+ packet.send(char.socket)
+ except:
+ raise
+ pass
def onChangeRegion( char, oldregion, newregion ):
***************
*** 14,17 ****
--- 43,48 ----
if not socket:
return False
+
+ changeMusic(char, oldregion, newregion)
"""
|