Shops (now with source)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Krazzikk
Posts: 37
Joined: Sat Mar 16, 2013 11:30 pm

Re: Shops (please test)

Post by Krazzikk »

Would you be able to gives us the WIP source?
User avatar
AdrTru
Posts: 223
Joined: Sat Jan 19, 2013 10:10 pm
Location: Trutnov, Czech Republic

Re: Shops (please test)

Post by AdrTru »

Your system looks very useful, but I dont know how it worked exactly :) ( when I tested it, i have many errors )

Could you make some .dungeon_editor files with life examples? Please.
My LOG2 projects: virtual money, Forge recipes, liquid potions and
MultiAlcoveManager, Toolbox, Graphic text,
alois
Posts: 112
Joined: Mon Feb 18, 2013 7:29 am

Re: Shops (please test)

Post by alois »

AdrTru wrote:Your system looks very useful, but I dont know how it worked exactly :) ( when I tested it, i have many errors )

Could you make some .dungeon_editor files with life examples? Please.
I realized I uploaded the gui.lua file but not the assets to make buttons/windows background... I'll add them to the original post!

As for a demo: .dat file and source.

There will be three buttons: the northern one shows a very simple dialog with two buttons; the western one shows a dialog with buttons, and the user is asked to answer a simple mathematical questions (nothing fancy :)): the number of correct/wrong answers is saved, and shown using hudPrint; the eastern button, instead, is a sort of utility: say you want to create a 600x600 window, and you want to make the 'standard' background using only one image (instead of several tiles as it is now in gui.lua); you can use the third button to 'build' a window/button background of the dimensions you want, take a photo of the screen, and edit it (in your favorite image retouching program™) to create a .tga (.dds) file to import inside LoG.

The code is commented; whatever you may need, feel free to ask!

alois :)
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Shops (please test)

Post by Drakkan »

nice introduction and examples of GUI dialogues, ggod work !
how are you progressing with shop ?
Breath from the unpromising waters.
Eye of the Atlantis
alois
Posts: 112
Joined: Mon Feb 18, 2013 7:29 am

Re: Shops (please test)

Post by alois »

Drakkan wrote:nice introduction and examples of GUI dialogues, ggod work !
how are you progressing with shop ?
Slowly, but steadily :)

I needed to add some 'tools': for example, a pop-up window which gets the focus of the mouse (you can only click on one of its buttons to dismiss it). To do that, I had to deal with the order in which gui elements are displayed and looked for clicks. Basically, as soon as you create an element, it is put in a list; then, the list is read from the first element to the last, and - in this order - every object in the list is drawn, together with its children. Thus, the first elements to be created are the first to be drawn (which is nice, because children often are 'superimposed' to parents). However, the same table dictates the order in which object is checked for mouse clicks, and the good order to do that is the opposite: first check the topmost objects (and stop if you find a click), then those which are below. Therefore, trouble: the pop-up window has to be on top of the others (i.e., it has to be created last), but in this way it is looked for clicks as the last one (and so - maybe - a click below is followed, which you do not want). My solution: create a 'huge' transparent layer ("screen") as the first thing, and 'activate' it every time there is a pop-up window. Since it is drawn (and there is nothing to draw!) first, it also intercepts clicks for first, stopping every other click.

I hop to be able to post something rather complete in a couple of days :)

alois :)
alois
Posts: 112
Joined: Mon Feb 18, 2013 7:29 am

Re: Shops (please test)

Post by alois »

Added a new 'Shoptest'.dat in the first post; as I say there, now it should be almost complete ('almost' being the keyword here).

alois :)
alois
Posts: 112
Joined: Mon Feb 18, 2013 7:29 am

Re: Shops (now with source)

Post by alois »

Added the source in the first message (with instructions, too!).

alois :)
alois
Posts: 112
Joined: Mon Feb 18, 2013 7:29 am

Re: Shops (now with source)

Post by alois »

Made small changes:
- items sold are added to the shop data and will be present (with higher prices...) the next time the shop is entered [adding them directly to the shop will be done in a second moment...];
- changed the folders for assets and 'rationalized' them;
- added a button to turn tooltips on and off.

See the first message of this thread for downloads.

alois :)
Ulfsark
Posts: 18
Joined: Sun May 05, 2013 5:52 pm

Re: Shops (now with source)

Post by Ulfsark »

Thank you so much for making/posting this.

I have been planning on making a mod that relies heavily on shops and this would be perfect for it.

Do you mind if I use your shop in my mod? I will give you credit of course.

Thanks!
alois
Posts: 112
Joined: Mon Feb 18, 2013 7:29 am

Re: Shops (now with source)

Post by alois »

Ulfsark wrote:Thank you so much for making/posting this.

I have been planning on making a mod that relies heavily on shops and this would be perfect for it.

Do you mind if I use your shop in my mod? I will give you credit of course.

Thanks!
Please, feel free to use it, and, should you need help, feel free to contact me!

alois :)
Post Reply