Persistent Data Question

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
chikotsukino
Regular
Posts: 58
Joined: Sun May 31, 2009 8:28 pm
Projects: Angels
Contact:

Persistent Data Question

#1 Post by chikotsukino »

Ok
so how can i get this picture to come up after the main menu

http://i221.photobucket.com/albums/dd29 ... rymenu.jpg

I dont want it like a picture to be part of the actual game itself
I want it to be like you can choose one of those three words on the picture for each different story
How do I make them clickable so that you click whichever story you want to play?
Also how do I set it so that you can only go to the "Memories" portion after you get 3 good endings in the "Wishes" portion
Same for you have to get one good ending in the "Memories" portion to go into the "Angels" portion

Alex

Re: Persistent Data Question

#2 Post by Alex »

You can try imagemap
http://www.renpy.org/wiki/renpy/doc/ref ... y.imagemap
and persistent data
http://www.renpy.org/wiki/renpy/doc/ref ... stent_Data
And it looks like:

Code: Select all

label start:
    $ result = renpy.imagemap{"your_pictur.png", 

"your_pictur_with_all_words_selected.png", [(x1, 

y1, x2, y2, "Wishes"), (x1, y1, x2, y2, 

"Memories"), (x1, y1, x2, y2, "Angels"), ])
    # instead of x and y you should place your coordinates

    if result == "Wishes":
        jump Wishes
    elif result == "Memories":
        if persistent.good_endings_in_Wishes < 3: # here we check if player got enough good endings for Wishes
            jump start
        else:
            jump Memories
    else:
        if persistent.good_endings_in_Memories < 1: # here we check if player got enough good endings for Memories
            jump start
        else:
            jump Angels

label Wishes:
    some code
    $ persistent.good_endings_in_Wishes +=1 # got one good ending

label Wishes:
    some code
    $ persistent.good_endings_in_Memories +=1 # got one good ending

label Angels:
    some code

chikotsukino
Regular
Posts: 58
Joined: Sun May 31, 2009 8:28 pm
Projects: Angels
Contact:

Re: Persistent Data Question

#3 Post by chikotsukino »

Ok so this is the code I am currently using

Code: Select all

$ result = renpy.imagemap("story menu.jpg", "story map hover.jpg" [
            (256, 54, 358, 92, "Wishes"), 
            (289, 153, 418, 191, "Memories"),
            (315, 233, 418, 269, "Angels")
        ])    
        if result == "Wishes":
            jump Wishes
        elif result == "Memories":
            if persistent.good_endings_in_Wishes < 3:
                jump start
            else:
                jump Memories
        else:
            if persistent.good_endings_in_Memories < 1:
                jump start
            else:
                jump Angels

and this error comes up

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


On line 34 of C:\Documents and Settings\John\Desktop\renpy-6.9.2\Angels/game/script.rpy: one-line python statement does not expect a block. Please check the indentation of the line after this one.
$ result = renpy.imagemap("story menu.jpg", "story map hover.jpg" [
            (256, 54, 358, 92, "Wishes"), 
            (289, 153, 418, 191, "Memories"),
            (315, 233, 418, 269, "Angels")
        ])    

Ren'Py Version: Ren'Py 6.9.2a
i've checked the spacing and they are all 4 apart (unless i miscounted somewhere)
what's wrong?

KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: Persistent Data Question

#4 Post by KimiYoriBaka »

Code: Select all

$ result = renpy.imagemap("story menu.jpg", "story map hover.jpg" [
            (256, 54, 358, 92, "Wishes"), 
            (289, 153, 418, 191, "Memories"),
            (315, 233, 418, 269, "Angels")
        ])    
        if result == "Wishes":
is this if statement alligned with the bracket in your actual code as well? if so, it needs to be alligned with the dollar sign instead.

chikotsukino
Regular
Posts: 58
Joined: Sun May 31, 2009 8:28 pm
Projects: Angels
Contact:

Re: Persistent Data Question

#5 Post by chikotsukino »

that was one problem but i fixed it and another problem

Code: Select all

$ result = renpy.imagemap("story menu.jpg", "story map hover.jpg" [
            (256, 54, 358, 92, "Wishes"), 
            (289, 153, 418, 191, "Memories"),
            (315, 233, 418, 269, "Angels")
        ])    
    if result == "Wishes":
        jump Wishes
    elif result == "Memories":
        if persistent.good_endings_in_Wishes < 3:
            jump start
        else:
            jump Memories
    else:
        if persistent.good_endings_in_Memories < 1:
            jump start
        else:
            jump Angels
problem

Code: Select all

I'm sorry, but an exception occured while executing your Ren'Py
script.

TypeError: string indices must be integers

While running game code:
 - script at line 34 of C:\Documents and Settings\John\Desktop\renpy-6.9.2\Angels/game/script.rpy
 - python at line 37 of C:\Documents and Settings\John\Desktop\renpy-6.9.2\Angels/game/script.rpy.

-- Full Traceback ------------------------------------------------------------

  File "C:\Documents and Settings\John\Desktop\renpy-6.9.2\renpy\bootstrap.py", line 255, in bootstrap
  File "C:\Documents and Settings\John\Desktop\renpy-6.9.2\renpy\main.py", line 308, in main
  File "C:\Documents and Settings\John\Desktop\renpy-6.9.2\renpy\main.py", line 92, in run
  File "C:\Documents and Settings\John\Desktop\renpy-6.9.2\renpy\execution.py", line 230, in run
  File "C:\Documents and Settings\John\Desktop\renpy-6.9.2\renpy\ast.py", line 558, in execute
  File "C:\Documents and Settings\John\Desktop\renpy-6.9.2\renpy\python.py", line 921, in py_exec_bytecode
  File "C:\Documents and Settings\John\Desktop\renpy-6.9.2\Angels/game/script.rpy", line 37, in <module>
TypeError: string indices must be integers

While running game code:
 - script at line 34 of C:\Documents and Settings\John\Desktop\renpy-6.9.2\Angels/game/script.rpy
 - python at line 37 of C:\Documents and Settings\John\Desktop\renpy-6.9.2\Angels/game/script.rpy.

Ren'Py Version: Ren'Py 6.9.2a


whats an integer?

Dusty
Regular
Posts: 126
Joined: Fri Jul 25, 2008 11:51 pm
Contact:

Re: Persistent Data Question

#6 Post by Dusty »

You missed a comma. Changing the first bit to

Code: Select all

$ result = renpy.imagemap("story menu.jpg", "story map hover.jpg", [
            (256, 54, 358, 92, "Wishes"), 
            (289, 153, 418, 191, "Memories"),
            (315, 233, 418, 269, "Angels")
        ])
should make it work better.
chikotsukino wrote: whats an integer?
It's a type of number. The error doesn't really have anything to do with numbers, though,... it's just that the computer got confuzzl'd.

chikotsukino
Regular
Posts: 58
Joined: Sun May 31, 2009 8:28 pm
Projects: Angels
Contact:

Re: Persistent Data Question

#7 Post by chikotsukino »

oh yay thank you :)
i always miss commas >_<
thanks for all your help everyone ^-^

Post Reply

Who is online

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