Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Difference between revisions of "Script:Muler"

From Roll20 Wiki

Jump to: navigation, search
m
(Set Example)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
#REDIRECT [[User:5962076]]
+
<noinclude>{{revdate}} {{main|Meta-Toolbox}}{{Meta-ToolboxNav}}
 +
=Muler=</noinclude>
 +
'''{{fpl|10005710/ Muler}}''' provides a way to store values on a [[character sheet]] in an '''[[Character#Abilities|ability]]''' (not ''[[Character#Attributes|attribute]]''), which we call a "Mule". Syntax tokens can be used in any API command line to load a mule, retrieve a variable, and/or set a variable. Since the variables are stored on a character sheet, they persists between rolls, game sessions, or even campaigns.
 +
 
 +
A clever bit about this is that usually people use character attributes to store custom stats, but as Mule store the as Abilities, they can be more easily read, and can't de accidentally deleted by commands that updates character attributes.
 +
* {{fpl|10292476/ Muler (thread 2)}}
 +
<noinclude>__TOC__</noinclude>
 +
<noinclude>==</noinclude>'''Syntax'''<noinclude>==</noinclude>
 +
Drop these syntax tokens into any API command to trigger the associated behavior. They will be filtered out (or replaced with the appropriate data) by the script.
 +
<pre style="overflow:auto;white-space:pre-wrap;">{& mule ModTable}                                => loads the first ModTable mule it finds (from characters you control)
 +
{& mule TableMule.ModTable}                      => loads the ModTable mule from the TableMule character
 +
{& mule Cake Izzard.OrDeath}                    => loads the Cake mule (first found) as well as Izzard's OrDeath mule
 +
get.4                                            => if mules are loaded, attempts to retrieve the variable "4"
 +
get.ModTable.4                                  => gets the variable "4" from the ModTable mule (ModTable must be loaded)
 +
get.TableMule.ModTable.4                        => same, but specifically from the TableMule character
 +
set.Izzard.Cake.Rush = We're all outta cake/set  => sets the "Rush" variable in Izzard's Cake mule to "We're all outta cake"
 +
                                                    note the ending /set to close the variable's value</pre>
 +
 
 +
<noinclude>==</noinclude>'''Example'''<noinclude>==</noinclude>
 +
 
 +
Generic Examples
 +
<pre>!somescript --stuff|get.thestuff {& mule ModMule} --tacos
 +
!somescript --mod|get.initMod {& mule Viper.ModMule}</pre>
 +
 
 +
'''[[TokenMod]] + Muler'''
 +
 
 +
Sets the value of bar3 on the selected token to the value of the "Stunned"-variable, which is stored in an character ability named "ConditionTable", for a character named "Blue".
 +
<pre>!token-mod {{!token-mod {{
 +
--set bar3|get.Stunned {& mule Blue.ConditionTable}
 +
}}</pre>
 +
To make the above command work, Create character named {{c|Blue}}, with an character ability named {{c|ConditionTable}}, and save it's content as <code>Stunned=5</code>.
 +
 
 +
'''Set Mule variable (no other API)'''
 +
 
 +
Stores the value {{c|65}} to the {{c|Poisoned}} variable. If the variable doesn't exist in the {{c|ConditionTable}}, it will be created.
 +
<pre>!{& mule Blue.ConditionTable} set.Blue.ConditionTable.Poisoned = 65/set</pre>
 +
As Muler is a metascript, it's meant to use inside other API calls, but if you just place a {{c|!}} at the start of a Muler -command, it will perform the action standalone(if it makes sense).
 +
 
 +
If it's easier to remember, just pretend {{c|!mule}} is a command(doesn't matter what's beteween {{c|!}} and the Muler syntax), which means <code>!muler {& mule Blue.ConditionTable} set.Blue.ConditionTable.Poisoned = 65/set</code> does exactly the same thing.
 +
<noinclude>
 +
==Meta-Toolbox Examples==
 +
{{:Meta-Toolbox/Examples}}
 +
=Other APIs=
 +
* [[ChatSetAttr]]
 +
* [[ScriptCards]]
 +
* [[TokenMod]]
 
[[Category:API Meta Scripts]]
 
[[Category:API Meta Scripts]]
 
[[Category:User API Scripts]]
 
[[Category:User API Scripts]]
 +
</noinclude>

Latest revision as of 16:18, 12 March 2022

Main Page: Meta-Toolbox

Muler

Muler(Forum) provides a way to store values on a character sheet in an ability (not attribute), which we call a "Mule". Syntax tokens can be used in any API command line to load a mule, retrieve a variable, and/or set a variable. Since the variables are stored on a character sheet, they persists between rolls, game sessions, or even campaigns.

A clever bit about this is that usually people use character attributes to store custom stats, but as Mule store the as Abilities, they can be more easily read, and can't de accidentally deleted by commands that updates character attributes.

Contents

Syntax

Drop these syntax tokens into any API command to trigger the associated behavior. They will be filtered out (or replaced with the appropriate data) by the script.

{& mule ModTable}                                => loads the first ModTable mule it finds (from characters you control)
{& mule TableMule.ModTable}                      => loads the ModTable mule from the TableMule character
{& mule Cake Izzard.OrDeath}                     => loads the Cake mule (first found) as well as Izzard's OrDeath mule
get.4                                            => if mules are loaded, attempts to retrieve the variable "4"
get.ModTable.4                                   => gets the variable "4" from the ModTable mule (ModTable must be loaded)
get.TableMule.ModTable.4                         => same, but specifically from the TableMule character
set.Izzard.Cake.Rush = We're all outta cake/set  => sets the "Rush" variable in Izzard's Cake mule to "We're all outta cake"
                                                    note the ending /set to close the variable's value

Example

Generic Examples

!somescript --stuff|get.thestuff {& mule ModMule} --tacos
!somescript --mod|get.initMod {& mule Viper.ModMule}

TokenMod + Muler

Sets the value of bar3 on the selected token to the value of the "Stunned"-variable, which is stored in an character ability named "ConditionTable", for a character named "Blue".

!token-mod {{!token-mod {{
--set bar3|get.Stunned {& mule Blue.ConditionTable}
}}

To make the above command work, Create character named Blue, with an character ability named ConditionTable, and save it's content as Stunned=5.

Set Mule variable (no other API)

Stores the value 65 to the Poisoned variable. If the variable doesn't exist in the ConditionTable, it will be created.

!{& mule Blue.ConditionTable} set.Blue.ConditionTable.Poisoned = 65/set

As Muler is a metascript, it's meant to use inside other API calls, but if you just place a ! at the start of a Muler -command, it will perform the action standalone(if it makes sense).

If it's easier to remember, just pretend !mule is a command(doesn't matter what's beteween ! and the Muler syntax), which means !muler {& mule Blue.ConditionTable} set.Blue.ConditionTable.Poisoned = 65/set does exactly the same thing.

[edit] Meta-Toolbox Examples

Examples using one or more Meta-Toolbox APIs

[edit] Other APIs