Re: Here are EOS tutorials
Posted: Tue Apr 15, 2025 8:25 pm
I seem to recall a way to make a say action be from multiple random ones via storing them in the init script...anyone remember? 
Perhaps you could be a little bit more specific, particularly about the "random" part? I'm assuming you have a list of texts. Do you want:Shattered wrote: Tue Apr 15, 2025 8:25 pm I seem to recall a way to make a say action be from multiple random ones via storing them in the init script...anyone remember?![]()
B more or less, you return to the same page and it says something that could be different, could be the sameundeniable_denial wrote: Tue Apr 22, 2025 11:47 amPerhaps you could be a little bit more specific, particularly about the "random" part? I'm assuming you have a list of texts. Do you want:Shattered wrote: Tue Apr 15, 2025 8:25 pm I seem to recall a way to make a say action be from multiple random ones via storing them in the init script...anyone remember?![]()
A) All of them in a random order
B) Not necessarily all of them and possibly repeating
C) Something else?
Something like this maybe:Shattered wrote: Tue Apr 22, 2025 7:04 pm B more or less, you return to the same page and it says something that could be different, could be the same
Code: Select all
function myRandomText() {
texts=[
"Nice weather today."
,
"Why are you looking at me like that?"
];
return texts[Math.floor(Math.random()*texts.length)];
}Code: Select all
myRandomText()turn on the timer's "asynchronous" modeUrbanJames wrote: Sun Apr 27, 2025 7:57 pm Is there any way to have dialog that plays during a timer?
Ok, many thanks!undeniable_denial wrote: Sun Apr 27, 2025 8:57 pmturn on the timer's "asynchronous" modeUrbanJames wrote: Sun Apr 27, 2025 7:57 pm Is there any way to have dialog that plays during a timer?
You shouldn't need an empty eval.UrbanJames wrote: Sun Apr 27, 2025 9:43 pmOk, many thanks!undeniable_denial wrote: Sun Apr 27, 2025 8:57 pmturn on the timer's "asynchronous" modeUrbanJames wrote: Sun Apr 27, 2025 7:57 pm Is there any way to have dialog that plays during a timer?
So I tested it for a bit and got it to work by using: "Timer (Asynchronous)" that runs an empty eval after the time is up > "say" action with a pause timer that is longer then the "Timer" action > rest of page
Is this the easiest way to do it?
Perfect thanks!undeniable_denial wrote: Thu Apr 24, 2025 4:00 pmSomething like this maybe:Shattered wrote: Tue Apr 22, 2025 7:04 pm B more or less, you return to the same page and it says something that could be different, could be the sameThen put this inside an eval-tag in a say action:Code: Select all
function myRandomText() { texts=[ "Nice weather today." , "Why are you looking at me like that?" ]; return texts[Math.floor(Math.random()*texts.length)]; }Couple of notes:Code: Select all
myRandomText()
- Make sure the texts are in quotes and seperated by a comma. (No comma after the last one)
- If you want a line break use the html-code "<br>". Don't put actual line breaks in the quotes.
- Math.random generates a number between 0 and 0.99999...
- When you multiply that by the number of texts (texts.length) and round that down ("floor"), then you get indices from 0 to length-1. So you can just have any number of texts, the code can handle it.
I'm not sure I follow what you did 100%, but when you prompt for the users name, the input gets stored in a variable (you specify the name of the variable in the prompt command). In your subsequent Say actions you need to include an eval that references the variable. If you've not done that, unfortunately you will need to go back and edit those actions. That's just how variables work in EOS.47dahc wrote: Fri May 23, 2025 5:07 pm I'm trying to write my first tease and I ask what the players name is on the Start page using the prompt action "name". When I do a preview of the tease from the Start page, it works great and goes through with no issues. However, when I preview another page further in where it says the users "name", it hangs because the "name" was not set. I don't want to test from the beginning of the tease every time I add a page and use "name" in a Say command. I tried adding "name=Dahc" to the init script but it's not working. I can just not use "name" on the page while testing but then I need to go back and edit each Say command afterwards. How do you test individual pages where the players name is set at the beginning of a tease and is used without having to go back and redo all the Say commands within pages. I thought adding it to the init script would work then when I'm done and ready to publish, I could just remove that line.
That's pretty much what I did, I think.PlayfulGuy wrote: Fri May 23, 2025 5:36 pmI'm not sure I follow what you did 100%, but when you prompt for the users name, the input gets stored in a variable (you specify the name of the variable in the prompt command). In your subsequent Say actions you need to include an eval that references the variable. If you've not done that, unfortunately you will need to go back and edit those actions. That's just how variables work in EOS.
- Spoiler: show
I made a demo tease for someone else. You can see it here: https://milovana.com/webteases/showteas ... fe8db66ea6
Hope that helps.
PG
Screenshot.jpg
I figured it out.47dahc wrote: Fri May 23, 2025 6:09 pm So I guess my question is, how can I set a variable in the init script that will automatically set the name so I can test individual pages without needing to preview from the Start page and go through the whole tease to get to the page I want to test? I plan on having variable pages using the asterisk (page*) so starting from the beginning each time might not take me to the page I want to test.
Code: Select all
var name = "Dahc"47dahc wrote: Fri May 23, 2025 6:19 pmI figured it out.47dahc wrote: Fri May 23, 2025 6:09 pm So I guess my question is, how can I set a variable in the init script that will automatically set the name so I can test individual pages without needing to preview from the Start page and go through the whole tease to get to the page I want to test? I plan on having variable pages using the asterisk (page*) so starting from the beginning each time might not take me to the page I want to test.
I addedto the init script and it works now. Will just have to remove it before publishing.Code: Select all
var name = "Dahc"