Thanks to m_from_space for giving me an excellent tip on how to reuse screens.
And also thanks to jeffster for guiding me in the study of Python.
The answer to my question is summarized as follows:
- thanks to Per K Grok, Xavimat and RicharDann I was able to write the receiving code and search for information:
Code: Select all
# ◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇◇#
# ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・★#
# ◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇◆#
# screen search receiving user input:
screen ask_ing():
modal True
tag all_scr
add "images/frog_base.jpg"
add(renpy.Keymap(game_menu=None)) # prevents the right button from working during interaction
frame:
#background Solid("#E20490")
xalign 0.5
yalign 0.388
xsize 470
ysize 100
#color "#000000"
has vbox
label "" text_color "#fff"
input:
default ""
value VariableInputValue('ingridence') #<------ this variable records the value of the input
length 40
imagebutton:
idle "images/frog_btn.png"
hover "images/frog_btn1.png"
#hovered [ Play ("test_five", "sfx/click.mp3") ]
xpos 410 ypos -40 #xalign 0.4 yalign 0.6 xanchor 1.1 yanchor 1.3
focus_mask True
#activate_sound 'sfx/xxx.mp3'
action Show("tell_ing"), Hide("ask_ing")
Code: Select all
# ◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇◇#
# ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・★#
# ◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇◆#
# Screen that searches for information stored in list:
screen tell_ing():
default checkno=0
modal True
tag all_scr #<-------this item is very important. If you put in each screen of the same group, they must by obligation use the same tag to close them later.
add(renpy.Keymap(game_menu=None))
frame:
background "images/frog_base1.jpg"
vbox:
spacing 10
for i in range(len(ing_list)-1): #<---- searches from the beginning of the string to the last letter.
$ ingridence.lower() #<------------- change to lowercase
$ ingridence = '_'.join(ingridence.split(' ')) # <------- removes all blanks and replaces them all with underscores
if ingridence.lower() == ing_list[i][0]: #<------ compares the entered data with the keyword. if the user typed "apple", the program will search for "apple".
$ checkno=1 #<------ If you found "apple", put a flag on it
$ ingridence = ingridence.lower()
timer 0.01 action Show("vocabulario")
Code: Select all
screen vocabulario(): # <------ screen pivot
tag grupo
modal True
add "images/frog_base1.jpg"
frame:# texto ppal "a"
#background "#ffffff"
area (400, 260, 790, 357) #(x, y, w, h)
viewport:
#id "cultura_"
draggable True
scrollbars "vertical"
vscrollbar_unscrollable "hide" #allows you to hide scrollbar if necessary
mousewheel True
has vbox
spacing 10
xsize 940
xfill True
use contenido_ing(ingridence) #<-------- THIS SMALL LINE OF CODE LINKS TO ANOTHER SMALLER SCREEN... :D
Code: Select all
screen contenido_ing(ingridence):
if ingridence == "a":
$ ingridence = a
#(...)
if ingridence == "to_go_away_from_a_place" or "to go away from a place": # <--- IF IT'S A PHRASE... IT WILL LOOK FOR IT WITH UNDERSCORES, SINCE THIS IS HOW THE VARIABLE IS DEFINED.
$ ingridence = to_go_away_from_a_place
#(...)
# AND HERE RECYCLES THE SCREEN.
for s in ingridence:
text s:
justify True
Code: Select all
# When there are links redirecting from the main word ({a=label_custom}{/a}, where label_custom has the name of the stored variable e.g.: define apple= [""" add description here"""]
# you must create a label of that word, changing
# the variable "INGRIDENCE"
label to_go_away_from_a_place():
$ ingridence = to_go_away_from_a_place
call screen vocabulario()
label a():
$ ingridence = a
call screen vocabulario()
I know that because of language differences, it may be very difficult to explain what I did, but I am committed to study to improve the code.
However, the code works and that matters. I have been learning for a long time and it has been a very long process. I still have a lot to learn, but I thank you from the bottom of my heart for all the help I received in this forum.
So I give this issue as "solved".
# ◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◇◆◇◆◇◆◇#
Hi everyone!
I am creating a list of words.
I made the first word appear successfully.
Reasoning: the variable "ingridence" would go through the entire list to check whether or not it matches the position in the list.
Code: Select all
(...)
for i in range(len(ing_list)-1):
$ ingridence.lower()
if ingridence.lower() == ing_list[i][0]:
$ checkno=1
$ ingridence = ingridence.lower()
frame:# texto ppal "a"
#background "#ffffff"
area (400, 260, 790, 357) #(x, y, w, h)
viewport:
#id "cultura_"
draggable True
scrollbars "vertical"
mousewheel True
has vbox
spacing 10
xsize 940
xfill True
(...)
Code: Select all
for i in range(len(ing_list)-1):
(...)
timer 0.01 action Jump(ingridence) # other options: text ing_list[i][0] : (add style); text ing_list[i][1]: (add style) , etc...
I reduced the gui by one to simplify the process and optimize resources:
Code: Select all
screen lado_izquierdo(): #Here is the left panel showing letters
frame:
background Solid("#F00057")
area (0, 100, 300, 610) #(x, y, w, h)
viewport:
id "letras"
draggable True
scrollbars "vertical"
mousewheel True
has vbox
spacing 10
xsize 340
xfill True
for s in letras:
text s:
justify True
size 16
screen texto_principal(): #Here is the right panel showing the concept: (Ingridence : "blah blah blah blah...")
frame:# texto ppal "a"
#background "#ffffff"
area (327, 60, 950, 650)
viewport:
id "concepto"
draggable True
scrollbars "vertical"
mousewheel True
has vbox
spacing 10
xsize 940
xfill True
for s in concepto:
text s:
#font "BalsamiqSans_Regular.ttf"
justify True
Code: Select all
# close game button
imagebutton:
idle "images/idle_x.png"
hover "images/hover_x.png"
pos (1244,0)
focus_mask True
#activate_sound 'click.wav'
action Jump("fin")
# resize window button: will change later with another screen
imagebutton:
idle "images/idle_max.png"
hover "images/hover_max.png"
pos (1200,0)
focus_mask True
#activate_sound 'click.wav'
action Jump("menu_pc")
# minimize window button: will change later with another screen
imagebutton:
idle "images/idle_min.png"
hover "images/hover_min.png"
pos (1160,0)
focus_mask True
#activate_sound 'click.wav'
action Jump("menu_pc")
# menu containing other labels: You can hide the menu and choose what content you want to see.
imagebutton:
idle "images/idle_menu3.png"
hover "images/hover_menu3.png"
pos (1249,43)
focus_mask True
#activate_sound 'click.wav'
action If(renpy.get_screen("menu3_scr"), true=Hide("menu3_scr"), false=ShowMenu("menu3_scr"))
To give you an idea, it's like using a browser, where you tell the search engine what you want to search for. When you click, you get to the dictionary offered by the search engine and the page interface appears (it's a local search).
How can I make all screens (left panel, content panel and imagebutton) appear for each searched word?
The imagebuttons are the same (because they are part of the browser), while the panels change for each word (left panel will show 5 possible results for each word, while the content panel will only have 1 item at a time).
Thank you in advance