Risto Posted March 3, 2013 Share Posted March 3, 2013 code: import GemRB def OnLoad (): print "Hi, Game!"; GMenu = GemRB.CreateWindow (0, 0, 0, 800, 600, "BG"); # ... GemRB.SetVisible (GMenu, "WINDOW_VISIBLE"); return The file Start.py leads to a runtime error (log): [GUIScript]: Loading Script Start. Hi, Game! [ResourceManager]: Searching for 'BG' ... [ResourceManager]: Found 'BG.mos' in 'chitin.key'. Traceback (most recent call last): File ". / GUIScripts / test \ Start.py", line 6, in OnLoad GemRB.SetVisible (GMenu, "WINDOW_VISIBLE"); AttributeError: 'module' object has no attribute 'SetVisible' Purpose - draw the background image for the future of the game menu. I would be grateful for an explanation of what I'm doing wrong. UPD: Changed the code, so it will work? I myself can not test, because it still has not corrected according CommonTables.py. import GemRB import GUICommon import GUICommonWindows def OnLoad(): GMenu = GemRB.CreateWindow(0, 0, 0, 800, 600, "BG"); GUICommon.GMenu.SetVisible("WINDOW_VISIBLE"); GemRB.UnhideGUI (); return Link to comment
lynx Posted March 3, 2013 Share Posted March 3, 2013 look at gemrb/plugins/GUIScripts/GUIScripts.cpp for the most accurate API docs. The change here is that SetVisible doesn't work in the long form anymore, so you need to do it this way: GMenuID = GemRB.CreateWindow(0, 0, 0, 800, 600, "BG") GMenu = GUIClasses.GWindow(GMenuID) GMenu.SetVisible(WINDOW_VISIBLE) Your other attempt was actually an extra error worse off. It would be helpful if you explained what you're trying to do, since I see you're also using the special test gametype. Link to comment
Risto Posted March 4, 2013 Author Share Posted March 4, 2013 At this point, my goal is to create a standard main menu of the game (New/Save/Loading/Option/About/Quit), each of the items which, when selected, load the appropriate interface. Your code to create a window is working, thank you, but when I try to call GMenu.CreateButton() program closes without any error message in the log. This is probably due to the fact that I, at this point, do not fully understand the structure and organization of the game interface, for example, what WindowID is different from WindowIndex. I suppose the study specification .chu and .2da files, and their active use in the development can solve most of my problems, but where you can read it? Link to comment
SyntaxError Posted March 4, 2013 Share Posted March 4, 2013 learn about CHU and other IE files here you will need a CHU or to modify an existing CHU for any custom interface. Link to comment
lynx Posted March 4, 2013 Share Posted March 4, 2013 Check GUIScripts/test/* for very minimal guiscripts needed to enter a game. It currently does it automatically, so you'd need to delay the entering. Link to comment
Avenger Posted March 4, 2013 Share Posted March 4, 2013 Window index is the position of the window in the gui pack (.chu). Window ID is the content of the window ID field in the window structure (also in the .chu). For .chu reference check iesdp. It may be difficult or impossible to create a whole gui without using .chu files. We added only limited support to create windows/controls from scratch, because the original games all come with .chu files. Link to comment
Risto Posted March 4, 2013 Author Share Posted March 4, 2013 It may be difficult or impossible to create a whole gui without using .chu files. We added only limited support to create windows/controls from scratch, because the original games all come with .chu files. This is sad. The fact that I have not found a way to create CHU files from scratch. Near Infinity can only edit these files, but not add new content, making it very difficult job. Also, probably a proprietary file format IE unfree, so to develop their own games using it undesirable. Link to comment
lynx Posted March 4, 2013 Share Posted March 4, 2013 you can make them with dltcep. You can also extend gemrb to get more gui building/arrangement functions. Link to comment
SyntaxError Posted March 4, 2013 Share Posted March 4, 2013 you can make them with dltcep. You can also extend gemrb to get more gui building/arrangement functions. to expound on this point: the CHU importer is a very small and simple file parsing plugin. you could easily write a similar plugin for any format capable of describing the required elements of a CHU interface, XML for example. Link to comment
Risto Posted March 5, 2013 Author Share Posted March 5, 2013 you can make them with dltcep. Thank you very much for the tip, it works. import GemRB from GUIDefines import * GMenu = 0 def OnLoad(): global GMenu GemRB.LoadWindowPack("GMENU") GMenu = GemRB.LoadWindow(0) NGameButton = GMenu.GetControl(0) SGameButton = GMenu.GetControl(1) LGameButton = GMenu.GetControl(2) GameOptionButton = GMenu.GetControl(3) AGameButton = GMenu.GetControl(4) QGameButton = GMenu.GetControl(5) GMenu.SetVisible(WINDOW_VISIBLE) return And the window just closes. Link to comment
Avenger Posted March 5, 2013 Share Posted March 5, 2013 you can make them with dltcep. You can also extend gemrb to get more gui building/arrangement functions. to expound on this point: the CHU importer is a very small and simple file parsing plugin. you could easily write a similar plugin for any format capable of describing the required elements of a CHU interface, XML for example. Actually, it would be interesting to have an xml representation of all binary files. Just for the 'fun'. Actually, to see if we could quickly implement the concept of The Broken Hourglass. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.