mIRC Home    About    Download    Register    News    Help

Print Thread
#179726 27/06/07 10:57 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I building my own highlight system, how ever i got a problem, $me wont be translated to my nick, how can i solve this?

$gettok($highlight(%hl.nr),%token.nr,44)
return $me .. not my nick, and i dont know how i can replace $me with my nick instead, any ideas?
Code:
on ^*:text:*:# {
  haltdef
  var %hl.nr = 1
  var %line = $urlc($1-)
  while ($highlight(%hl.nr)) {
    var %token.nr = 1
    while ($gettok($highlight(%hl.nr),%token.nr,44)) {
      if ($ifmatch isin $1-) && ($highen == Enabled) {
        if (%hl.enab == 1) { .splay %hl.sound }
        if ($chan == $active) { echo $theme_color(highlight) -mt $chan $theme_nick($nick) %line | return }
        if ($chan != $active) { echo $theme_color(highlight) -mt $active $theme_delimiter(sys_left) $+ Highlight $+ $theme_delimiter(sys_right) $+(on $chan,/,$nick,:) %line | return }
        inc %token.nr
      }
      inc %hl.nr
    }
    if ($highen == Disabled) { echo $theme_color(owntext) -mt $chan $theme_nick($nick) %line | return }
    if ($ifmatch isin $1-) &&  ($highen == Disabled) { echo $theme_color(owntext) -mt $chan $theme_nick($nick) %line | return }
  }
  { echo $theme_color(owntext) -mt $chan $theme_nick($nick) %line }
}


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
$($gettok($highlight(%hl.nr),%token.nr,44),1)


Evaluate it.

Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
cant get it to work with $eval, thats my problem


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
To evaluate the value returned by an identifier or variable you need to use 2 for the second parameter to $eval(). Using $eval(..., 1) is the same as not having it there.

Code:
$eval($gettok($highlight(%hl.nr), %token.nr, 44), 2)


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Eh?

Both $($me,1) and $eval($me,1) return SladeKraven, as with 2 as the second parameter.

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Yeah, like I said, using $eval(..., 1) is the same as not using $eval() at all. To evaluate the value returned by an identifier you must use 2 as the second parameter.

In your case "SladeKraven" is not going to evaluate to anything different because it's just ordinary text. In sparta's case if the value returned by $gettok() is an identifier like $me then using $eval(..., 2) will evaluate $me also. Which is what he wanted.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Or you could make your life easier by getting rid of both loops (which are wrong anyway) and $eval and using $highlight($1-)

Look it up and experiment with it if you don't know what it does.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard