[Solved]Hover one choice, dim other?

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
G0RG3h
Newbie
Posts: 17
Joined: Tue Nov 02, 2021 8:59 am
Projects: Circle Head
itch: g0rg3h
Contact:

[Solved]Hover one choice, dim other?

#1 Post by G0RG3h »

Hello, how can I make it so that when you hover over one choice item, the other will darken? I'm not sure where to start on attempting it myself so I can't share any code of my own. Thank you!
Last edited by G0RG3h on Sat Nov 20, 2021 7:52 pm, edited 1 time in total.
<<<<damn you len>>>>>

User avatar
zmook
Veteran
Posts: 421
Joined: Wed Aug 26, 2020 6:44 pm
Contact:

Re: Hover one choice, dim other?

#2 Post by zmook »

It's easier to brighten the choice you're currently hovering, if that works for you. Make the default image the dimmer version, and do:

Code: Select all

                                imagebutton:
                                    xysize 256,256
                                    idle dimmer_img
                                    hover brighter_img
                                    action ShowMenu("lore_entry", entry)
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM

User avatar
G0RG3h
Newbie
Posts: 17
Joined: Tue Nov 02, 2021 8:59 am
Projects: Circle Head
itch: g0rg3h
Contact:

Re: Hover one choice, dim other?

#3 Post by G0RG3h »

You're right, actually! Not sure why i thought that that qould be something to do when i could just do it manually. Thank you!

EDIT: Leaving this unsolved for anyone who would in the future like to show an actual way to do this. Thank you if you do, still!
<<<<damn you len>>>>>

drKlauz
Veteran
Posts: 239
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

Re: Hover one choice, dim other?

#4 Post by drKlauz »

Not sure if this is best way to do it, but why not :D

Code: Select all

init python:
  class button_effect_fn(object):
    def __init__(self,tt_id):
      super(button_effect_fn,self).__init__()
      self.tt_id=tt_id
    def __call__(self,tf,st,at):
      tt=GetTooltip()
      if tt==self.tt_id:
        tf.matrixcolor=BrightnessMatrix(0.0)
      elif isinstance(tt,basestring) and tt.startswith("{#btn_"):
        tf.matrixcolor=BrightnessMatrix(-0.25)
      else:
        tf.matrixcolor=None
      return 0

transform tf_button_effect(tt_id):
  function button_effect_fn(tt_id)

screen test():
  vbox:
    align (0.5,0.5)
    for n in range(0,5):
      $btn_id="{#btn_"+str(n)+"}"
      textbutton "Button #[n]":
        at tf_button_effect(btn_id)
        tooltip btn_id
        action NullAction()

label start:
  show screen test
  "test"
  return
Idea is set tooltip to buttons along with transform, in this transform we call function which check which tooltip is currently set and darken concurrent buttons.

But usually idle/hover imagebutton states should be good looking enough.
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350

User avatar
G0RG3h
Newbie
Posts: 17
Joined: Tue Nov 02, 2021 8:59 am
Projects: Circle Head
itch: g0rg3h
Contact:

Re: Hover one choice, dim other?

#5 Post by G0RG3h »

Thank you for the help! I just ended up making the buttons dim on default, enlarged the hover button and made it lighter, and made the font text bigger on hover and I got the illusion I wanted. Made it hard for myself for no reason, :? :? :? Haha!

For any novices not sure how to change hover text size (like me), I just added this line in the choice button gui section. Easy as pie.

Code: Select all

define gui.choice_button_text_hover_size = 35
<<<<damn you len>>>>>

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]