For a scenario I wanted to make a marketplace, where you can buy and sell different things. When I wanted to make a menue for it I realized I have no idea how. I'm on the controls branch. :o
The menu would be split into 2 parts. One for "You" and one for "Market". The "You"-side should have tabs on the left that list all containers near you. You can click on a container tab and it's contents are shown in a list in the "You"-window. When you click on a content, it will wander into the "selling/dump/monetize" tab of the market window. The other tab of the market window shows all items that are available to purchase. The menue keeps track of the values of sold/purchased items and indicates how much money you'll gain or loose by an arrow in the middle. On the bottom is the mandatory description window and a window with accept/exit buttons - preferably with hotkeys. It's basically a Fallout 3 - style trading dialogue... Compare the attachment.
My first question for now would be how to make a menue appear when you press E in front of the building. then I'm not sure how to proceed. :D Maybe splitting the menu into two sides. Then adding lists and tabs. But yeah making it show up in the first place is my problem atm. Yes I have looked for examples and I had a look at the producer library, but I don't understand wich part of the code is responsible for making the menu appear on screen. Is the stuff already documented somewhere? :D
The menu would be split into 2 parts. One for "You" and one for "Market". The "You"-side should have tabs on the left that list all containers near you. You can click on a container tab and it's contents are shown in a list in the "You"-window. When you click on a content, it will wander into the "selling/dump/monetize" tab of the market window. The other tab of the market window shows all items that are available to purchase. The menue keeps track of the values of sold/purchased items and indicates how much money you'll gain or loose by an arrow in the middle. On the bottom is the mandatory description window and a window with accept/exit buttons - preferably with hotkeys. It's basically a Fallout 3 - style trading dialogue... Compare the attachment.
My first question for now would be how to make a menue appear when you press E in front of the building. then I'm not sure how to proceed. :D Maybe splitting the menu into two sides. Then adding lists and tabs. But yeah making it show up in the first place is my problem atm. Yes I have looked for examples and I had a look at the producer library, but I don't understand wich part of the code is responsible for making the menu appear on screen. Is the stuff already documented somewhere? :D
I can write a more in-depth post when I am at home. But I wanted to say that I already have a finished market (including model) lying around somewhere :)
Btw, there is an introduction about the menus in the docs!
Btw, there is an introduction about the menus in the docs!
Ah thanks, through google I found it: http://wiki.openclonk.org/w/Script:_Menus
The code parts formatting is totally broken for me. How does it look to you?
The code parts formatting is totally broken for me. How does it look to you?
Mh, that's actually deprecated but I still cannot delete wiki pages...
The "real" documentation is now in the actual documentation, which is sadly not built for the Controls branch....
This here is my original documentation file, maybe it helps a bit for now..: http://pastebin.com/vFRMgCZr
The "real" documentation is now in the actual documentation, which is sadly not built for the Controls branch....
This here is my original documentation file, maybe it helps a bit for now..: http://pastebin.com/vFRMgCZr
PS: the menu on E is created by the object InteractionMenu in the HUD folder. It's a wrapper around the menu system
Do you want to use the default interaction menu or do you want to create an own menu?
With the default interaction menu, you can only change one side of the menu - you can currently not display f.e. value on the other side. Btw, you know that you can buy at the flag? The menu is only a little different from yours - just the layout and the missing sell functionality
PS: with the default interaction menu, you can basically add a sub-menu (like the "Inventory" menu or the "Sell" menu at the flag or the "Controls" menu at the pump) and fill that with custom entries - and you can manipulate the description box. But you cannot manipulate the rest of the layout
PPS: You could of course just add a "trade" button to the market (like the pump controls) that opens the trade dialog. Or you could add the buy/sell stuff both on the market's side.
Ooor, you could use the market's inventory as the "sell" part. So when you put stuff into the market, you mark it as "for sell" and when you sell, everything in the market disappears
With the default interaction menu, you can only change one side of the menu - you can currently not display f.e. value on the other side. Btw, you know that you can buy at the flag? The menu is only a little different from yours - just the layout and the missing sell functionality
PS: with the default interaction menu, you can basically add a sub-menu (like the "Inventory" menu or the "Sell" menu at the flag or the "Controls" menu at the pump) and fill that with custom entries - and you can manipulate the description box. But you cannot manipulate the rest of the layout
PPS: You could of course just add a "trade" button to the market (like the pump controls) that opens the trade dialog. Or you could add the buy/sell stuff both on the market's side.
Ooor, you could use the market's inventory as the "sell" part. So when you put stuff into the market, you mark it as "for sell" and when you sell, everything in the market disappears
Not really sure if this is the right place, but I'll post here anyway. Hazard has the option to change the firemode of a weapon. I could do this with 3 options:
- open firemode menu on right-clicking the weapon. Downside: You have to click on the new mode, because it does not support keyboard navigation yet.
- same, but with old style menu. Downside: looks not consistent.
- offer interaction with the weapon in the interaction menu (E), as a separate tab. Downside: Is very slow, menu blocks the whole screen. Upside: Best overview. Risk: Needs either a modification of the interaction menu (search for objects that are contained, too.) or must add menu entries to through the clonk (clonk collects info which additional menus to display from its contents - probably better than offering separate tabs).
Can you recommend anything?
- open firemode menu on right-clicking the weapon. Downside: You have to click on the new mode, because it does not support keyboard navigation yet.
- same, but with old style menu. Downside: looks not consistent.
- offer interaction with the weapon in the interaction menu (E), as a separate tab. Downside: Is very slow, menu blocks the whole screen. Upside: Best overview. Risk: Needs either a modification of the interaction menu (search for objects that are contained, too.) or must add menu entries to through the clonk (clonk collects info which additional menus to display from its contents - probably better than offering separate tabs).
Can you recommend anything?
Do you actually need a menu for this? What about a dedicated key which switches through weapon modes?
If you keep it close to the original from CR the change in weapon mode would empty your weapon and you have to reload first, so switching a few times to the desired mode is probably cumbersome.
The idea is good though: I could show a preview that you have to confirm by pressing the fire button.
The idea is good though: I could show a preview that you have to confirm by pressing the fire button.
> If you keep it close to the original from CR
I don't think that's a wise idea, overall. We had to make certain concessions to CR's limited capabilities. Or, to be more precise, we didn't even think about alternative ways to do something because it was impossible to do so anyway.
But since OC offers a lot more possibilities, you should consider easier or more convenient control styles.
I would say either as Luchs said you could make a dedicated key for it (like the 'P' Key in the Defense scenarios that open the shop) or simply add buttons for fire mode switching to the interface. I would prefer to combine these.
I would suggest the folllowing:
1. Add all weapons in the inventory into the interaction menu of the Clonk as an entry below the inventory. Add a hint "Use [T] to toggle the mode of the selected weapon" below that. I can make a sketch if you want.
2. Allow the player to use T (or any other key) to toggle the weapon mode. This should probably be without a confirmation. It should also work during reload so that you can just hit the button twice to get to the correct mode.
1. Add all weapons in the inventory into the interaction menu of the Clonk as an entry below the inventory. Add a hint "Use [T] to toggle the mode of the selected weapon" below that. I can make a sketch if you want.
2. Allow the player to use T (or any other key) to toggle the weapon mode. This should probably be without a confirmation. It should also work during reload so that you can just hit the button twice to get to the correct mode.
What is your state? If there are things in the libraries that are very hard to understand without proper documentation, I can of course write some. I just don't know where to put it yet...
I can't figure out how to open a menu of an object if you stand in front of it and hit E.
I have found
I have found
public func HasInteractionMenu() { return true; }
but that's all...
With
Then you can use
There you can specify a callback that yields the menu items. See for example the flag's
You can either just return definitions ("IDs") there and have a default menu, or return a custom design.
PS: if you want to update all currently opened menus of a specific category for all players (because f.e. the items in the market change), you can use
For example, the flag does
HasInteractionMenu
the object should already be shown in the GUI, right? (If it's a structure or vehicle at least).Then you can use
GetInteractionMenus
to specify which different sub menus you want to have (f.e. production/selling/bla). See f.e. the pump.There you can specify a callback that yields the menu items. See for example the flag's
GetBuyMenuEntries
.You can either just return definitions ("IDs") there and have a default menu, or return a custom design.
PS: if you want to update all currently opened menus of a specific category for all players (because f.e. the items in the market change), you can use
UpdateInteractionMenus
.For example, the flag does
UpdateInteractionMenus(this.GetBuyMenuEntries);
when someone buys stuff. This updates only the buy menu items.
Aaaaa it didn't work, because it wasn't a C4D_Structure! :D
Thanks now I can start experimenting.
Thanks now I can start experimenting.
>Then you can use GetInteractionMenus to specify which different sub menus you want to have
Can I somehow create a clean, empty menu from sketch? I want to have my own menu and fill it with subwindows.
Inside the interaction menu or as a standalone?
As a standalone, you can just use GuiOpen, like the hammer does.
As a standalone, you can just use GuiOpen, like the hammer does.
Okay, so the hammer uses
ControlUseStart()
to initialize the menu. But what function do I use when it should be opened with pressing E in front of the building? :o
It's not really intended that buildings don't want to integrate into the interaction menu.
You could either add a button in the "normal" interaction menu that opens the new menu ("Start Trading!") oooor you could use the default Clonk interaction (like when grabbing a lorry or plucking a mushroom). For that you'd use
And I just noticed I don't like the naming of these functions, meh.
You could either add a button in the "normal" interaction menu that opens the new menu ("Start Trading!") oooor you could use the default Clonk interaction (like when grabbing a lorry or plucking a mushroom). For that you'd use
IsInteractable
, GetInteractionMetaInfo
and Interact
like in the crop library.And I just noticed I don't like the naming of these functions, meh.
Controls is merged now. So the documentation is now here:
http://docs.openclonk.org/en/sdk/script/GUI.html
http://docs.openclonk.org/en/sdk/script/GUI.html
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill