mulukulu 0 Posted September 15, 2014 Share Posted September 15, 2014 Hello everyone, id like to open an channel-changer (Which i found in a other forum) on my client with the button F6 but im a lidle bit confused because in the script itself there is already a function to open it with that button so what i have do in the game.py to open the chchanger? uichange.py : import ui import dbg import app import net import constInfo import chat class GuiDialog(ui.Window): LastContactTimeStamp = app.GetTime() - 5 WaitTime = 10 State = "Disabled" def __init__(self): ui.Window.__init__(self) self.BuildWindow() constInfo.channelgui = 1 def __del__(self): ui.Window.__del__(self) constInfo.channelgui = 0 def BuildWindow(self): self.Board = ui.BoardWithTitleBar() self.Board.SetSize(164, 138) self.Board.SetCenterPosition() self.Board.AddFlag('movable') self.Board.AddFlag('float') self.Board.SetTitleName('Channel Wechsel') self.Board.SetCloseEvent(self.Close) self.Board.Show() self.__BuildKeyDict() self.comp = Component() self.Channel1 = self.comp.Button(self.Board, 'Channel1', '', 54, 37, self.Channel1_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub') self.Channel2 = self.comp.Button(self.Board, 'Channel2', '', 54, 67, self.Channel2_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub') self.Channe3 = self.comp.Button(self.Board, 'Channel3', '', 54, 97, self.Channe3_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub') def Channel1_func(self): if self.State == "Disabled": chat.AppendChat(chat.CHAT_TYPE_INFO, "Warte noch " + str(int(int(self.LastContactTimeStamp) + self.WaitTime) - int(app.GetTime())) + " Sekunden bevor du erneut den Channel Wechselst.") return import linecache AccountID = linecache.getline("save", 1) Password = linecache.getline("save", 2) ChannelIndex = 1 ChannelPort = 13070 AuthServerIP = "IP" ChannelIP = "IP" self.Board.Hide() constInfo.channelgui = 0 AuthServerPort = 11002 NewServerName = "Ch1" net.SetServerInfo(NewServerName) net.SetLoginInfo(AccountID, Password) net.ConnectToAccountServer(ChannelIP, ChannelPort, AuthServerIP, AuthServerPort) net.DirectEnter(0) net.SendSelectCharacterPacket(0) net.SendEnterGamePacket() self.State = "Disabled" self.LastContactTimeStamp = app.GetTime() def Channel2_func(self): if self.State == "Disabled": chat.AppendChat(chat.CHAT_TYPE_INFO, "Warte noch " + str(int(int(self.LastContactTimeStamp) + self.WaitTime) - int(app.GetTime())) + " Sekunden bevor du erneut den Channel Wechselst.") return import linecache AccountID = linecache.getline("save", 1) Password = linecache.getline("save", 2) ChannelIndex = 1 ChannelPort = 14070 AuthServerIP = "IP" ChannelIP = "IP" self.Board.Hide() constInfo.channelgui = 0 AuthServerPort = 11002 NewServerName = "Ch2" net.SetServerInfo(NewServerName) net.SetLoginInfo(AccountID, Password) net.ConnectToAccountServer(ChannelIP, ChannelPort, AuthServerIP, AuthServerPort) net.DirectEnter(0) net.SendSelectCharacterPacket(0) net.SendEnterGamePacket() self.State = "Disabled" self.LastContactTimeStamp = app.GetTime() def Channe3_func(self): if self.State == "Disabled": chat.AppendChat(chat.CHAT_TYPE_INFO, "Warte noch " + str(int(int(self.LastContactTimeStamp) + self.WaitTime) - int(app.GetTime())) + " Sekunden bevor du erneut den Channel Wechselst.") return import linecache AccountID = linecache.getline("save", 1) Password = linecache.getline("save", 2) ChannelIndex = 1 ChannelPort = 15070 AuthServerIP = "IP" ChannelIP = "IP" self.Board.Hide() constInfo.channelgui = 0 AuthServerPort = 11002 NewServerName = "Ch3" net.SetServerInfo(NewServerName) net.SetLoginInfo(AccountID, Password) net.ConnectToAccountServer(ChannelIP, ChannelPort, AuthServerIP, AuthServerPort) net.DirectEnter(0) net.SendSelectCharacterPacket(0) net.SendEnterGamePacket() self.State = "Disabled" self.LastContactTimeStamp = app.GetTime() def OnUpdate(self): if int(int(self.LastContactTimeStamp) + self.WaitTime) < int(app.GetTime()) and self.State == "Disabled": self.State = "Enabled" def __BuildKeyDict(self): onPressKeyDict = {} onPressKeyDict[app.DIK_F6] = lambda : self.OpenWindow() self.onPressKeyDict = onPressKeyDict def OnKeyDown(self, key): try: self.onPressKeyDict[key]() except KeyError: pass except: raise return TRUE def OpenWindow(self): if self.Board.IsShow(): self.Board.Hide() else: self.Board.Show() def Close(self): self.Board.Hide() constInfo.channelgui = 0 class Component: def Button(self, parent, buttonName, tooltipText, x, y, func, UpVisual, OverVisual, DownVisual): button = ui.Button() if parent != None: button.SetParent(parent) button.SetPosition(x, y) button.SetUpVisual(UpVisual) button.SetOverVisual(OverVisual) button.SetDownVisual(DownVisual) button.SetText(buttonName) button.SetToolTipText(tooltipText) button.Show() button.SetEvent(func) return button def ToggleButton(self, parent, buttonName, tooltipText, x, y, funcUp, funcDown, UpVisual, OverVisual, DownVisual): button = ui.ToggleButton() if parent != None: button.SetParent(parent) button.SetPosition(x, y) button.SetUpVisual(UpVisual) button.SetOverVisual(OverVisual) button.SetDownVisual(DownVisual) button.SetText(buttonName) button.SetToolTipText(tooltipText) button.Show() button.SetToggleUpEvent(funcUp) button.SetToggleDownEvent(funcDown) return button def EditLine(self, parent, editlineText, x, y, width, heigh, max): SlotBar = ui.SlotBar() if parent != None: SlotBar.SetParent(parent) SlotBar.SetSize(width, heigh) SlotBar.SetPosition(x, y) SlotBar.Show() Value = ui.EditLine() Value.SetParent(SlotBar) Value.SetSize(width, heigh) Value.SetPosition(1, 1) Value.SetMax(max) Value.SetLimitWidth(width) Value.SetMultiLine() Value.SetText(editlineText) Value.Show() return SlotBar, Value def TextLine(self, parent, textlineText, x, y, color): textline = ui.TextLine() if parent != None: textline.SetParent(parent) textline.SetPosition(x, y) if color != None: textline.SetFontColor(color[0], color[1], color[2]) textline.SetText(textlineText) textline.Show() return textline def RGB(self, r, g, : return (r*255, g*255, b*255) def SliderBar(self, parent, sliderPos, func, x, y): Slider = ui.SliderBar() if parent != None: Slider.SetParent(parent) Slider.SetPosition(x, y) Slider.SetSliderPos(sliderPos / 100) Slider.Show() Slider.SetEvent(func) return Slider def ExpandedImage(self, parent, x, y, img): image = ui.ExpandedImageBox() if parent != None: image.SetParent(parent) image.SetPosition(x, y) image.LoadImage(img) image.Show() return image def ComboBox(self, parent, text, x, y, width): combo = ui.ComboBox() if parent != None: combo.SetParent(parent) combo.SetPosition(x, y) combo.SetSize(width, 15) combo.SetCurrentItem(text) combo.Show() return combo def ThinBoard(self, parent, moveable, x, y, width, heigh, center): thin = ui.ThinBoard() if parent != None: thin.SetParent(parent) if moveable == TRUE: thin.AddFlag('movable') thin.AddFlag('float') thin.SetSize(width, heigh) thin.SetPosition(x, y) if center == TRUE: thin.SetCenterPosition() thin.Show() return thin def Gauge(self, parent, width, color, x, y): gauge = ui.Gauge() if parent != None: gauge.SetParent(parent) gauge.SetPosition(x, y) gauge.MakeGauge(width, color) gauge.Show() return gauge def ListBoxEx(self, parent, x, y, width, heigh): bar = ui.Bar() if parent != None: bar.SetParent(parent) bar.SetPosition(x, y) bar.SetSize(width, heigh) bar.SetColor(0x77000000) bar.Show() ListBox=ui.ListBoxEx() ListBox.SetParent(bar) ListBox.SetPosition(0, 0) ListBox.SetSize(width, heigh) ListBox.Show() scroll = ui.ScrollBar() scroll.SetParent(ListBox) scroll.SetPosition(width-15, 0) scroll.SetScrollBarSize(heigh) scroll.Show() ListBox.SetScrollBar(scroll) return bar, ListBox i would be so happy if someone could help me! best regards Link to comment Share on other sites More sharing options...
RatCatcher 77 Posted September 15, 2014 Share Posted September 15, 2014 Are you kidding me? Your post just gave me cancer to eyes. This is the worst thing I saw from the start of this week. if self.State == "Disabled": chat.AppendChat(chat.CHAT_TYPE_INFO, "Warte noch " + str(int(int(self.LastContactTimeStamp) + self.WaitTime) - int(app.GetTime())) + " Sekunden bevor du erneut den Channel Wechselst.") Anyway, if you wan't to open it, just call GuiDialog from somewhere. 1 Enough is enough Link to comment Share on other sites More sharing options...
mulukulu 0 Posted September 15, 2014 Author Share Posted September 15, 2014 Its not my script so i am not responsible for your cancer :,D this is what i added to the game.py : def __ChChange(self): import uichange uichange.GuiDialog().Show() and the function to open it: onPressKeyDict[app.DIK_F6] = lambda : self.__ChChange() but it dosn´t work. What did i wrong? Link to comment Share on other sites More sharing options...
RatCatcher 77 Posted September 15, 2014 Share Posted September 15, 2014 GuiDialog is Window class, not ScriptWindow, so you can't call Show() to it, if you didn't make that function in it's class. You need to call only GuiDialog(), __init__ function will do everything like you can see in the code. 1 Enough is enough Link to comment Share on other sites More sharing options...
mulukulu 0 Posted September 15, 2014 Author Share Posted September 15, 2014 Ah okay i think i know what you mean. def __ChChange(self): import uichange uichange.GuiDialog() ? syserr: 0915 22:41:20829 :: Traceback (most recent call last): 0915 22:41:20829 :: File "game.py", line 1181, in OnKeyDown 0915 22:41:20829 :: File "game.py", line 328, in <lambda> 0915 22:41:20829 :: File "game.py", line 2225, in __ChChange 0915 22:41:20829 :: File "system.py", line 130, in __pack_import 0915 22:41:20829 :: File " 0915 22:41:20829 :: <string> 0915 22:41:20829 :: ", line 0915 22:41:20829 :: 276 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: return bar, ListBox 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20830 :: 0915 22:41:20830 :: 0915 22:41:20830 :: ^ 0915 22:41:20830 :: SyntaxError 0915 22:41:20830 :: : 0915 22:41:20830 :: invalid syntax 0915 22:41:20830 :: sorry if im acting stupid but i dont have any knowledge about python... :/ Link to comment Share on other sites More sharing options...
RatCatcher 77 Posted September 16, 2014 Share Posted September 16, 2014 Ah okay i think i know what you mean. def __ChChange(self): import uichange uichange.GuiDialog() ? syserr: 0915 22:41:20829 :: Traceback (most recent call last): 0915 22:41:20829 :: File "game.py", line 1181, in OnKeyDown 0915 22:41:20829 :: File "game.py", line 328, in <lambda> 0915 22:41:20829 :: File "game.py", line 2225, in __ChChange 0915 22:41:20829 :: File "system.py", line 130, in __pack_import 0915 22:41:20829 :: File " 0915 22:41:20829 :: <string> 0915 22:41:20829 :: ", line 0915 22:41:20829 :: 276 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: return bar, ListBox 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20829 :: 0915 22:41:20830 :: 0915 22:41:20830 :: 0915 22:41:20830 :: ^ 0915 22:41:20830 :: SyntaxError 0915 22:41:20830 :: : 0915 22:41:20830 :: invalid syntax 0915 22:41:20830 :: sorry if im acting stupid but i dont have any knowledge about python... :/ You are probably missing tabulator, post here screenshot of the file about line 276, I will take a look at it Enough is enough Link to comment Share on other sites More sharing options...
Active Member Koray 1998 Posted September 16, 2014 Active Member Share Posted September 16, 2014 try adding two spaces at the end ListBox.SetScrollBar(scroll) return bar, ListBox Link to comment Share on other sites More sharing options...
mulukulu 0 Posted September 16, 2014 Author Share Posted September 16, 2014 i added the spaces and now there is another error: 0916 17:26:19542 :: Traceback (most recent call last): 0916 17:26:19542 :: File "game.py", line 1181, in OnKeyDown 0916 17:26:19542 :: File "game.py", line 328, in <lambda> 0916 17:26:19542 :: File "game.py", line 2225, in __ChChange 0916 17:26:19542 :: File "system.py", line 130, in __pack_import 0916 17:26:19542 :: File " 0916 17:26:19542 :: <string> 0916 17:26:19542 :: ", line 0916 17:26:19542 :: 260 0916 17:26:19542 :: 0916 17:26:19542 :: 0916 17:26:19542 :: bar.SetParent(parent) 0916 17:26:19542 :: 0916 17:26:19542 :: 0916 17:26:19542 :: 0916 17:26:19542 :: ^ 0916 17:26:19542 :: IndentationError 0916 17:26:19542 :: : 0916 17:26:19542 :: expected an indented block 0916 17:26:19542 :: maybe you know what that means... :/ but this in the game.py is correct? : def __ChChange(self): import uichange uichange.GuiDialog() Link to comment Share on other sites More sharing options...
mulukulu 0 Posted September 19, 2014 Author Share Posted September 19, 2014 #push Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now