Displaying Variable In Tooltip While Hovering Over An Imagebutton

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
TRASHMARKET
Newbie
Posts: 6
Joined: Mon Feb 20, 2017 3:19 am
Contact:

Displaying Variable In Tooltip While Hovering Over An Imagebutton

#1 Post by TRASHMARKET »

screenshot0166.png
My game has a time limit. You have 72 in-game hours to achieve your goal. Time passes as you move around the map. The more distance you have to cross the more time passes, of course.

Code: Select all

init python:
    def EndCheck():
        global EndTime
        if EndTime <= 0:
            renpy.jump("Doomsday")
        elif EndTime >= 1:
            EndTime - 1
            
label start:
    
    $ EndTime = 72
    $ IAmHere = ""
    $ MapValue = 1
    $ NewLoc = 0.0
    $ TimePassed = 0.0
    
label Board:    
    scene bg southmap with Pixellate(1,10)
    show TimeLeft ("{color=#fff}{size=+10}%d{/size}\nHOURS\nUNTIL\nIMPACT{/color}" % EndTime) onlayer overlay
    show WhereAreYou ("{color=#fff}Current Location:\n%r{/color}" % IAmHere) onlayer overlay
    call screen SouthMap1
    $ EndCheck()



label Math:
    if MapValue == 0:
        $ renpy.jump(labelJump)
    elif MapValue == NewLoc:
        $ renpy.jump(labelJump)
    elif NewLoc >= MapValue:
        $ TimePassed = NewLoc - MapValue
        $ EndTime = EndTime - TimePassed
        scene bg black with Pixellate(1,10)
        $ FootstepSounds("ShortWalk")
        jump DiceRoll
    elif NewLoc <= MapValue:
        $ TimePassed = MapValue - NewLoc      
        $ EndTime = EndTime - TimePassed
        scene bg black with Pixellate(1,10)
        $ FootstepSounds("LongWalk")
        jump DiceRoll
label DiceRoll:
    $ d6roll = renpy.random.randint(1, 33)
    ### removed all the stuff that happens depending on the rolls

label Lighthouse:
    $ labelJump = "InvBeach"
    $ MapValue = 2
    $ IAmHere = "The Historic Lighthouse"
    scene bg lighthouse with Pixellate (1,10)
    $ EndCheck()
    jump InvBeach
      #### point and click adventure-style inspection happens here
	                 

screen SouthMap1:
    imagemap:
        ground 'bg-south-map1.png'
        idle 'bg-south-map2.png'
        hover 'bg-south-map-hover1.png'
        
        hotspot(224, 110, 33, 43) clicked SetVariable("labelJump", 'Jail'),SetVariable("NewLoc", 1), Jump('Math')
        hotspot(287, 109, 43, 53) clicked SetVariable("labelJump", 'Lighthouse'), SetVariable("NewLoc", 2), Jump('Math')
	## etc for the other locations
   
So I think I wanna start using imagebuttons instead of imagemaps. Pretty much have that figured out. But I'd like it if hovering on an imagebutton displayed a tooltip that shows the time it'll take to walk from your current location to another location. Could anyone please offer some tips? Thank you!

Also this is some real day one beginner stuff but how do I get the game to print the Current Location without the "u" and quotation marks?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]