mIRC Home    About    Download    Register    News    Help

Print Thread
Quick Question #97361 11/09/04 07:25 PM
Joined: Sep 2004
Posts: 12
R
Rock1019 Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Sep 2004
Posts: 12
I was wondering how I can write:

' if (a variable isnt set) { bla bla bla } '

I tried thoe following but it didn't work:

' if (%variable == $null) { bla bla bla } '

Thanks!
Rock1019

Re: Quick Question #97362 11/09/04 07:28 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
either:

if (%variable == $null) { } (The best way IMO)
if (!%var) { } (Not such a good way. The variable could contain a $null, false, or a 0 and still pass [meaning it doesn't have to be unset])


-KingTomato
Re: Quick Question #97363 11/09/04 08:49 PM
Joined: Sep 2004
Posts: 12
R
Rock1019 Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Sep 2004
Posts: 12
Ok thanks, it works now. I have another question, however =D. Here is my current code:

Code:
on 1:TEXT:!onair*:#:{ 
  if ($nick isop $chan) {  
    /topic $chan Rock 101.9 The Edge - Today's Hottest Rock $(|) Now Playing: DJ $2 Live
    set %dj $3
  }
}

on 1:TEXT:!offair*:#:{
  if ($nick isop $chan) {
    /topic $chan Rock 101.9 The Edge - Today's Hottest Rock $(|) Now Playing: Automation
    unset %dj
  }
}

on 1:TEXT:!request*:#:{
  if (%dj == $null) { /msg $chan There is currently no DJ broadcasting on the air. Visit http://www.1019theedge.com/playlist.php to request that a song be added to our automated playlist. }
  else {
    /msg $chan Your request has been submitted!
    /msg %dj A request for $3 by $2 has been submitted by $nick at $time $+ .  Please try your best to get it on the air! 
  }
}


The problem is that is the song or artist is more than one work, the PM to the DJ doesnt work correctly. Any suggestions or ideas on how I can allow multiple words for the artist/song?

Thanks!
Rock1019

Re: Quick Question #97364 11/09/04 09:58 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Every word in a trigger or event is repreented by $1,$2,$3,... etc. If you would like bunched of words however, you can use the identifier, and a hyphen. Example:

Trigger for!request Some Song

In the event, you know !request to be $1, Some to be $2, and Song to be $3. If you wanted just the request (everything after !request) you could use $2- That means the second word, and onword. You can also do $2-3 which means words 2 through 3.

So to answer your question, use $3- in your request script. That will include everything past their first word.


-KingTomato
Re: Quick Question #97365 11/09/04 10:09 PM
Joined: Sep 2004
Posts: 12
R
Rock1019 Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Sep 2004
Posts: 12
Yes, but say 1 request is Someday by Nickelback and another request is I Will Be Loves by Maroon 5. There are 2 different values for users to enter. For the first example, the way I have it works great, but for the econd example, it would have to be $2-3 for the artist and $4- for the song. A third example, however may require $2-4 for the artist and $5- for the song. Do you get my problem here? =P

Thanks!
Rock1019

Re: Quick Question #97366 12/09/04 05:10 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Have the user require a pattern. Make each request follow an "Artist - Song" format. Then use tokens to divide it up. example:

on 1:TEXT:!request * - *:#: {
/tokenize $asc(-) $2-
; now $1 is the artist, $2 is the song,,,
/msg $chan Request Received! $(|) Artist: $1 - Song: $2
}


-KingTomato