Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

RenJS

HTML5 Visual Novel creation made easy and free · By lunafromthemoon

Problem with variable comparison

A topic by Hydra Interactive created Apr 26, 2019 Views: 220 Replies: 6
Viewing posts 1 to 7

Hello,

We are trying to setup a small story to test drive the tool, and we have a strange problem, as in the Choice Option we are setting a varaible with a string, and afterwards when comparing the result, although the variable has the correct value, when trying the if ( variable=="Value") it doesn´t make the comparision correctly and always get into the else statement.

What could be the problem?


Cheers,

Developer

Hello, the problem is that you need to surround the variable with {}, like this: if ({variable}=="value").

Developer

Here's a link to the documentation: https://lunafromthemoon.github.io/RenJS/actions/var/ just in case.

I have tried it, and it is not recognizing, and I have been check on both the documentation and the tutorial example, and no luck until now. I must be doing something wrong

on the choice  I am setting correclty the variable

- var partner:"yes"


but then after the Choice

- if ({partner}== "yes")  is never validated and goes always into the else statment.

Developer(+1)

I just checked and there was a problem when skipping some quotation marks in the comparison. The Quickstart repository is updated with the fix. https://gitlab.com/lunafromthemoon/RenJSQuickstart

I can confirm that it is working now. And it has been a great opportunity to understand how the system is mapped.