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:Ammo"

From Roll20 Wiki

Jump to: navigation, search
m (Sheet-specific examples)
m
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
{{script overview
+
{{revdate}}{{stub}}
 +
{{main|API:Script Index}}{{script overview
 
|name=Ammo
 
|name=Ammo
 
|author=[[The Aaron|Aaron C. M.]]
 
|author=[[The Aaron|Aaron C. M.]]
Line 5: Line 6:
 
|dependencies={{api repository link|IsGM}}
 
|dependencies={{api repository link|IsGM}}
 
|lastmodified=2020-06}}
 
|lastmodified=2020-06}}
{{stub}}
 
 
 
'''Ammo''' provides inventory management for ammunition stored in a character attribute. If the adjustment would change the attribute to be below 0 or above it's maximum value, a warning will be issued and the attribute will not be changed.
 
'''Ammo''' provides inventory management for ammunition stored in a character attribute. If the adjustment would change the attribute to be below 0 or above it's maximum value, a warning will be issued and the attribute will not be changed.
  
Line 15: Line 14:
 
* {{fpl|4543180/ (Script Update) Ammo - Automated ammunition management script}} - 2017
 
* {{fpl|4543180/ (Script Update) Ammo - Automated ammunition management script}} - 2017
  
[[File:Stargate-ammo-api.png|thumbnail|Example of result in {{Text Chat}}]]
+
[[File:Stargate-ammo-api.png|thumbnail|300px|Example of result in {{Text Chat}}]]
  
 
== Commands ==
 
== Commands ==
Line 38: Line 37:
  
 
This command is identical to <code>!ammo</code>, but will whisper all output.
 
This command is identical to <code>!ammo</code>, but will whisper all output.
 
+
{{apiboxRec}}
 
===Examples===
 
===Examples===
 
Shoot 1 arrow:
 
Shoot 1 arrow:
Line 94: Line 93:
 
{{changelog version|0.21|2015-02-18|* -}}
 
{{changelog version|0.21|2015-02-18|* -}}
 
{{changelog version|0.2|2015-02-01|* Release}}
 
{{changelog version|0.2|2015-02-01|* Release}}
 +
 +
=See Also=
 +
* [[Script:ChatSetAttr]]
 +
<br><br>
 +
[[Category:Character Sheets]]

Latest revision as of 10:03, 18 February 2022


Main Page: API:Script Index

API ScriptAuthor: Aaron C. M.
Version: 0.22
Last Modified: 2020-06
Code: Ammo
Dependencies: IsGM
Conflicts: None

Ammo provides inventory management for ammunition stored in a character attribute. If the adjustment would change the attribute to be below 0 or above it's maximum value, a warning will be issued and the attribute will not be changed.

Note: As the GM, bounds will not be enforced for you. You will be whispered the warnings, but the operation will succeed. You will also be told the previous and current state in case you want to revert the change.

Script is sheet-agnostic, and can be made to work with any system.

Example of result in q Text Chat

Contents

[edit] Commands

!ammo <id> <attribute> <amount> [resource name]
This command requires 3 parameters to process correctly, as shown above.
Parameters Description
id token_id} if your token is set to represent a character. See Link Token & Sheet
attribute The name of the attribute representing ammunition. Note: this is the name without @{ } around it. This works with repeating sections as well, but you will need to find the repeating rowid to build the attribute name, or use the row index
amount The change to apply to the current quantity of ammo. Use negative numbers to decrease the amount, and positive numbers to increase it. You can use inline rolls to determine the number.
resource name Anything you put after the amount to adjust by will be used as the resource name (default: "ammo").

!wammo <id> <attribute> <amount> [resource name]

This command is identical to !ammo, but will whisper all output.

[edit] Examples

Shoot 1 arrow:

!ammo @{character_id} arrows -1 arrow

Shoot 3 arrows:

!ammo @{character_id} arrows -3 arrow

Recover 1d6 arrows:

!ammo @{character_id} arrows [[1d6]] arrow

Refill all arrows (by picking up the difference between the current and max value).

!ammo @{character_id} arrows [[@{selected|arrows|max}-@{selected|arrows}]]

Using a repeating group's field with rowid:

!ammo @{character_id} repeating_weapons_-J1as31234_weapon_arrows -1 arrows

Using a repeating group's field with index:

!ammo @{character_id} repeating_weapons_$2_weapon_arrows -1 arrows

Whisper ammo changes to yourself:

!wammo @{character_id} arrows -1 arrow

[edit] Examples - Sheet-specific

D&D 5E by Roll20 recover 1d4 crossbow bolts (second row of items in the inventory)

!ammo @{selected|token_id} repeating_inventory_$1_itemcount [[1d4]] bolts

Genefunk 2090, reduce the quantity of the first item in the "Equipment" section by one.

!ammo @{selected|token_id} repeating_equipment_$0_quantity -1 Shotgun Shells

Stargate RPG, reduce amount of ammo1 by 2d6, whispering result to self

!wammo @{selected|token_id} ammo1 -[[2d6]] FN P90

Stargate-ammo-api.png

[edit] Changelog

v0.3.11 (2020-06)


v0.3.6 (2017)

  • Made attribute lookups case insensitive. (Thanks Black Falcon!)


v0.3.5 (2017)

  • Added !wammo command which whispers the output instead of sending it to chat (Thanks Elena S.!)


v0.3.4 (2017)

  • Added resource name and indexed repeating row support (thanks Elena S.!)


v0.22 (2015-02-18)

  • -


v0.21 (2015-02-18)

  • -


v0.2 (2015-02-01)

  • Release


[edit] See Also