lua:ch:setval
Differences
This shows you the differences between two versions of the page.
lua:ch:setval [2014/12/27 07:43] – created vodur | lua:ch:setval [2015/09/03 04:42] (current) – vodur | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | Setval works similar to qsets, but allows for much more readable values. You can view a list of values on a player using the " | + | See [[:lua:setval|setval]]. |
- | + | ||
- | Syntax: | + | |
- | + | ||
- | setval("< | + | |
- | + | ||
- | The first argument is a string/name of the value. The second argument is a boolean, string, or numerical value that you want to use to track the value The third argument is whether or not the value will persist through logout. | + | |
- | + | ||
- | Example: | + | |
- | + | ||
- | < | + | |
- | if mob.vnum == 320 then | + | |
- | ch:setval(" | + | |
- | end | + | |
- | </ | + | |
- | + | ||
- | If this mprog was attached to a mob using a DEATH trigger, when the mob was killed (assuming it was a mob with vnum 320), then a value would be applied to the player. The value would be called serpent killed, with a value of 1, and it would persist through logout. | + | |
- | + | ||
- | Example: | + | |
- | + | ||
- | <code lua> | + | |
- | ch:setval(" | + | |
- | </ | + | |
- | + | ||
- | This mprog could be attached to just about anything, with any trigger. It would erase the value on serpent_killed, | + | |
- | + | ||
- | Example: | + | |
- | + | ||
- | <code lua> | + | |
- | if (ch: | + | |
- | if mob.vnum == 325 then | + | |
- | ch: | + | |
- | end | + | |
- | end | + | |
- | </ | + | |
- | + | ||
- | This mprog will check if the value of r9_zombies_killed has been set. If not, it will set it to 1. If it has been set, the value will be incremented by 1. This will only fire when mob 325 (dirty zombie) has been killed. | + | |
- | + | ||
- | Best practices: It's important to cleanup these values when they' | + | |
- | + | ||
- | Additionally, | + | |
lua/ch/setval.1419666225.txt.gz · Last modified: 2014/12/27 07:43 by vodur