Eos code help

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
BopIT
Explorer
Explorer
Posts: 27
Joined: Fri Nov 30, 2018 9:10 pm
Gender: Male
Sexual Orientation: Straight

Eos code help

Post by BopIT »

Hey Milovana.

I'm trying to get a prompt Q and A and Eos is not reading the correct answer.

Here is what I have:

Code: Select all

var v = 0;

Prompt 
variable: blank

if
blank = "answer"; 
eval
++v

if
v = 1
say: correct

if
v=0
say: incorrect

As of now the code is not saying correct or incorrect. What did I do wrong?
Roblsforbobls
Explorer At Heart
Explorer At Heart
Posts: 260
Joined: Tue May 21, 2019 2:27 am
Gender: Male
Sexual Orientation: Asexual
I am a: Switch

Re: Eos code help

Post by Roblsforbobls »

Ok, as of right now I have it working properly.

Here's your problem:
  • When working with if statements (the actions themselves) you have to use two equals signs. If you use one equals sign only (for example, v = 1) the if statement will act like an eval action and change your variable's value (to 1 in this example).
  • When using an if statement comparing a variable to zero, you have to use three equals signs for some reason. I'm not knowledgeable about coding so I don't know why, but that's the way it is.
  • I never had a problem of it giving neither correct nor incorrect; if you are seeing that, you might have a spelling error, because I followed exactly what you typed in your code here.
So here's how it looks for me:

Code: Select all

var v = 0

Prompt 
variable: blank

if
blank == "answer"
eval
++v

if
v == 1
say: correct

if
v === 0
say: incorrect
When you are dealing with situations like this in the future where your page or code is not working and you aren't sure why, I suggest putting "Say" actions after every action. This will help you figure out which action is giving eos a hard time. For example, to figure out why your code wasn't working, I placed a "Say: v = <v>" followed by a number after every eval and at the beginning of every if statement. Depending on which numbers were displayed I was able to figure out what part of it was not working. I hope this helps! I am excited to see your tease when it comes out ~ :wave:
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests