Author Topic: @if@ help.  (Read 2245 times)

0 Members and 1 Guest are viewing this topic.

Schultizzle

  • Youngling
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
  • Twitch Name: Schultizzle
@if@ help.
« on: July 22, 2016, 11:56:22 AM »
Can this sequence compare user's VIP classes or is it only variables that you can input such as random or coinflip?

My particular application is something seemingly simple I'm just not sure how to approach it yet. Shoutout to Mitch619911 for helping me out a lot to get as far as I have thus far.

Or... if there is simply a way to prevent users from using a command due to their VIP class... like no Bronze/Silvers/Golds could use the !trimmed command in my channel, this would also work.

Quote
@if@[@viprank@||VIP Bronze||1||@if@[@viprank@||VIP Silver||2||@if@[@viprank@||VIP Gold||3]]]

Though, I feel as if the sequence above is incorrect for what I'm wanting to do. I think it's a good start to demonstrate just exactly what it is I'm trying to accomplish though.

So... this so far is putting a numerical value to the user who starts this command's VIP class. I then need it to compare to the other VIP class values. Then... I need it to run the promote command if it determines the user is below the value. Or if it determines they're at or above the value, run a message stating they're already at that class or higher, generic deny message.

Is this possible? I'm having an extremely hard time. I'll try to layout my thoughts so people can understand what I want.

Bronze = 1
Silver = 2
Gold = 3

trimmed = 1
gilded = 2
heraldic = 3

commands for self promoting in my channel with bot with the appropriate costs:

!trimmed
!gilded
!heraldic

the command my bot uses to promote user's who trigger the self promotion commands are:
!trimme
!gildme
!heraldicme

example of how I imagine it happening.

Quote
Twitchuser69: !trimmed

99_Moderating: Twitchuser69 is now a Trimmed Member!

The bot checked to see  Twitchuser69's VIP class, it determined they were a regular viewer. So it deducted the cost and promoted them.

Quote
Twitchuser69: !trimmed

99_Moderating: Twitchuser is already a Trimmed/Gilded/Heraldic Member!

The bot checked to see Twitchuser69's VIP class and found he was at or above rank 1, so instead of running the !trimme command it goes to the other @if@ variable, and states they're already at or above the rank.

Please send help. Drowning.

« Last Edit: July 22, 2016, 12:45:31 PM by Schultizzle »

Dante557

  • Advisor
  • Councilor
  • **
  • Posts: 555
  • Karma: +26/-0
  • Sometimes Helpful, Sometimes Not :D
    • View Profile
    • My Twitch Page
  • Twitch Name: Dante557
Re: @if@ help.
« Reply #1 on: July 24, 2016, 07:46:06 AM »
Changing the VIP ranks to numeric representations is actually a pretty smart idea so we'll carry that forward for the rest of this post. I'll try and make it simplier for your viewers by reducing the number of commands they need to remember

!promote

Lets start with just a !promote command. With this command if the user puts a 1, 2 or 3 (Bronze, Silver or Gold) we'll do some checks to see if the viewer can go to those ranks. If the number is missing we'll include some functionality as to how to use the promote command. This will just be a simple if statement which will pass the option they choose to the next command in the chain (In this case, !promote2). To get all possibilities we will need to cover if they post a number other then 1,2 or 3 as well.

Code: [Select]
@if@[@target@[1]||||To use the promote command, you need to use 1, 2 or 3. Upgrading to bronze (1) requires x points, silver (2) requires x points and gold (3) requires x points||@if@[<||@target@[1]||1||Please use 1, 2 or 3 in this command. Use !promote by itself for help||@if@[>||@target@[1]||3||Please use 1, 2 or 3 in this command. Use !promote by itself for help||!promote2 @target@[1]]||]||]
It may look like a mess but it's simple if you break down each if statement (I'd use a text editor like Notepad++ btw when doing stuff like this as it's a hell of a lot easier to see mistakes due to syntax highlighting.

  • First if statement checks to see if the target is blank. If it is post some help on how to use the command, otherwise move onto the next if
  • Second if statement checks to see if the number they use is less than 1. If it is post the "please use..." text to check, otherwise move to the third if
  • Third if statement checks to see if the number is greater than 3. If it is same as before else move onto the next connect in the chain

!promote2

Now we know what option they have chosen lets get the numeric option of their VIP rank likes you demonstrated in your earlier post. We'll use the value they gave in the first command and pass it forward to the actual meat of this whole gig. Instead of @viprank@ (Which will consider your custom names) we'll instead make use of @userclass@. This will not change even if you customise the names of your vip ranks in the master settings. As stated in the wiki;

Quote
@userclass@ = Displays the class of the user. [Streamer, DeepBot, VIP Gold, VIP Silver, VIP Bronze, Viewer]

So, the command will go as follows;

Code: [Select]
!promote3 @target@[1] @if@[@userclass@||Viewer||0||@if@[@userclass@||VIP Bronze||1||@if@[@userclass@||VIP Silver||2||@if@[@userclass@||VIP Gold||3||]]]]
!promote3

Now that we're got both the number and their VIP class now we can check to see if they are already greater then the rank they are requesting to be then use the appropriate command. We'll still use your original commands (!trimmed, !guided and !heraldic) for this step as you can make any adjustments via costs in them. This is basically to see if they are already a rank above what they are requesting. It's a barrel of If statements so i'll explain them afterwards.

Code: [Select]
@if@[>||@target@[2]||@target@[1]||You are already a higher rank then what you are trying to go to||@if@[@target@[1]||1||!trimmed||@if@[@target@[1]||2||!guilded||@if@[@target@[1]||3||!heraldic]]]]
  • First if compares the two numbers we sent through. If their rank number is higher then the number they requested it just says they are a higher rank then what they are trying to go to. You could put another @if@ check in here to make further use of these numbers but for now we'll keep it simple
  • The next series of ifs just makes it so it uses the correct command based on the number they used in !promote
« Last Edit: July 24, 2016, 08:13:07 AM by Dante557 »
If you need to get through to me you can try to contact me on Twitter @ http://www.twitter.com/dante556