Page 1 of 1
EOS eval script output to screen
Posted: Fri Jan 01, 2021 4:02 am
by emiumfinal
I'm sure there is an easy answer to this, but my searching has come up with nothing. I'm trying to find out how to have a snippet of javascript I have executing inside an eval action output something to the screen (like it would in a Say action). For example, in a piece of If-Else code, I want one of the results to display a text string to the screen - but I can't figure out the command. I've managed to find answers to all my other questions floating around, just not this one. Thanks.
Re: EOS eval script output to screen
Posted: Fri Jan 01, 2021 4:58 am
by fapnip
Best you can do in standard EOS is something like this in an EVAL:
Then add a Say action after that eval, click that say action's "<>" button, then in the "Insert Eval Tag" dialog, enter: myVariable
Or, if you have a notification displayed, you can update the text in the notification:
Code: Select all
Notification.get('my-notification-id').setTitle('Hello world.')
But you can't dynamically generate an action in EOS.
This limitation in EOS is one of the reasons I created
OpenEOS.
Re: EOS eval script output to screen
Posted: Fri Jan 01, 2021 6:24 am
by emiumfinal
So even though I can create an action like pages.goto, there's no equivalent for displaying to screen? I guess I can make your recommendation work, but it'll be kind of a pain. Thanks for the response.
Re: EOS eval script output to screen
Posted: Fri Jan 01, 2021 8:20 am
by phönix
Maybe you can put your code
inside the eval of a say action.
A bit like here:
- Spoiler: show

Re: EOS eval script output to screen
Posted: Fri Jan 01, 2021 2:59 pm
by fapnip
emiumfinal wrote: Fri Jan 01, 2021 6:24 am
So even though I can create an action like pages.goto, there's no equivalent for displaying to screen? I guess I can make your recommendation work, but it'll be kind of a pain. Thanks for the response.
You can also use expressions in the say action's eval like phönix pointed out. If they need to be more complex, you can define a function that returns the value to be displayed, then call that in the say's eval.
Else, if you chose to use
OpenEOS use can do something like:
Code: Select all
if (i) {
new Say({
label: "I is truthy"
})
} else {
new Say({
label: "I is falsey"
})
}