Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.


Visit our new games list, blog aggregator, IRC, and wiki.
Activation problem? Email [email protected]
It is currently Thu Jun 20, 2013 6:30 am

All times are UTC - 5 hours [ DST ]


Forum rules


Ask questions about one topic per thread, and use a descriptive subject. "NotImplemented error in script.rpy" is a good subject, "Tom's problems" is not. Remember to include all of traceback.txt or error.txt when reporting a problem, as well as the relevant lines of script. Use the [code] tag to format scripts.



Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: I don't get screens
PostPosted: Sun May 13, 2012 6:21 am 
Regular
User avatar

Joined: Wed May 09, 2012 2:49 am
Posts: 106
Location: Now: Amherst, MA
Projects: A VN to serve as my thesis
I'm trying to add a "phone menu" of sorts with three screens: a main one that shows the player's information, a contacts page to see other characters' information, and a messaging screen for texts (which will involve more screens, but if I can make one, I can make any number).

Trouble is, I really don't get how screens work. The wiki has all this about screen language, but the cookbook's information screen doesn't speak a word on screen language, and other than those two the documentation isn't all that thorough. I'm trying to avoid hackey work-arounds because they're, well, hackey and work-arounds.

I have some nonsense written in screen language, but apparently that alone doesn't do anything because you need a label to call it or something but then it doesn't go away if you use the screen-language return function and it's all very nonsensical, so I'd like to start from scratch on the screens.

I'd like to have it setup the same way the main menu works, but I also don't want it to overwrite everything that's already on screen. Does that make sense? In the final, pretty version with things like images, I want the player to be able to click a button and open their "phone," which will open an overlay that looks, well, like a phone, with everything relevant like buttons and information on that overlay. If that's probably too complicated I can simplify the system, but that's what I'd like. I'm not new to coding, I just can't seem to wrap my head around screen building.


Top
 Profile Send private message  
 
 Post subject: Re: I don't get screens
PostPosted: Sun May 13, 2012 12:07 pm 
Regular

Joined: Wed Nov 23, 2011 5:30 pm
Posts: 82
Okay, screens are a mildly complex subject.

If you have absolutely no idea how to use or make screens, take a look at a small screen I use in my current project:
Code:
screen datescreen:
    modal False
    if daytime == 0:
        $ labeltext = "Morning"
    if daytime == 1:
        $ labeltext = "Noon"
    if daytime == 2:
        $ labeltext = "Evening"
    if daytime == 3:
        $ labeltext = "Night"
    $ cd = "Day %d"%current_day
    frame:
        xalign .0
        xanchor .0
        yalign .0
        yanchor .0
        vbox:
            label cd
            label labeltext


modal False makes it so that the screen is just there and doesn't block input anywhere else (if I'm not mistaken, it worked for me that way). So while this screen is visible, you can advance the script by clicking and so on.

labeltext is just a variable I use.

frame is where the magic starts. It makes a frame (really!?) that will include:
a vbox, a vertical box, i.e. a column in which the following content will be put one under another.
This vbox includes two labels, which are not to be confused with the label statement from the novel script. These labels are just literally visible labels displaying something on the screen.

To display this screen, you use
Code:
show screen datescreen


I hope this gives you first pointers about how to start.


Top
 Profile Send private message  
 
 Post subject: Re: I don't get screens
PostPosted: Tue May 15, 2012 10:33 am 
Regular
User avatar

Joined: Wed May 09, 2012 2:49 am
Posts: 106
Location: Now: Amherst, MA
Projects: A VN to serve as my thesis
I guess I should be more specific. Reading over that first post again, I must have been pretty burnt out.

I have the screen itself made (prototyped), but it's the making it appear and vanish and such. That said, though, it's good to know at least I did the construction right.

The thing I'm having the most trouble with is having it show up without calling a new label in the script and vanishing when I tell it to. Copying the closing functions from the main menu in screens.rpy didn't work. While it did return control to the background (I set Modal to true, because I don't want people advancing while their on the phone), it didn't hide the screen and caused some weird behavior involving jumping to a label without calling it and returning to the main menu.

I suppose my real question then is: How do I make my screen behave like the main menu, where I have players press a button to call it, navigate it within a menu built into the screen, and put it away cleanly?

_________________
The more you know


Top
 Profile Send private message  
 
 Post subject: Re: I don't get screens
PostPosted: Tue May 15, 2012 10:51 am 
Miko-Class Veteran
User avatar

Joined: Tue Jul 24, 2007 12:58 pm
Posts: 526
The way I've been doing it is sticking people in an infinite loop that they can only jump out of with the screen. That's probably not the best way to do it... But it seems to work. Something like:

Code:
    show screen phone

    label dialling:

        "Who do you call?"
        jump dialling


Then any place they jump to via the screen starts off with a hide screen.


Top
 Profile Send private message  
 
 Post subject: Re: I don't get screens
PostPosted: Tue May 15, 2012 2:23 pm 
Regular

Joined: Wed Nov 23, 2011 5:30 pm
Posts: 82
Making the screen modal will also stop players from doing anything that isn't coded inside the screen. You should probably make it non-modal and use your phone screen to change variables that will call a label, and when they hang up, leave the perma-loop, like Showsni said.

The basic idea with such an interface is always to have a framework that when called up repeats itself until it's no longer needed.


Top
 Profile Send private message  
 
 Post subject: Re: I don't get screens
PostPosted: Wed May 16, 2012 9:21 am 
Regular
User avatar

Joined: Wed May 09, 2012 2:49 am
Posts: 106
Location: Now: Amherst, MA
Projects: A VN to serve as my thesis
Alright, I'll try that out, but while we're still here:

Which "return" should I be using? The one you just call in the usual dialog script seems to behave differently than the one built into screen language, and what exactly is that difference? What do they do? When I call return in the standard script, it always goes back to the title menu, which is not what I want, as you might imagine. How do I go about having the screen go away and putting the player right back where they were before opening it?

_________________
The more you know


Top
 Profile Send private message  
 
 Post subject: Re: I don't get screens
PostPosted: Wed May 16, 2012 6:18 pm 
Veteran
User avatar

Joined: Sun Feb 12, 2012 9:17 am
Posts: 332
Location: USA
Completed: Locked-In, Young Earth Road Trip, The Cards Never Lie
Projects: The Censor
Red Horizon has a setup where the player can click an overlay icon and go into the ship's OS. The overlay buttons use ui.callsinnewcontext to a label, which then calls the screen.

Code:
if navigation_true:
                ui.imagebutton("icons/csfnet.png", "icons/csfnet_hover.png", clicked=ui.callsinnewcontext("console"), xminimum=20)

label console:
    call screen console
    return


Once they're in the OS, all the screens (which are all tagged frame) are called using Show, and when they want to leave they click a Return.

Code:
        textbutton "Messages" clicked Show("messages")  text_style "csfnet"
        textbutton "Console" clicked Show("console") text_style "csfnet"
        textbutton "Navigation" clicked Show("shipmap") text_style "csfnet"
        textbutton "Exit" clicked Return() text_style "csfnet"


Does this help?

I have also BSed a fake email system and a fake IM system using screens within those screens (using Show/Hide, tag window, modal True). The scripting would probably make the vets around here scream, but it works in the sense that things pop up/go away when told to and I understand it.

_________________
Lucky Special Games - Locked-In - Young Earth Road Trip - The Censor (Nano 2013) WIP


Top
 Profile Send private message  
 
 Post subject: Re: I don't get screens
PostPosted: Sat May 19, 2012 6:28 am 
Regular
User avatar

Joined: Wed May 09, 2012 2:49 am
Posts: 106
Location: Now: Amherst, MA
Projects: A VN to serve as my thesis
Works beautifully (though being a prototype it doesn't look all the pretty) . Thanks a lot.

_________________
The more you know


Top
 Profile Send private message  
 
 Post subject: Re: I don't get screens
PostPosted: Sat May 19, 2012 6:43 am 
Regular
User avatar

Joined: Wed May 09, 2012 2:49 am
Posts: 106
Location: Now: Amherst, MA
Projects: A VN to serve as my thesis
Okay, another question (sorry about all of these. The screen language isn't well explained on the wiki...)

How do I make a bar statement not return an "expected keyword argument, colon, or end of line" error?

it's within a vbox within a frame within a screen, and looks like this:

Code:
bar 20.0, ShoSoul.Anger


I've tried various combinations of parenthesis and comma use. they all return errors

_________________
The more you know


Top
 Profile Send private message  
 
 Post subject: Re: I don't get screens
PostPosted: Sat May 19, 2012 9:12 am 
Regular

Joined: Wed Nov 23, 2011 5:30 pm
Posts: 82
Example of a bar I used:
Code:
bar range 100 value character_strength xmaximum 100

So try:
Code:
bar range 20 value ShoSoul.Anger xmaximum 100


xmaximum is kind of the length of the bar in pixels, while range is the value of the bar at xmaximum. Note that the bar will "overextend" if value surpasses range.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Protected by Anti-Spam ACP
Powered by phpBB® Forum Software © phpBB Group