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

Emptyeye

  • Newbie
  • *
  • Posts: 4
If-Then Syntax in Icechat 7 Scripting
« on: December 10, 2014, 09:20:09 PM »
Hi everyone,

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:

Code: [Select]
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.

Thanks in advance!

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: If-Then Syntax in Icechat 7 Scripting
« Reply #1 on: December 10, 2014, 09:37:04 PM »
That is inproper syntax for an if statement in icechat 7 style script.

I dont think you need a 'then'
I also think you need '==' for checking

I also think you need to add '%inuse = false' to variables section.



The IceChat God

Emptyeye

  • Newbie
  • *
  • Posts: 4
Re: If-Then Syntax in Icechat 7 Scripting
« Reply #2 on: December 11, 2014, 03:56:38 PM »
Wow, thanks for the prompt response!

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):
Code: [Select]
on 99:TEXT:!highlight:#emptyeye:{
if (%inuse == false)
{
/set %inuse true
/say $randphrase(Highlights.txt)
/timer 10 1 60 /set %inuse false
}
}

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.

Any reason why this would be?

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: If-Then Syntax in Icechat 7 Scripting
« Reply #3 on: December 11, 2014, 03:59:58 PM »
Yes, it is a bug.

I have managed to fix the bug, and it will be in 7.8 when it is released.
The IceChat God

Emptyeye

  • Newbie
  • *
  • Posts: 4
Re: If-Then Syntax in Icechat 7 Scripting
« Reply #4 on: December 11, 2014, 08:34:38 PM »
Ah, well that's irritating in the meantime. Good to hear there's a fix incoming though. I'd offer to test, except I don't have Windows 8 (Still running Vista on the chat computer here).

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: If-Then Syntax in Icechat 7 Scripting
« Reply #5 on: December 11, 2014, 11:43:21 PM »
Most likely will be released this weekend.
The IceChat God

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: If-Then Syntax in Icechat 7 Scripting
« Reply #6 on: December 12, 2014, 08:29:40 AM »
If you would like a copy now to test, come to the #icechat channel on quakenet and ask.
Just stick around until I answer.
The IceChat God

Emptyeye

  • Newbie
  • *
  • Posts: 4
Re: If-Then Syntax in Icechat 7 Scripting
« Reply #7 on: December 13, 2014, 01:17:43 PM »
Hey, thanks! Sorry I didn't see this until just now.