EOS eval script output to screen

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
emiumfinal
Explorer
Explorer
Posts: 26
Joined: Sun Jun 24, 2018 3:16 pm

EOS eval script output to screen

Post 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.
fapnip
Explorer At Heart
Explorer At Heart
Posts: 430
Joined: Mon Apr 06, 2020 1:54 pm

Re: EOS eval script output to screen

Post by fapnip »

Best you can do in standard EOS is something like this in an EVAL:

Code: Select all

var myVariable = 'Hello World.'
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.
emiumfinal
Explorer
Explorer
Posts: 26
Joined: Sun Jun 24, 2018 3:16 pm

Re: EOS eval script output to screen

Post 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.
User avatar
phönix
Explorer At Heart
Explorer At Heart
Posts: 570
Joined: Thu Jun 11, 2020 7:14 am
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Switch

Re: EOS eval script output to screen

Post by phönix »

Maybe you can put your code inside the eval of a say action.
A bit like here:
Spoiler: show
Image
fapnip
Explorer At Heart
Explorer At Heart
Posts: 430
Joined: Mon Apr 06, 2020 1:54 pm

Re: EOS eval script output to screen

Post 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"
  })
}
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests