Author Topic: Example Use Cases for "Power User" VIP Commands  (Read 1762 times)

0 Members and 1 Guest are viewing this topic.

Marstead

  • Padawan
  • **
  • Posts: 51
  • Karma: +1/-0
    • View Profile
  • Twitch Name: Marstead
Example Use Cases for "Power User" VIP Commands
« on: October 18, 2015, 03:45:43 AM »
I've seen some new variables added for "VIP Commands - Power Users" in the past few updates but I haven't found any documentation for them among the other commands/variables on the site. I'm working on creating sample use cases for these, but if you can come up with one add it to the thread and I'll edit into the main post. Here is the list (completed use cases are in bold):

@calcpre@: Executes before @if@ : @calcpre@[op,num1,num2] , e.g. @calcpre@[+,5,4]. Available operaions (+,-,*,/)
@calcpost@: Executes after @if@ :@calcpost@[op,num1,num2] , e.g. @calcpost@[+,5,4]. Available operaions (+,-,*,/)
@unixtime@: Numeric time for use in If statements. Number of seconds since 1 Jan 1970.
Added @cost@ in the custom commands to get the amount paid.
Added @rand@[min,max] do generate a random number
Added support for >, >=, <. <= in the @if@ statement. e.g. @if@[>||@rand@[0,100]||75||You Win!||You Die!]
@lookupinfo@[var,user] , e.g. @lookupinfo@[@followdate@,@target@]
@if@[data||matchWith||matchedResult||FailResult]
@if@[data||matchWith||matchedResult] (Data is returned if match fails)
@target@, @target@2, etc.
@userinfo1@[username], e.g. @userinfo1@[@user@]
@userinfo2@[username], e.g. @userinfo1@[@user@]
@userinfo3@[username], e.g. @userinfo1@[@user@]

@cost@
Function: Displays the cost to the invoking user of the executed command.

Possible Uses: You might want to explain the amount spent on a command if it varies for different types of users, or you might want to make it clear when someone uses a command how much it will cost to another user. You can include the cost in the output with this variable.

Example command:

Code: [Select]
!costTest
@user@, you have paid @cost@ points. You now have @points@ points.

Suppose this command costs 60 points for a viewer and 30 points for a mod. Viewer1 and Mod1 both start with 100 points.

Code: [Select]
Viewer1 invokes: "Viewer1, you have paid 60 points. You now have 40 points."
Mod1 invokes: "Mod1, you have paid 30 points. You now have 70 points."

@rand@
Function: Randomly generates a number between the specified minimum and maximum.

Arguments: @rand@[min,max]

Possible Uses: You could use this to decide something randomly like a coinflip or to simulate dice rolls.

Example command:

Code: [Select]
!1d20
[Dice Roll: 1d20] Result: @rand@[1,20]

If a user invokes this command, they might see this:

Code: [Select]
[Dice Roll: 1d20] Result: 17

@if@
Function: Checks two values. If they match, display some sample text. If they mismatch, display different sample text.

Arguments: @if@[data||matchWith||matchedResult||FailResult]

Possible Uses: You could use this for a coin flip to rewrite the RNG roll as "Heads" or "Tails".

Example command:

Code: [Select]
!coin
[Coin Flip!] Result: @if@[@rand@[1,2]||1||Heads||Tails]

If a user invokes this command and a "2" is rolled, they will see this:

Code: [Select]
[Coin Flip!] Result: Tails
Note that if you leave out the last argument (In this case, ||Tails) the @if@ statement will display the input data instead of any user-specified text if it mismatches.

Example:

Code: [Select]
!coin
[Coin Flip!] Result: @if@[@rand@[1,2]||1||Heads]

If a user invoked this command and a "2" was rolled instead of a "1", this text would be displayed:

Code: [Select]
[Coin Flip!] Result: 2
I'll try to edit this post with more examples as people add them. It would be nice to see a few commands that use more than one of these.
« Last Edit: October 18, 2015, 04:14:14 AM by Marstead »