Vivbot Forum

Forum to discuss Vivbot. Simple enough.

You are not logged in.

#1 2017-09-24 11:01:54

thehumantarget6
Member
Registered: 2017-09-24
Posts: 36

Help With Custom elseif Command

I've made a custom command which allows mods to taze viewers (totally not an abusive environment) using the command

 !zzt {1} has been tazed!! He is unconscious for 5 seconds $timeout({1}::5) 

this produces the result

(username) has been tazed!! He is unconscious for 5 seconds

and of course, they're timed out for five seconds.

I'm trying to add an elseif command that produces a different text if you use it on yourself. I tried using this command

 !zzt $ifelse("{1}" == "{user}"::You cannot taze yourself!!::{1} has been tazed!! He is unconscious for 5 seconds $timeout({1}::5)) 

but it simply produces the same result as the first command, whether the target is yourself or someone else.

I was also looking to make an elseif command that stopped you from being able to target mods but couldn't find a variable that allowed me to distinguish a user as a mod or a viewer. On top of this, is it possible to make an OR condition that compares whether the targeted user is either the same as the user OR is a mod and therefore output two true commands with an OR separating them and a single false command. For example, if you target yourself you'll get a true to "{1}" == "{user}" and it say's "you cannot target yourself" or if you target a mod you get a true to "{1} == "moderator" which produces "You cannot target moderators" and if both are false it produces "{1} has been tazed!! He is unconscious for 5 seconds $timeout({1}::5)) "

I know this is a bit long winded for a simple joke command, just hoping to learn how the if/elseif command works for other applications.

Thanks!!

Offline

#2 2017-09-25 18:06:35

vivec28
Administrator
Registered: 2015-09-19
Posts: 607

Re: Help With Custom elseif Command

Hey, cool use of the command, first of all.

I copy pasted your command and it seems to be working as you intend it to.

Broadcaster Vivec28: !zzt vivec28
Moderator Vivbot: You cannot taze yourself!!
Broadcaster Vivec28: !zzt vivec29
Moderator Vivbot: : no user named vivec29.

Strange that it isn't working for you. Can't think of any reason why other than maybe you made a mistake copy pasting it.

Unfortunately there is no way to check if a user is a mod at the moment. For the future when I add a mod check, here's how you'd do what you want. Just use nesting.

!zzt $ifelse("{1}" == "{user}"::You cannot taze yourself!!::$ifelse($ismod(user)::You cannot taze a mod!!::{1} has been tazed!! He is unconscious for 5 seconds $timeout({1}::5))) 

Doesn't look very pretty hmm

Offline

#3 2017-09-28 03:09:12

thehumantarget6
Member
Registered: 2017-09-24
Posts: 36

Re: Help With Custom elseif Command

So it turns out it does in fact work, but the targeted user has to be case sensitive in order for it to compare it with the {user}, and as BTTV auto-completes names with capitals (and I tend to capitalize names anyway) it doesn't recognize it. Is there anyway for the call parameters to ignore the case sensitivity and instead just read the letters, or for the {user} command to use BTTV's system of capitalizing the name as the user sets it.

Also I'm glad to see that nesting would work, I was just thinking of using an ifelse command within another ifelse command the other day so its awesome that it'd work. I look forward to having a variable that allows you to differentiate user levels.

Thanks very much for your help!!

Offline

Board footer

Powered by FluxBB