Uncle MUgen's imagemap GUI template help

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
AERenoir
Veteran
Posts: 318
Joined: Fri May 27, 2011 8:23 pm
Contact:

Uncle MUgen's imagemap GUI template help

#1 Post by AERenoir » Fri Sep 06, 2013 9:06 am

From here: http://lemmasoft.renai.us/forums/viewto ... 75#p269679

Was I supposed to copy-paste the codes manually? Because when I tried to launch the game as-is it gives me an error.

Also, I want the slider bars in the preferences to have a "slider thumb". You know, this:
renpyprefa.jpg
renpyprefa.jpg (36.97 KiB) Viewed 1963 times
How do I do that with this GUI template?

User avatar
Viobli
Regular
Posts: 66
Joined: Fri Jun 07, 2013 2:25 am
Projects: *Truly, Friends *Lady Eun-mi
Contact:

Re: Uncle MUgen's imagemap GUI template help

#2 Post by Viobli » Fri Sep 06, 2013 11:30 pm

Hmm, I don't have the same code as Uncle Mugen, but this is what I do for my thumb to appear:

Code: Select all

init -2 python:
    style.pref_slider.thumb = "GUI/thumb.jpg"
It should be able to work the same way. Hope this helps!
Image

User avatar
AERenoir
Veteran
Posts: 318
Joined: Fri May 27, 2011 8:23 pm
Contact:

Re: Uncle MUgen's imagemap GUI template help

#3 Post by AERenoir » Sat Sep 07, 2013 12:48 pm

Does it work even for hotbars on imagemap preferences? Because that's what I'm using. A customized imagemap preference screen >.<

User avatar
Viobli
Regular
Posts: 66
Joined: Fri Jun 07, 2013 2:25 am
Projects: *Truly, Friends *Lady Eun-mi
Contact:

Re: Uncle MUgen's imagemap GUI template help

#4 Post by Viobli » Sat Sep 07, 2013 9:03 pm

AERenoir wrote:Does it work even for hotbars on imagemap preferences? Because that's what I'm using. A customized imagemap preference screen >.<
I tested it myself and it does work on both imagemap and imagebuttons.
Image

Elmiwisa
Veteran
Posts: 476
Joined: Sun Jul 21, 2013 8:08 am
Contact:

Re: Uncle MUgen's imagemap GUI template help

#5 Post by Elmiwisa » Sat Sep 07, 2013 9:49 pm

Viobli wrote:
AERenoir wrote:Does it work even for hotbars on imagemap preferences? Because that's what I'm using. A customized imagemap preference screen >.<
I tested it myself and it does work on both imagemap and imagebuttons.
Hotbar are specifically indicated to not have thumb, and will ignore any style settings about thumb.

User avatar
Viobli
Regular
Posts: 66
Joined: Fri Jun 07, 2013 2:25 am
Projects: *Truly, Friends *Lady Eun-mi
Contact:

Re: Uncle MUgen's imagemap GUI template help

#6 Post by Viobli » Sat Sep 07, 2013 10:26 pm

Elmiwisa wrote:
Viobli wrote:
AERenoir wrote:Does it work even for hotbars on imagemap preferences? Because that's what I'm using. A customized imagemap preference screen >.<
I tested it myself and it does work on both imagemap and imagebuttons.
Hotbar are specifically indicated to not have thumb, and will ignore any style settings about thumb.
Hmm, strangely it worked for me. I did some more searching, so if it doesn't work, this thread might be helpful: http://lemmasoft.renai.us/forums/viewto ... for+hotbar
Image

Elmiwisa
Veteran
Posts: 476
Joined: Sun Jul 21, 2013 8:08 am
Contact:

Re: Uncle MUgen's imagemap GUI template help

#7 Post by Elmiwisa » Sat Sep 07, 2013 10:44 pm

Viobli wrote: Hmm, strangely it worked for me. I did some more searching, so if it doesn't work, this thread might be helpful: http://lemmasoft.renai.us/forums/viewto ... for+hotbar
That thread also said that it does not work for hotbar. Did you use hotbar or bar in your code?

User avatar
Viobli
Regular
Posts: 66
Joined: Fri Jun 07, 2013 2:25 am
Projects: *Truly, Friends *Lady Eun-mi
Contact:

Re: Uncle MUgen's imagemap GUI template help

#8 Post by Viobli » Sat Sep 07, 2013 11:07 pm

Elmiwisa wrote:
Viobli wrote: Hmm, strangely it worked for me. I did some more searching, so if it doesn't work, this thread might be helpful: http://lemmasoft.renai.us/forums/viewto ... for+hotbar
That thread also said that it does not work for hotbar. Did you use hotbar or bar in your code?
Ahh my deepest apologies, I guess I was a little mixed up. Checking back, I was using bar for my code. Sorry for the confusion.
Image

User avatar
AERenoir
Veteran
Posts: 318
Joined: Fri May 27, 2011 8:23 pm
Contact:

Re: Uncle MUgen's imagemap GUI template help

#9 Post by AERenoir » Sun Sep 08, 2013 12:19 am

Ooh, okay. I guess thumbs won't work, then :(

Elmiwisa
Veteran
Posts: 476
Joined: Sun Jul 21, 2013 8:08 am
Contact:

Re: Uncle MUgen's imagemap GUI template help

#10 Post by Elmiwisa » Sun Sep 08, 2013 1:08 am

If you love thumb on hotbar so much, why don't you make your own version of hotbar? Just copy the code from the engine and make some modification...
For example, you can add this code to the top of the file screens.rpy:

Code: Select all

init python:
    def _hotbar_thumb(spot, adjustment=None, range=None, value=None, **properties):

        if (adjustment is None) and (range is None) and (value is None):
            raise Exception("hotbar requires either an adjustment or a range and value.")

        if not ui.imagemap_stack:
            raise Exception("hotbar expects an imagemap to be defined.")

        imagemap = ui.imagemap_stack[-1]

        x, y, w, h = spot

        properties.setdefault("xpos", x)
        properties.setdefault("ypos", y)
        properties.setdefault("xanchor", 0)
        properties.setdefault("yanchor", 0)

        fore_bar=imagemap.cache.crop(imagemap.selected_idle, spot)
        aft_bar=imagemap.cache.crop(imagemap.idle, spot)
        hover_fore_bar=imagemap.cache.crop(imagemap.selected_hover, spot)
        hover_aft_bar=imagemap.cache.crop(imagemap.hover, spot)

        if h > w:
            properties.setdefault("bar_vertical", True)
            properties.setdefault("bar_invert", True)

            fore_bar, aft_bar = aft_bar, fore_bar
            hover_fore_bar, hover_aft_bar = hover_aft_bar, hover_fore_bar
        
        return renpy.display.behavior.Bar(
                adjustment=adjustment,
                range=range,
                value=value,            
                fore_bar=fore_bar,
                aft_bar=aft_bar,
                hover_fore_bar=hover_fore_bar,
                hover_aft_bar=hover_aft_bar,
                fore_gutter=0,
                aft_gutter=0,
                bar_resizing=False,
                xmaximum=w,
                ymaximum=h,
                **properties)
    ui.hotbar=ui.Wrapper(_hotbar_thumb,style="hotbar",replaces=True)
And then to set the thumb do something like this:

Code: Select all

style.hotbar.thumb="thumb.png"

User avatar
AERenoir
Veteran
Posts: 318
Joined: Fri May 27, 2011 8:23 pm
Contact:

Re: Uncle MUgen's imagemap GUI template help

#11 Post by AERenoir » Sun Sep 08, 2013 5:19 am

Wow, that's cool! Thanks so much!

So this goes above everything else in screen.rpy? And what about the codes for the hotbar I already set up? Do I need to change them or this extra code would just makes the thumb slider work on a hotbar?

Elmiwisa
Veteran
Posts: 476
Joined: Sun Jul 21, 2013 8:08 am
Contact:

Re: Uncle MUgen's imagemap GUI template help

#12 Post by Elmiwisa » Sun Sep 08, 2013 9:33 am

AERenoir wrote:Wow, that's cool! Thanks so much!

So this goes above everything else in screen.rpy? And what about the codes for the hotbar I already set up? Do I need to change them or this extra code would just makes the thumb slider work on a hotbar?
Eh...it's nothing much. The code look long, but it is actually just the original Ren'Py code with a few minor modification.
Put the code on top of the file screens.rpy, before everything else.
It will automatically make the hotbar to be able to have a thumb, so you do not need to modify your hotbar code. You still have to add in the code to select how the thumb look like however, which is something like:

Code: Select all

init -2 python:
    style.hotbar.thumb="thumb.png"

User avatar
AERenoir
Veteran
Posts: 318
Joined: Fri May 27, 2011 8:23 pm
Contact:

Re: Uncle MUgen's imagemap GUI template help

#13 Post by AERenoir » Sun Sep 08, 2013 10:57 am

Thaa~nks!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Ocelot