How to use a class cWindow. For example, I want to bring up the chest with /window, how can I do this?
cWindow class
|
You cannot use cWindow directly, it is only a base class from which all windows are inherited. You need to use cLuaWindow. Note that it inherits all cWindow's functions.
For a simple example on showing windows as reactions to commands, see the Debuggers plugin (distributed as built-in with MCServer / https://code.google.com/p/mc-server/sour...uggers.lua ), it has a "/testwnd" command that shows a window filled with custom items and has some processing when the window is closed. You can safely ignore the GCOnTick-related stuff, that's only for internal testing purposes. In case you are wondering why it is so, why two classes, here's the explanation: It is planned that we'll add a hook that will fire each time a window is opened, closed, or clicked. But MCServer uses different classes than cLuaWindow, so it wouldn't have a cLuaWindow instance to hand to that hook. Instead, we chose to have a common ancestor for all windows, so that all windows can be manipulated the same way. That's the cWindow class. Thanks given by: fankins
07-11-2013, 04:45 AM
Thanks for the answer! Using the command /testwnd everything works fine, but if you use after command /reload, the server crashing.
07-11-2013, 10:21 PM
I have just written the documentation for both cWindow and cLuaWindow into the wiki:
http://mc-server.org/wiki/doku.php?id=api:cwindow http://mc-server.org/wiki/doku.php?id=api:cluawindow I'll have a look at the crash later on. Thanks given by: fankins
07-12-2013, 02:20 AM
Thank you! I would like to know the correct size of windows for Chest,Workbench, etc.
07-12-2013, 04:22 AM
Thanks given by: fankins
|
« Next Oldest | Next Newest »
|
Users browsing this thread: 3 Guest(s)