mIRC Home    About    Download    Register    News    Help

Print Thread
Evaluate variables #23454 10/05/03 02:55 AM
Joined: Dec 2002
Posts: 196
T
trenzterra Offline OP
Vogon poet
OP Offline
Vogon poet
T
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?


trenzterra
AustNet #trenzterra and #w
Head Scripter @ http://trenzterra.uni.cc
Re: Evaluate variables #23455 10/05/03 03:03 AM
Joined: Mar 2003
Posts: 272
C
c0ldfusi0n Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Mar 2003
Posts: 272
/help $eval
Code:
$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.
Re: Evaluate variables #23456 10/05/03 11:34 AM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
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
Re: Evaluate variables #23457 10/05/03 05:09 PM
Joined: Dec 2002
Posts: 196
T
trenzterra Offline OP
Vogon poet
OP Offline
Vogon poet
T
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?


trenzterra
AustNet #trenzterra and #w
Head Scripter @ http://trenzterra.uni.cc
Re: Evaluate variables #23458 10/05/03 05:14 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
I just pasted that line into mIRC and it displayed perfectly, blue text, gray background, no 15.

Re: Evaluate variables #23459 10/05/03 05:31 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
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
Re: Evaluate variables #23460 11/05/03 12:25 AM
Joined: Dec 2002
Posts: 196
T
trenzterra Offline OP
Vogon poet
OP Offline
Vogon poet
T
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.

trenzterra
AustNet #trenzterra and #w
Head Scripter @ http://trenzterra.uni.cc
Re: Evaluate variables #23461 11/05/03 12:41 AM
Joined: Dec 2002
Posts: 699
N
Nimue Offline
Fjord artisan
Offline
Fjord artisan
N
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.
Re: Evaluate variables #23462 11/05/03 01:01 AM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Wow, I think we've just found another undocumented identifier! wink

> /set %messagetxt $+(2,$chr(44),15Mp3 System:) Duration $duration($calc($mp3(%mp3).length / 1000)
> //echo -a $eval(%messagetxt,2)
* Invalid format: $evalnext


Looks 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

Re: Evaluate variables #23463 11/05/03 01:10 AM
Joined: Dec 2002
Posts: 699
N
Nimue Offline
Fjord artisan
Offline
Fjord artisan
N
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.

Re: Evaluate variables #23464 11/05/03 01:18 AM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Your solution seems to solve the problem anyway smile and no wonder it was qwerty wink