Choices in textbox, tried hyperlinks, elmiwisa code but there's issues with saving

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
Aracade
Regular
Posts: 34
Joined: Thu Mar 30, 2017 11:04 am
Completed: A Monster's Insight, LUNACY, Gulam
Github: arkicade
itch: arkicade
Contact:

Choices in textbox, tried hyperlinks, elmiwisa code but there's issues with saving

#1 Post by Aracade »

Right now I'm making a game and I'd like there to be choices within the textbox:
Here's an example to illustrate this:
the blue is when the text is hovered over
the blue is when the text is hovered over
I've tried to do this using 2 ways of which none of them have fully worked.

1: Hyperlinks
The issue I had with hyperlinks is that once you've saved AFTER a choice (or 2 sets of hyperlinks).
If you were to go load the game where you previously saved, it would take you back to the hyperlinks.

EXAMPLE:
Explain.png
At point A there's a series of options.
If you were to save at point B and then LATER reload the game (that was saved at point B),
instead of taking you to point B (where you saved) it would take you to point A instead.

Even at point D which is after another set of choices (that being point C) it will still take you
back to point A.

If you were to go to the Tutorial where Eileen is explaining about text tags, if you were to save AFTER clicking the hyperlink (in the definition screen), if you were to reload the game it would take you back to the hyperlink.

I was wondering if there was anyway that when saving it wouldn't take you back to the hyperlink and you could just save regularly?
If that's just how hyperlinks work and there's not a clear way to fix it hopefully there could be a solution to the second problem.

2: Modifying choice screen with new code
In this forum viewtopic.php?t=23345 people discussed putting choices in the textbox(the same problem I have)!

Unfortunately after a solution was given in this thread I added the code, carried out all the instruction but WHEN SAVING this error appears:

I'm sorry, but an uncaught exception occurred.

While running game code:
File "renpy/common/00gamemenu.rpy", line 173, in script
$ ui.interact()
File "renpy/common/00gamemenu.rpy", line 173, in <module>
$ ui.interact()
File "renpy/common/00action_file.rpy", line 357, in __call__
renpy.save(fn, extra_info=save_name)
PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed


I was hoping that anyone may have any solutions to this "choices in textbox" problem that also doesn't cause any issues in terms of SAVING the game
^^;

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Choices in textbox, tried hyperlinks, elmiwisa code but there's issues with saving

#2 Post by gas »

Change the APPEARANCE of the menu using the same window as the dialogue.
Is only a graphical thing...
If you want to keep both kind of menus, standard and dialogue.like, use a variable to show them differently. I can't post a code right now, but again is just a matter of arranging stuff, not change the standard menu.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Choices in textbox, tried hyperlinks, elmiwisa code but there's issues with saving

#3 Post by xavimat »

EDIT: Add this line:

Code: Select all

define config.hyperlink_protocol = "jump"

You can try using the text tag {a} with jump:

Code: Select all

"What was it like?\n{a=jump:comical}> Tell a comical retelling{/a}\n{a=jump:another}Tell it like it was and choose another subject{/a}"
I've tried this code and saving/loading seems to work OK:

Code: Select all

label start:

    "Hey, I'm saying in start:\n> {a=jump:opt1}Option 1{/a}\n> {a=jump:opt2}Option2{/a}"
    jump start

label opt1:
    "Some text to say in opt1"
    jump opt1_menu
label opt1_menu:
    "Time to decide in OPT1:\n> {a=jump:opt3}Option 3{/a}\n> {a=jump:opt3}Option4{/a}"
    jump opt1_menu

label opt2:
    "Some text to say in opt2"
    jump opt2_menu
label opt2_menu:
    "Time to decide in OPT2:\n> {a=jump:opt5}Option 5{/a}\n> {a=jump:opt6}Option6{/a}"
    jump opt2_menu

label opt3:
    "Some text to say in opt3"
    "THE END"
    return
label opt4:
    "Some text to say in opt4"
    "THE END"
    return
label opt5:
    "Some text to say in opt5"
    "THE END"
    return
label opt6:
    "Some text to say in opt6"
    "THE END"
    return
The normal {a} jump is creating a new context. See the doc:
If there is no protocol section in the argument, config.hyperlink_protocol is prepended to it. If config.hyperlink_protocol has been set to "jump", {a=label} and {a=jump:label} become equivalent. Creators can define new protocols using config.hyperlink_handlers.

define config.hyperlink_protocol = "call_in_new_context"
The protocol that is used for hyperlinks that do not have a protocol assigned to them. See the a text tag for a description as to what the possible protocols mean.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
Aracade
Regular
Posts: 34
Joined: Thu Mar 30, 2017 11:04 am
Completed: A Monster's Insight, LUNACY, Gulam
Github: arkicade
itch: arkicade
Contact:

Re: Choices in textbox, tried hyperlinks, elmiwisa code but there's issues with saving

#4 Post by Aracade »

I've tried this code and saving/loading seems to work OK:
The normal {a} jump is creating a new context. See the doc:
If there is no protocol section in the argument, config.hyperlink_protocol is prepended to it. If config.hyperlink_protocol has been set to "jump", {a=label} and {a=jump:label} become equivalent. Creators can define new protocols using config.hyperlink_handlers.

define config.hyperlink_protocol = "call_in_new_context"
The protocol that is used for hyperlinks that do not have a protocol assigned to them. See the a text tag for a description as to what the possible protocols mean.
Thank you so much Xavimat! Saving and loading has been a-okay!
And I don't see any problems with your code so far...
I also saw in the other thread the link to the new and updated text tags page which I will have a good read over. :)

Post Reply

Who is online

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