[Solved] Comparing Specific Content within an Index of Two Lists (if list_a[0] == pie && list_b == cherry)
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.
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.
-
shrexylexy
- Newbie
- Posts: 6
- Joined: Tue May 24, 2022 7:15 pm
- Contact:
[Solved] Comparing Specific Content within an Index of Two Lists (if list_a[0] == pie && list_b == cherry)
Hello!
I'm fairly new to Ren'PY and working within Python for these projects. I am looking to see if there is a way to compare specific indexes of two different lists.
Essentially I am creating a class scheduler and need to obtain the order of the classes. I have the schedule creator as a drag and drop minigame where you drag classes you want into the available slots. I want to make an order out of which classes they put in specific spots.
I figure in an amalgamation of languages it would look something like this:
If (list_classes[0] == "Math") && (list_time[0] == "9AM"){
jump Math9am
}
However, I haven't been able to find anything in the handbook or other posts that help with this.
Any help and advice would be greatly appreciated, thanks!!!
I'm fairly new to Ren'PY and working within Python for these projects. I am looking to see if there is a way to compare specific indexes of two different lists.
Essentially I am creating a class scheduler and need to obtain the order of the classes. I have the schedule creator as a drag and drop minigame where you drag classes you want into the available slots. I want to make an order out of which classes they put in specific spots.
I figure in an amalgamation of languages it would look something like this:
If (list_classes[0] == "Math") && (list_time[0] == "9AM"){
jump Math9am
}
However, I haven't been able to find anything in the handbook or other posts that help with this.
Any help and advice would be greatly appreciated, thanks!!!
Last edited by shrexylexy on Thu Jun 09, 2022 5:08 pm, edited 1 time in total.
Re: Comparing Specific Content within an Index of Two Lists (if list_a[0] == pie && list_b == cherry)
For that specific use case: jump expression list_classes[0]+list_time[0] https://www.renpy.org/doc/html/label.ht ... -statement
In general, the python syntax for what you put down would simply be
In general, the python syntax for what you put down would simply be
Code: Select all
if list_classes[0] == "Math" and list_time[0] == "9AM":
jump Math9AM
-
shrexylexy
- Newbie
- Posts: 6
- Joined: Tue May 24, 2022 7:15 pm
- Contact:
Re: Comparing Specific Content within an Index of Two Lists (if list_a[0] == pie && list_b == cherry)
Amazing, thank you!! That's a lot simpler than I thought. I was definitely overcomplicating things. I'll try it out and update with my progress in case future people have the same problems I did 
-
shrexylexy
- Newbie
- Posts: 6
- Joined: Tue May 24, 2022 7:15 pm
- Contact:
Re: Comparing Specific Content within an Index of Two Lists (if list_a[0] == pie && list_b == cherry)
Hi all!
this is what I have for my code:
It keeps telling me that the jump Cowboy1 has a syntax error. and points to the end of the line as though it were expecting a semicolon or something. I can't figure out what it wants as the code in the Renpy documentation also appears to have their jump statements lined up the way I have mine.
Am I missing something obvious?
this is what I have for my code:
Code: Select all
def orderofclasses():
if order[0] == "00 piece" and time[0] == "00": #if the first piece is the first in the list and ison the first time droppable
jump Cowboy1Am I missing something obvious?
- Ocelot
- Eileen-Class Veteran
- Posts: 1882
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Comparing Specific Content within an Index of Two Lists (if list_a[0] == pie && list_b == cherry)
jump Cowboy1 is a RenPy statement and cannot be used in Python block. Either make it into RenPy code, or use Python equivalent: renpy.jump("label_name")
< < insert Rick Cook quote here > >
-
shrexylexy
- Newbie
- Posts: 6
- Joined: Tue May 24, 2022 7:15 pm
- Contact:
Re: Comparing Specific Content within an Index of Two Lists (if list_a[0] == pie && list_b == cherry)
Thank you!! I'm now not receiving any errors. Can't believe I missed that haha
Who is online
Users browsing this forum: No registered users