Author
Topic: If-Then Syntax in Icechat 7 Scripting (Read 3242 times)

Hoping for some help with the syntax of a script I'm working on as part of my Twitch.TV channel.

Some background: My objective with this script is that, when a person types "!highlight" into my channel, it will serve a random line from the Highlights.txt file. This includes a link to one of the highlights on my channel, along with a short description. This part, I can make work.

The issue I'm having is adding a cooldown timer to prevent flooding of the command. I'd like the command to respond, at most, once every minute (Across the entire chat, not per-user)--if someone types it before the minute has elapsed, it will do nothing. I think I have the logic down, but there's something in my lack of understanding of the Icechat syntax that's stopping it from working. Is what I'm trying to do even possible in the Icechat7 style, or will I need to fall back to VBS? For reference, what I'm trying and failing with is the following:

on 99:TEXT:!highlight:#emptyeye:{if (%inuse = false) then{/say $randphrase(Highlights.txt)/set %inuse true/timer 10 1 60 /set %inuse false}}Again, I can make the /say $randphrase [...] portion work okay, it's only the if-then part I'm having an issue with. There's a lot of documentation on mIRC scripting out there, but unfortunately, Icechat 7 is "Not exactly mIRC", and I'm having trouble coming up with documentation on the exact syntactical differences.

Okay, so making those changes, and adding the relevant line to the Variable section, I'm closer. The script now looks like (By the way, the "99" is just something I have temporarily set to only allow me to use the command for now):

Previously, I was getting nothing at all. This is closer, but while it runs, it's having an issue with setting the variable. I get the error "[18:49] ->> Improper use of Command - it should be: /set <%variable> <value>" Strangely, I can "/set %inuse true" on its own by typing it manually and it works.