cWindow class
#1
Sad 
How to use a class cWindow. For example, I want to bring up the chest with /window, how can I do this?
Reply
Thanks given by:
#2
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.
Reply
Thanks given by: fankins
#3
Thanks for the answer! Using the command /testwnd everything works fine, but if you use after command /reload, the server crashing.
Reply
Thanks given by:
#4
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.
Reply
Thanks given by: fankins
#5
Thank you! I would like to know the correct size of windows for Chest,Workbench, etc.
Reply
Thanks given by:
#6
http://wiki.vg/Inventory#Windows
Reply
Thanks given by: fankins




Users browsing this thread: 4 Guest(s)