Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Adding variables together on-page

4 years ago

So, my current project has me showing a lot of variables on the page by typing something like %%VARIABLE%% into the editor.  Now, I'd like to be able to add and subtract my variables on the page as well.  I tried doing something like %%VARIABLE1 + VARIABLE2%% or, %%VARIABLE1 * 2%%, but that didn't quite work.  I'd rather not spend a bunch of time trying to guess at how to do this when there's a fair chance it isn't even possible in the first place, so I figured I'd just ask about it here.  I reviewed the articles, but I couldn't find anything on the subject.

Adding variables together on-page

4 years ago
%VARIABLE3 := %VARIABLE1 + %VARIABLE2

%%VARIABLE3%%

Adding variables together on-page

4 years ago

So I do have to make another variable... I was hoping to avoid that, but I guess I'm left with no choice.

Adding variables together on-page

4 years ago
Just to clarify. You do not have to create variables to use them in scripts.

You only have to create variables that you want to use with link restrictions.

Adding variables together on-page

4 years ago

Wait, so I can just declare them in the script itself, or on the page, just like with real code?

Adding variables together on-page

4 years ago
Yes, I do that all the time if it's something I'll just be using once or twice for on page text.

Although not the greatest idea organization wise I'm sure because if I forget the name later I'll have to hunt down the link it's in.

Adding variables together on-page

4 years ago

This'll make things far less tedious, thanks!