is it possible to + - / x the variables and to compare a variable with another?

Hallo. I know how to use
@set variable = x
@inc variable y
@dec variable z
but sometimes I need something more complex for my variables.
what if I want to sum 2 variables? or to subtract a variable from another? to multiply or divide a value for a number or for the value of another variable? what if I need to compare a variable with another and determine which is bigger into an If statement?
thanks for any answer!


Attribute manipulation and conditional logic using Squiffy Markdown is quite limited. However, the great thing about Squiffy is that you can freely use Javascript when the Markdown will not suffice.

In order to convert a Squiffy attribute to a JS variable, you can simply use:

var myjsvariable = squiffy.get("myattributename");

Then you can manipulate it however you wish using Javascript. At any time you can take the results and dump it back into a Squiffy attribute using:

squiffy.set("myattributename", myjsvariable);

You can create very basic If statements using Squiffy Markdown, things like:

{if gender=male:You are a man.}{else:You are a woman.}

But it is very basic stuff, so stick with the JS.


Ok, it's probably what I need to learn to do. But where do I find instructions to use JS commands? Are there other treads in the forum I can read?
By the way, how do I filter the treads in the forum, or search for keywords? Until now I always had to scroll down every single post from the beginning and it's super boring.
Thanks!


As mentioned in another thread, there is nothing special about the JS used in Squiffy. It's just bog standard JS. Plenty of forums and coding sites that will teach you the basics.


This topic is now closed. Topics are closed after 180 days of inactivity.

Support

Forums