Author Topic: Use of $nick()  (Read 3886 times)

pwatol

  • Newbie
  • *
  • Posts: 2
Use of $nick()
« on: June 04, 2006, 03:30:15 PM »
I'm new to coding in IceChat, but have done a fair amount of VBA programming. I'm trying now to create a slap that iterates through all the users in a channel. The goal is to set up an alias that can get called from a popup menu. This is what I've got so far:

Code: [Select]
Function ALIASES (Command, Parameters, ServerNumber)   

     select case Command   
          case "/test"   
               dim i
               dim nickcount
               nickcount = $nick($channel,0)
               for i =1 to nickcount
     /me hands $nick($channel,i) a round tuit   
               next
               ALIASES=TRUE   
          case else
               ALIASES=FALSE   
     end select   

End Function

However, I get an "invalid character" message on the line that includes $nick($channel,0). I've tried hard coding a channel name in there, and it still throws up an invalid character error. Any hints as to what I'm doing wrong?

Thanks

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Use of $nick()
« Reply #1 on: June 04, 2006, 03:46:26 PM »
Sorry, but that coding does not work at all like such, you have a lot of things done incorrectly.
If you know VBA coding, you know that just type "/me does something" on its own, will not work at all, and neither will using identifiers.
You need to use SendCommand to send commands back to IceChat, and use GetIdentifier to retreive $identifier settings.
Check out the help file Script Section to get information on either of these.
The IceChat God

pwatol

  • Newbie
  • *
  • Posts: 2
Re: Use of $nick()
« Reply #2 on: June 04, 2006, 05:29:01 PM »
Got it. So you need to call a function in order to use any identifier. Made a couple of small tweaks to get this:

Code: [Select]
Function ALIASES (Command, Parameters, ServerNumber)   

     select case Command   
          case "/test"   
               dim i
               dim nickcount
               dim incnick
               nickcount = GetIdentifier("$nick($channel,0)", ServerNumber)
               for i =1 to nickcount
                    incnick = GetIdentifier("$nick($channel,i).nick", ServerNumber)
     SendCommand "/me hands " & incnick & " a round tuit   ", ServerNumber
               next
               ALIASES=TRUE   
          case else 
               ALIASES=FALSE   
     end select   

End Function   


No more syntax errors showing up, but it's not pulling the nicks, either. It does iterate through the loop the number of times it should, and it displays the action command, but it omits the nick in the action. Any pointers?

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Use of $nick()
« Reply #3 on: June 04, 2006, 05:58:40 PM »
Well, the next problem is, that i is getting parsed inside the Identifier, when it is actually a variable on the outside of it.

Basically change it to this.
Code: [Select]
incnick = GetIdentifier("$nick($channel," & i & ").nick", ServerNumber)
The IceChat God