Orginalthread:
Fehler
Code:
0902 09:04:09589 :: networkModule.py(line:200) SetSelectCharacterPhase system.py(line:130) __pack_import system.py(line:110) _process_result introSelect.py(line:28) ? system.py(line:130) __pack_import system.py(line:110) _process_result interfaceModule.py(line:50) ? system.py(line:130) __pack_import networkModule.SetSelectCharacterPhase - exceptions.SyntaxError:invalid syntax (line 316) 0902 09:04:09590 :: ============================================================================================================ 0902 09:04:09590 :: Abort!!!!
Code:
import ui import time import player import constInfo import chat import event from random import randrange delay = 0.1 autoSpinDelay = 1.5 spinTimesUntilQuestEvent = 75 class Slotmachine(ui.ScriptWindow): def __init__(self): ui.ScriptWindow.__init__(self) self.isLoaded = FALSE ################################## ## Create Ui Begin ################################## def __LoadScript(self): try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, 'uiscript/slotmachine.py') except: import exception exception.Abort('test.__LoadScript.LoadObject') try: self.__LoadVariables() self.__LoadUi() self.__BindEvents() except: import exception exception.Abort('test.__LoadScript.BindObject') self.isLoaded = TRUE def __LoadVariables(self): slotmachinePath = "locale/de/ui/slotmachine/" self.slotIcons = [ slotmachinePath + 'Cherry.sub', slotmachinePath + 'Lemon.sub', slotmachinePath + 'Orange.sub', slotmachinePath + 'Plum.sub', slotmachinePath + 'Melon.sub', slotmachinePath + 'Banana.sub', slotmachinePath + 'Bar.sub', slotmachinePath + 'Seven.sub', slotmachinePath + 'BigWin.sub' ] self.spin = { 'time' : 0, 'index' : [0,0,0], 'count' : 0, 'run' : FALSE, 'autoSpin' : FALSE, } def __LoadUi(self): self.board = self.GetChild('Board') self.titleBar = self.GetChild('TitleBar') ## Buttons self.buttonDict = { 'spin' : self.GetChild('SB_Spin_Button'), 'betMax' : self.GetChild('SB_BetMax_Button'), 'autoSpin' : self.GetChild('SB_AutoSpin_Button'), } ## Slots self.slotBoxDict = { 'slot_0' : self.GetChild('SM_Box_00'), 'slot_1' : self.GetChild('SM_Box_01'), 'slot_2' : self.GetChild('SM_Box_02'), } self.maxBetLabel = self.GetChild('SC_Box_01_Text_Label') ## Multiplier Ui self.multiplierDict = { 'text_0' : self.GetChild('SWM_Box_00_Text'), 'text_1' : self.GetChild('SWM_Box_01_Text'), 'text_2' : self.GetChild('SWM_Box_02_Text'), 'text_3' : self.GetChild('SWM_Box_03_Text'), 'text_4' : self.GetChild('SWM_Box_04_Text'), 'text_5' : self.GetChild('SWM_Box_05_Text'), 'text_6' : self.GetChild('SWM_Box_06_Text'), 'text_7' : self.GetChild('SWM_Box_07_Text'), 'text_8' : self.GetChild('SWM_Box_08_Text'), } ## Credits Ui self.creditsDict = { 'text_0' : self.GetChild('SC_Box_00_Text'), 'text_1' : self.GetChild('SC_Box_01_Text'), 'text_2' : self.GetChild('SC_Box_02_Text'), } def __BindEvents(self): self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close)) ## Button Events self.buttonDict['spin'].SetEvent(self.OnClickSpin) self.buttonDict['betMax'].SetEvent(self.OnClickBetMax) self.buttonDict['autoSpin'].SetEvent(self.OnClickAutoSpin) ################################## ## Create Ui End ################################## ################################## ## Standart definitions Begin ################################## def __del__(self): ui.ScriptWindow.__del__(self) def Destroy(self): self.Hide() self.ClearDictionary() def Open(self, multipliers, maxBet): if FALSE == self.isLoaded: self.__LoadScript() self.SetTop() self.Show() self.maxBetLabel.SetText('Bet / Max = ' + maxBet) self.SetMultipliers(multipliers) self.SetCreditsWon(0) ## set credits bet = 0 self.creditsDict['text_1'].SetText('0') self.maxBet = int(maxBet) self.creditsDict['text_1'].SetMax(self.maxBet) def Close(self): self.Hide() def SendSystemChat(self, text): chat.AppendChat(chat.CHAT_TYPE_INFO, "<System>: "+str(text)) ################################## ## Standart definitions End ################################## ################################## ## On Click/Press Key Events Begin ################################## def OnClickSpin(self): if self.spin['run'] == FALSE: ## has enough money to spin? creditsInput = int(self.creditsDict['text_1'].GetText()) maxBet = self.maxBet if creditsInput > maxBet: self.SendSystemChat('Der Max Bet Betrag liegt bei: '+str(maxBet)+' Credits.') #self.SendSystemChat('You do not have enough credits.') return if player.GetElk() < creditsInput: self.SendSystemChat('Du besitzt nicht genuegend Credits.') #self.SendSystemChat('You do not have enough credits.') return if creditsInput <= 0: self.SendSystemChat('Gib bitte mehr wie 0 Credits ein.') #self.SendSystemChat('Please input more than 0 credits') return self.SendCreditsBet() def OnClickAutoSpin(self): if self.spin['autoSpin'] == TRUE: self.spin['autoSpin'] = FALSE self.SendSystemChat('Auto Spin deaktiviert!') #self.SendSystemChat('Auto spin deactivated!') else: self.spin['autoSpin'] = TRUE self.SendSystemChat('Auto Spin aktiviert!') #self.SendSystemChat('Auto spin activated!') def OnClickBetMax(self): maxBet = self.maxBet if player.GetElk >= maxBet: self.creditsDict['text_1'].SetText(str(maxBet)) else: self.SendSystemChat('Du besitzt nicht genuegend Credits.') #self.SendSystemChat('You do not have enough credits.') def OnPressEscapeKey(self): self.Close() return TRUE def OnPressExitKey(self): self.Close() return TRUE ################################## ## On Click/Press Key Events End ################################## ################################## ## Quest send Begin ################################## def GetWinningIcons(self): self.QuestCMD('GET_WINNING_ICONS') def SendCreditsBet(self): self.QuestCMD('BET#'+self.creditsDict['text_1'].GetText()) def QuestCMD(self, command): constInfo.SLOTMACHINE["questCMD"] = command event.QuestButtonClick(int(constInfo.SLOTMACHINE["qid"])) ################################## ## Quest send End ################################### ################################## ## Quest receive complete Begin ################################## ## set multipliers (9) def SetMultipliers(self, multiplierList): multiplierList = multiplierList.split('#') ## set multipliers for i in range(len(multiplierList)): self.multiplierDict['text_'+str(i)].SetText('X'+multiplierList[i]) ## stop spinning and set slot icons on quest receive complete (3) def SetSlotIcons(self, slotList): self.spin['run'] = FALSE self.spin['count'] = 0 slotList = slotList.split('#') ## set new icons for i in range(len(slotList)): self.slotBoxDict['slot_'+str(i)].LoadImage(self.slotIcons[int(slotList[i])]) ## check for auto spin if self.spin['autoSpin'] == TRUE: self.spin['time'] = float(time.clock()) + float(autoSpinDelay) self.OnClickSpin() ## set credits won on quest receive complete def SetCreditsWon(self, credits): self.creditsDict['text_2'].SetText(str(credits)) ## update player credits (yang) on quest receive complete def SetCredits(self): self.creditsDict['text_0'].SetText(str(player.GetElk())) def OnReceiveCanSpin(self): self.spin['run'] = TRUE self.SetCreditsWon(0) ################################## ## Quest End ################################## ################################## ## Spin Begin ################################## def OnUpdate(self): ## is max bet more than allowed? creditInput = self.creditsDict['text_1'].GetText() if creditInput != "": if int(creditInput) > self.maxBet: self.creditsDict['text_1'].SetText(str(self.maxBet)) ## update ingame credits (yang) self.SetCredits() ## spinning process if self.spin['run'] == TRUE: ## check spin delay if float(self.spin['time']) < float(time.clock()): ## go through all three slot boxes for i in range(3): slotIconsLen = len(self.slotIcons) index = randrange(0,slotIconsLen-1) ## avoid two times in a row the same icon while index == self.spin['index'][i]: index = randrange(0,slotIconsLen-1) self.spin['index'][i] = index ## set new slot icon's self.slotBoxDict['slot_' + str(i)].LoadImage(self.slotIcons[index]) self.spin['time'] = float(time.clock()) + float(delay) ## get winning icons if spinning time is equal spinTimesUntilQuestEvent if spinTimesUntilQuestEvent == self.spin['count']: self.GetWinningIcons() self.spin['count'] += 1 ################################## ## Spin End ##################################