Side Text Box

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
Ragnos
Regular
Posts: 60
Joined: Thu Oct 27, 2016 3:22 pm
Contact:

Side Text Box

#1 Post by Ragnos » Mon Nov 07, 2016 4:42 pm

Like a bunch of other people I'm working on a Ren'py project! Who knew? Anyway, in my project the player goes through day to day stuff (Turns actually). The medieval city is constantly changing and every time the player starts another turn I wanted a text box in the bottom left corner that displays text of what has happened in the city recently. Here is an image to better elaborate on.

Image

When the player choose where to go (Thus the other buttons) a random event will be picked displaying the normal dialogue box with an image.

So how do I go about making the "Recent events" box?
Also, the "Recent Events" will be random as well.
Image

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Side Text Box

#2 Post by wyverngem » Tue Nov 08, 2016 3:27 pm

Here, this should get you started.

Code: Select all

init:
    $ x = 1066 #Screen size x
    $ y = 600 #Screen size y
    $ display_events = ""
    $ place = ""
    
screen recent_events:
    vbox:
        xalign 0.1
        yalign 1.0
        xminimum int(x*0.5)
        yminimum int(y*0.5)
        frame:
            text display_events
        
screen worldmap:
    modal True #Don't interact underneath it.
    frame:
        xfill True
        yfill True
        vbox:
            xalign 0.5
            yalign 0.5
            textbutton "Village" action [SetVariable('place', "Village"), Jump('random_events')]
            textbutton "Castle" action [SetVariable('place', ""), Jump('random_events')]
    use recent_events
    
label start:
    show screen worldmap
    
label worldmap:
    call screen worldmap
    jump worldmap

label random_events:
    $ RandomNum = renpy.random.randint(1,3)
    if RandomNum == 1:
        $ display_events = "This is my display event."
    elif RandomNum == 2: 
        $ display_events = "This is my display event."
    elif RandomNum == 3: 
        $ display_events = "This is my display event."
    else:
        $ display_events = ""
    if place == "Village":
        jump village
    else:
        "No place selected."
        jump worldmap
        
label village:
    "Do stuff in village. Go back to world map."
    jump worldmap

User avatar
Ragnos
Regular
Posts: 60
Joined: Thu Oct 27, 2016 3:22 pm
Contact:

Re: Side Text Box

#3 Post by Ragnos » Wed Nov 09, 2016 10:48 am

Thanks, I really appreciate it.
Image

Post Reply

Who is online

Users browsing this forum: No registered users