Var and Calc bbcodes

General area, introduction to the game and chat area.
1 post Page 1 of 1

Var and Calc bbcodes

Quote

Post by Daedalus »

You can now create variables in your character sheet or anywhere where you want to save and calculate number data.

Code: Select all

[var=unique_name_goes_here]40[/var]
The above will create a variable with a value of 40, and output 40.
Example of the above in use:

Code: Select all

[var=unique_name_goes_here2]40 + unique_name_goes_here[/var]
The above will add 40 + unique_name_goes_here and output the result, while at the same time creating unique_name_goes_here2 with that output.
Example of the above in use:

Any valid math in var or calc bbcodes can be used.

Note that variables are defined and read in order; eg, you cannot use unique_name_goes_here2 before it is defined.

It is of course possible to perform calculations that don't create a variable.

Code: Select all

[calc]40 + 40[/calc]
The above will output 80. Any calculation bbcodes may also make use of any existing variables.
Example of the above in use:

Lastly, you can tally the amount in any var by adding the count attribute, wrapping the entire thing in the tally bbcode, and using the tallypoints bbcode anywhere:

Code: Select all

[tally]
Total: [tallypoints=exp][/tallypoints]

[var=one count=exp]40 + 40[/var]
[var=two count=exp]40[/var]
[var=three count=exp]-10[/var]
[/tally]
Example of the above in use:
Total:





Tallypoints also has an optional attribute: total. Adding total with an amount or var name outputs a format similar to the skillpoints bbcode tag.

Code: Select all

[var=experience]2000[/var]
[tally]
Total: [tallypoints=exper total=experience][/tallypoints]

[var=one count=exper]40 + 40[/var]
[var=two count=exper]40[/var]
[var=three count=exper]-10[/var]
[/tally]
Outputs:
Total:



Last edited by Daedalus on September 6th, 2020, 10:16 pm, edited 6 times in total.
Daedalus
Dragon Coder
Posts: 160
Joined: October 9th, 2008, 5:15 am

1 post Page 1 of 1