|
Joined: Dec 2002
Posts: 196
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 196 |
How do I evaluate variables properly?
I tried $eval(%messagetxt,3)
but then all the commas doesn't show up which means I cannot set the background. Help?
|
|
|
|
Joined: Mar 2003
Posts: 272
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 272 |
/help $eval $eval(text,N)
Evaluates the contents of text N times. If N isn't specified, the default is N = 1. If N is zero, text is not evaluated.
This allows you to recursively evaluate identifiers and variables in a line of text. Basically, if you don't want to evaluate a variable, you do $eval(%var,0). If you want to evaluate a variable normally (one time), you do $eval(%var,1). If you want to evaluate a variable 5 times, you do $eval(%var,5). $eval( %Variable_Name, Number of times you want to evaluate it)
- cF Dedicated helper for rent.
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
What are you talking about? The normal way to evaluate variables is... by just their name: fex //echo -a %messagetxt I'm sure you have something else in mind, so can you paste an example of what you're trying to do?
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Dec 2002
Posts: 196
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 196 |
I have %messagetxt set to:
2,15Mp3 System: Duration $duration($calc($mp3(%mp3).length / 1000))
So I will have to evaluate them if not it will show:
2,15Mp3 System: Duration $duration($calc($mp3(%mp3).length / 1000))
But when it evaluates, it shows:
15Mp3 System: Duration 3 mins 7 sec
See the 15?
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
I just pasted that line into mIRC and it displayed perfectly, blue text, gray background, no 15.
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
How are you trying to display %messagetxt and where? Is it a channel/query window with /echo? Or? An example of the actual command you're using would be helpful.
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Dec 2002
Posts: 196
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 196 |
i am using /did blabla
it also shows up when i use echo
codemastr what did u type for the $eval?
i did
/echo -a $eval(2,15Mp3 System: Duration $duration($calc($mp3(%mp3).length / 1000)),2)
Last edited by trenzterra; 11/05/03 12:26 AM.
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
Try this /set %messagetxt $+(2,$chr(44),15Mp3 System:) Duration $duration($calc($mp3(%mp3).length / 1000))
//echo -a $eval(%messagetxt,2)
Edit- added the missing parenthesis.
Last edited by Nimue; 11/05/03 01:10 AM.
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
Wow, I think we've just found another undocumented identifier! > /set %messagetxt $+(2,$chr(44),15Mp3 System:) Duration $duration($calc($mp3(%mp3).length / 1000) > //echo -a $eval(%messagetxt,2) * Invalid format: $evalnextLooks like $evalnext() is acting exactly like $eval(), but yet it's evaluating the text one more time (ie. N+1). For example, //echo $eval($!me,1) >> $me //echo $evalnext($!me,1) >> Online
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
Eh, that's come because I missed a parenthesis when I copied from trenzterra's post : :tongue: Someone, (qwerty maybe) posted about $evalnext on the old boards.
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
Your solution seems to solve the problem anyway and no wonder it was qwerty
|
|
|
|
|