[SOLVED] Really quick one about sections!

Groctel
27 Dec 2016, 20:55Hello everyone!
I got this little issue. I have declared a section by nesting it between the StartNewOutputSection()
and the EndOutputSection
functions. Let's say the name is apples.
My only question is... If I want to call that section again, which function do I need to call?
Thank you very much!
Jay Nabonne
27 Dec 2016, 21:14What do you mean "call that section again"? What are you trying to do, ultimately?

Groctel
27 Dec 2016, 22:14Run the script inside the section again so it can run like a loop.
To put it simple:
room.loop = StartNewOutputSection()
if (room.firstsayhi = 0) {
msg ("Please, say hi.")
} else {
msg ("That's not what I asked you to do. Please say hi.")
}
get input {
if (result = "hi") {
} else {
room.firstsayhi = 1
<<Here should go the function call that runs this dialogue again>>
}
}
EndOutputSection (room.loop)
msg ("Hi! Nice to meet you!")
Am I doing it in a more complex way than it should be done?
Jay Nabonne
27 Dec 2016, 22:24If you invoke that code again, then it will create a new section each time. Once you hide a section, I don't know of a way to show it again. So creating a new one each time is what you would want to do. You would need to hide it somewhere in there, though, so when you loop, you'll only have the new one existing.

Groctel
27 Dec 2016, 22:43Just found the way to do it. I tried to make a while, but since I got a get input {}
line inside the loop and it does not stop the loop, the game crashes.
Soooooo I searched the forums and found that I have to use a recursive function, which was what I was trying to do all this time, but in the worst way possible hahahahah.
This is the page I found it, btw: http://textadventures.co.uk/forum/quest/topic/6254/coding-problem-with-while
Thank you again Jay <3