[EOS/Code]

All about the past, current and future webteases and the art of webteasing in general.
---
Post Reply
kneeling_gentleman
Explorer
Explorer
Posts: 8
Joined: Wed Nov 02, 2022 8:53 pm

[EOS/Code]

Post by kneeling_gentleman »

Hello.

To my understanding EOS uses a subset of javascript.

Is there a reference of available structures / functions, and most importantly a way to see the debug? I tried using a class to store variables but the code seems to break, and I'm lost since I don't see any error message or log.

Thanks
Zer0_0reZ
Explorer
Explorer
Posts: 28
Joined: Tue Feb 15, 2022 7:37 pm

Re: [EOS/Code]

Post by Zer0_0reZ »

Yes EOS uses a subset of java-script, specifically of ECMAScript 5 (classes are ES6)

I don't think there is a list of what features are available but there is an api reference for all the extra things EOS adds.

To debug you can use console.log (or .info, .error, .warn).
These write into the DevTools Console (opened with Ctrl+Shift+I or F12 or right-click & inspect(Q)).
Any error messages should also appear there.
Alternatively many other Creators use a Say-Action in a IF-Action and a variable 'debug'.

After doing some testing here is what's available:
Spoiler: show
keywords:
if, else,
while, do, for, break, continue,
function, return,
switch, case, default,
throw, try, catch, finally,
new, delete, void, this,
in,
typeof, instanceof,
true, false, null, NaN, Infinity

Types:
Function, Object, Array, String, Boolean, Number, Date, RegExp (+ some types of Errors)

helper functions:
eval,
parseInt, parseFloat, isNaN, isFinite,
escape, unescape, decodeURI, decodeURIComponent, encodeURI, encodeURIComponent

Objects
Math, JSON, console,
pages, Sound, Notification, teaseStorage, EventTarget

need to be enabled instance must to be obtained with .get instance must be created with new
if you want to use something like classes just use objects:
Spoiler: show

Code: Select all

var player = {
	name:"PLAYER",
	age:23,
	greet:function (greeting){console.log(greeting, this.name)}
}
if(player.age > 20){
	player.greet("Hello")
}
kneeling_gentleman
Explorer
Explorer
Posts: 8
Joined: Wed Nov 02, 2022 8:53 pm

Re: [EOS/Code]

Post by kneeling_gentleman »

Perfect, pretty much all I needed, thanks!
kneeling_gentleman
Explorer
Explorer
Posts: 8
Joined: Wed Nov 02, 2022 8:53 pm

Re: [EOS/Code]

Post by kneeling_gentleman »

One more question, is there any way to write the actual code somewhere instead of using the graphic interface?

Or, alternatively, to programmatically invoke the commands through the "eval" prompt (in which case, is there a reference on how to call the various commands like "say", etc and their parameters)?
User avatar
PlayfulGuy
Experimentor
Experimentor
Posts: 1068
Joined: Sat Jul 07, 2012 10:08 pm
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): No domme
Sub/Slave(s): No sub
Location: British Columbia, Canada

Re: [EOS/Code]

Post by PlayfulGuy »

kneeling_gentleman wrote: Fri Dec 06, 2024 11:02 pm One more question, is there any way to write the actual code somewhere instead of using the graphic interface?

Or, alternatively, to programmatically invoke the commands through the "eval" prompt (in which case, is there a reference on how to call the various commands like "say", etc and their parameters)?
The answer to your question is sort of, but not really.

The API reference shows you what EOS specific functions are usable in javascript.

The basic commands like Say, Image etc can't be used in javascript, but if you understand the structure of JSON files you can export a tease or partial tease (see Backup in the EOS editor menu), edit and add to it in a text editor, then import the updated json (through Restore). It's a handy way to duplicate a page a bunch of times, then make minor changes to the pages, but it's very easy to miss a comma or other punctuation that prevents you from importing it, until you figure out what's missing and fix it.

PG
kneeling_gentleman
Explorer
Explorer
Posts: 8
Joined: Wed Nov 02, 2022 8:53 pm

Re: [EOS/Code]

Post by kneeling_gentleman »

Alright, thanks!
Post Reply