mIRC Homepage

[Twitch] If/Else message (simple?)

Posted By: VijoPlays

[Twitch] If/Else message (simple?) - 06/01/17 04:24 PM

I made several commands for some small jokes and as I did not find a good guide on everything I had to learn everything myself and by troubleshooting I came close to what the problem is, but I can't fix it.
Here's an example of one of the commands:

on *:text:!d10:#: {
if ((%flooddice) || ($($+(%,flooddice.,$nick),2))) { return }
set -u10 %flooddice. $+ $nick On
msg $chan $nick $read(d10.txt)
else {
msg $chan $nick , no fair, you just rolled, give the others a turn to prepare... 50DKP minus! }
}


As I said, I didn't find good explanations on the commands, however I feel like the or part is causing confusion... maybe?
Posted By: Blas

Re: [Twitch] If/Else message (simple?) - 06/01/17 04:31 PM

It would help to know what you are wanting the above command to actually do. smile
Posted By: VijoPlays

Re: [Twitch] If/Else message (simple?) - 06/01/17 05:51 PM

Yes, I'm sorry.^^
I was just taking a shower and then I realized that I didn't even post what I wanted it to do, lol.

I want the command to either roll a 1-20 (which is happening without a problem) and then give that person a cooldown.
If this person tries to roll again while on cooldown I want a message in chat to display saying the 50DKP minus stuff. smile
Posted By: Blas

Re: [Twitch] If/Else message (simple?) - 07/01/17 02:59 AM

The script you are using is written to "do nothing" if the user is on cooldown for the command:
Code:
if ((%flooddice) || ($($+(%,flooddice.,$nick),2))) { return }

We need to tell mIRC to do something else if the user is on cooldown.

First off, you don't appear to be using "%flooddice" at all, as I am assuming that you got that from a youtube tutorial, so let's just get rid of it. Instead, I would rather first tell mIRC what to do if the user is NOT on cooldown, THEN tell it what to do if the user IS on cooldown. That just makes more sense in my brain. The ! symbol in (!$($+(%,flooddice.,$nick),2)) tells mIRC to do stuff if that vairable does NOT exist.

Code:
on *:text:!d10:#: {
  if (!$($+(%,flooddice.,$nick),2)) {
    set -u10 %flooddice. $+ $nick On
    msg $chan $nick $read(d10.txt)
  }
  else msg $chan $nick $+ , no fair, you just rolled, give the others a turn to prepare... 50DKP minus! 
}
Posted By: VijoPlays

[Solved] [Twitch] If/Else message (simple?) - 07/01/17 01:25 PM

Yep, that's it! Thank you very much. <3

And you are indeed correct, I might just be blind (as I am sometimes when looking for something :p), but I did not find a good explanation of the commands themselves.
However, all commands work now, except for an automatic message and a few other commands that I did not look into yet, but are still on the list. =)

Thanks again, much appreciated!
© 2022 mIRC Discussion Forums