Token Discussion


  • registered

    Could you add an optional number argument to the set, settimer and adjust commands? Example: token set $n 12345 0 100 200 The effect would be to set value 0 with a random number from 100 to 200 * * * * * * Also, do the same for tokenvalue: if tokenvalue $n 12345 0 > 100 200 The extra number would make it do a random number from 100 to 200\. A better example would be: if tokenvalue $n 12345 0 > 0 99 That would be something akin to a skills test. :D

  • staff

    ```` tgive/tjunk ```` Gives (or junks) the specified token vnum. ```` tadjust ```` Adjusts the specified value or timer of a given token. Arguments are the same as 'token adjust' in the token documentation. Both of these would be good for testing purposes.

  • retired

    Note to self: implement a "score quests" display page where it shows all of your quest tokens, possibly with a description. Perhaps also add skill tokens to display in "skills", although this might have to wait a little while.

  • registered

    Omni-delays w/ TIMERS (translation: OMG!DELAYS!!1!1!!!eleventy-one!) Have a minimum delay such that the token doesn't accidentally expire (unless something horrible goes wrong such as the holder of the token can't check it), like 2\. When the timer value is 2 or less, RESET the timer to whatever value you wish. If you want to delay for about 20 ticks (as it will be either 19 or 20, depending on WHEN you set it) and wish to check it at three points, set the timer to 20 + 3 + 2, or 25\. When the timer hits the appropriate TIMER values, adjust it by subtracting 1\. When it hits 2, you can either zero it or reset it to whatever. The general formula for this is TICKS + STEPS + MINTICK, where TICKS is your total duration, STEPS is the number of steps you wish to check, and MINTICK is the minimum timer value. Keep in mind that the MINTICK value can serve as a step if desired. The values can be used as flags/states/indicators/parameters/whatever in the scripts for refining what to check, when to check and what to do when it checks. This all hinges on the ability to check the TIMER value on a token. [area=Setup:]if hastoken $i 12345 else token give $i 12345 endif token adjust $i 12345 timer = 45 say Ok! Timer is now 45![/area] [area=100% Random:]if tokenvalue $i 12345 timer > 0 if tokenvalue $i 12345 timer <= 2 token adjust $i 12345 timer = 0 mob echo Done! break endif if tokenvalue $i 12345 timer == 13 token adjust $i 12345 timer - 1 mob echo Stage 3! Timer is now 12! break endif if tokenvalue $i 12345 timer == 24 token adjust $i 12345 timer - 1 mob echo Stage 2! Timer is now 23! break endif if tokenvalue $i 12345 timer == 35 token adjust $i 12345 timer - 1 mob echo Stage 1! Timer is now 34! break endif endif[/area]

  • registered

    Inspired by Areo's $[ ] post…. Here's how to do a delay-wait type system, which PAUSES the timer so that it has to be reset once the desired action has been completed. [area=Setup:]if tokenvalue $i 12345 2 > 0 break endif if hastoken $i 12345 else token give $i 12345 endif token adjust $i 12345 timer = 12 __<- really ~ 10 ticks total, 5 ticks to the pause__ token adjust $i 12345 0 = 0 token adjust $i 12345 1 = 0 token adjust $i 12345 2 = 3 __<– set what the heck you're doing this for!__ say Ok! Timer is now 45![/area] [area=100% Random:]if tokenvalue $i 12345 timer == 0 break endif if tokenvalue $i 12345 timer <= 2 token adjust $i 12345 timer = 0 mob echo Done! break endif if tokenvalue $i 12345 timer == 7 token adjust $i 12345 0 = 1 token adjust $i 12345 1 = $[[tokenvalue $i 12345 timer]] token adjust $i 12345 timer = 0 mob echo Enable! Timer is now 7! endif[/area] [area=Some other script:]if hastoken $i 12345 and tokenvalue $i 12345 0 == 1 __<– this is waiting to do it__ and tokenvalue $i 12345 2 == 3 __<– Match to what you're setting it for!__ token adjust $i 12345 timer = $[[tokenvalue $i 12345 1]] token adjust $i 12345 0 = 0 token adjust $i 12345 1 = 0 token adjust $i 12345 2 = 0 __<– you're done, so clear that out__ mob echo I did it!!! __<– or something useful!__ endif[/area]

  • registered

    New Token Type: **global** Global? What is Global?! It means that it is a global token. Only ONE copy of it will ever exist. But, what about referencing it? Simple, reference it as you would any other token. The key would be in the code: if the token type is global, it will use the global copy. (When referenced the FIRST time, the token is created.) This type of token would not exist on anything, so whenever tokens get any scripts on them, this type of token would have a LIMITED command set as well as triggers that would fire it. Why? These would have no environment, so they cannot do anything that would mess with realm itself (no loading, no goto, not even targeting anything!). Also, all global tokens are saved and reloaded the next boot, creating a persistant state mechanism. So how do I use the Global Token? ```` if tokenvalue $* [ ] (you can do that... the target is irrevelant) token adjust $* [ ] (same as the ifcheck) token junk? (nope, can't do that) token give? (give what? it's global!) if hastoken $* (that makes no sense, always false for these tokens) ```` * * * * * * So what all can you do with them? 4. Create interscript (even interTYPE) communication. 7. As mentioned, save a state across boots. 10. ??? 13. PROFIT!!! * * * * * * In short, you can use this, coupled with various other scripting additions, to create persistant scenarios. What this can't do: * Store information on any given entities. That's what having saving features on THOSE are for, such as tokens on players saving to their pfiles. * Do scripts on a global scale. Well, maybe if the commands are done to account for them. But for the most part, these tokens would not be associated with any environment, hence them being GLOBAL.

  • registered

    token save This command is used to save a GLOBAL token… and ONLY global tokens. Since it takes no target entity, this can only reference a global token. This is used to ensure the token's values are saved.

  • registered

    token find [ [ [ [ [ []]]]]] This will find a token on the target that matches the vnum and specifications. Negative values for the timer or any of the values will omit that field. The count is used to iterate through copies of the same token. The code $@ is set by this command. If the token was not found, any checks or commands done on this code are false/ignored. This command is used when multiple copies of the same vnum are able to be on the same target, thus having a command to find a particular one is needed. When using the $@ code, the syntax of the commands/ifchecks would shorten. Instead of having to get the token, one can just use $@ instead. For the hastoken ifcheck, this will check to see if the $@ is valid or not. The vnum argument would be ignored, thus can be omitted. * * * * * * **Example - From the scenario I have for my attuning mechanism for a weapon. *** __Though mostly unrelated to the idea of this POST, it does utilize (and can be more) tokens in a significant way.__ * * * * * * This example uses the global token idea to store a unique ID upon which it can identify matched pairs. Also, this utilizes the $[ ] notation submitted by Areo. Tokens on objects as well as mobiles are needed for this example to work as well. The global token used will be saved where needed. The definitions for tokens needed in the example. The global token is 12345 while the attuning token is 12346 for the sake of this example. ```` tedit create 12345 name global_attuning_counter type global valuename 0 ID1 value 0 0 valuename 1 ID2 value 1 0 ```` ```` tedit create 12346 name attuning_status type general valuename 0 ID1 value 0 0 valuename 1 ID2 value 1 0 valuename 2 ATTUNE value 2 0 valuename 3 LOCKED value 3 0 ```` * **ID1-ID2** - Used as the ID counter. Each half can range from 0 to 999999999, creating a rather LARGE range. * **ATTUNE** - The amount of attuning the particular token has. If the amount is 0, the ID can be changed when needed, this allows an object that hasn't been attuned or has been dominated to REMOVE the prior attuning to SWITCH owners. This is only used by the OBJECT. * **LOCKED** - Indicates whether the attuning as reached a critical value and cannot switch owners under normal situations. (Optional) The following script is used to generate the ID for the weapon. This works under the assumption that the weapon can be attuned more than once. ```` if tokenvalue $i 12346 2 == 0 token adjust $i 12345 0 + 1 if tokenvalue $i 12345 0 >= 1000000000 token adjust $i 12345 0 = 0 token adjust $i 12345 1 + 1 endif token save 12345 token adjust $i 12346 0 = $[[tokenvalue $i 12345 0]] token adjust $i 12346 1 = $[[tokenvalue $i 12345 1]] token adjust $i 12346 2 = 1 endif ```` This script, unlike the previous one, allows ID setting UNTIL it has been LOCKED. ```` if tokenvalue $i 12346 2 == 0 and tokenvalue $i 12346 3 == 0 token adjust $i 12345 0 + 1 if tokenvalue $i 12345 0 >= 1000000000 token adjust $i 12345 0 = 0 token adjust $i 12345 1 + 1 endif token adjust $i 12346 0 = $[[tokenvalue $i 12345 0]] token adjust $i 12346 1 = $[[tokenvalue $i 12345 1]] token adjust $i 12346 2 = 1 endif ```` The following FIGHT script assumes the wielder is $t (see the topic about the Object FIGHT trigger) and the weapon has the token needed. ```` token find $t 12346 1 -1 $[[tokenvalue $i 12346 0]] $[[tokenvalue $i 12346 1]] if hastoken $@ obj echo Do some stuff... if tokenvalue $i 12346 2 < 1 1000 token adjust $i 12346 2 + 1 3 if tokenvalue $i 12346 2 > 1000 token adjust $i 12346 2 = 1000 endif if tokenvalue $i 12346 3 == 0 and tokenvalue $i 12346 2 > 750 1000 token adjust $i 12346 3 = 1 endif endif else if tokenvalue $i 12346 3 == 0 if tokenvalue $i 12346 2 == 0 obj call SET_ID $t else if tokenvalue $i 12346 2 <= 1 1000 and rand 25 token adjust $i 12346 2 - 1 endif endif endif endif ```` Explanation: (by line) 4. This uses the token find to search the wielder's token list for first (or any) token that has the given value 0 and value 1 parameters. In this case, it checks to see that the values match the OBJECT's token values (thus forming the link). 7. Checks to see if the particular token has been found 10. Whatever you wish to do with the object if they are the correct wielder. 13. Performs a random number check against the attuning level to see if it can increase. 16. Adds to the attuning level slowly (can be adjusted to suit your situation). 22. Puts a cap on the attuning level (so it doesn't exceed the limit). 28. Is the attuning still UNLOCKED? 31. And does it pass a random number check (the range can be adjusted) 34. Marks the attuning as being LOCKED. 40. End of script for this branch. 43. Start of the block where the wielder is not a match (from line 2) 46. Is the attuning still UNLOCKED? 49. Is the attuning level zero (free to have the ID set) 52. Call the script to set the ID (Goes to the end) 55. Nope, it's not zero (must be attuned to someone else already) 58. Performs a random number check against the attuning level to see if it can be diminished. 61. Add some more randomness to it 64. Decrease the attuning level (will never get below 0 this way) 76. End of script for this branch. __If this is confusing, ask me for clarification!__ ***** __Attuning is the process by which an object aligns itself to a particular owner, whereby further powers can be uncovered/unlocked and unleashed. If the process gets far enough along, the object might lock to that owner permanently (or at least not without having significant actions to undo it). Attuning doesn't have to be complete positive in nature. In fact, you can have a weapon that does ungodly things the more you wield it, but at the price of having it SUCK your lifeforce from you, maybe even KILL you. Another sinister action could be to have a preremove trigger on the object that checks the attuning level and if it's high enough, they can't remove it! :D They wore it too long! >.>__

  • retired

    It would be handy if the timer value could be set in the same way as hit/mana dice are, have it accept dice values to introduce easy duration variation if desired. ->timer 1 d 10 + 0 1 - 10 ticks ->timer 1 d 1 + 9 Exactly 10 ticks.

  • retired

    ~~@Pollution:~~ > It would be handy if the timer value could be set in the same way as hit/mana dice are, have it accept dice values to introduce easy duration variation if desired. > > ->timer 1 d 10 + 0 > > 1 - 10 ticks > > ->timer 1 d 1 + 9 > > Exactly 10 ticks. This should be fairly easy. I will implement it when I get a chance.

Log in to reply