mIRC Home    About    Download    Register    News    Help

Print Thread
#141163 05/02/06 10:32 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
%c set to 'there'
(below i have in a join event)
.timertst -m 1 100 echo -a hello [ $+ [ %c ] ]

echos hellothere

it should echo

hello there

#141164 05/02/06 11:00 PM
Joined: Nov 2005
Posts: 105
D
Vogon poet
Offline
Vogon poet
D
Joined: Nov 2005
Posts: 105
the line
Code:
timertst -m 1 100 echo -a hello [ $+ [ %c ] ]

doesn't need the [ $+ [ ] ]
just change it to
Code:
timertst -m 1 100 echo -a hello %c

the $+ is combining the hello and there.

#141165 06/02/06 12:42 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
that just echos hello

#141166 06/02/06 01:04 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
.timertst -m 1 100 echo -a hello %c

I have no idea why you would be using $+, since that concatenates strings, and you don't want it to be concatenated. The [ ] brackets serve no purpose here btw, they only serve a purpose when trying to evaluate dynamic variables, or when changing the order of evaluation. Yours is just a regular variable, so none of the cases apply.

EDIT: drc4 apparently already said this lol, didn't read his post. If it only echo's "hello", then it means that you don't have a global variable named %c. I put global in bold, because you say you have that code below in an on join event, this means it is seperated from where the variable is set. If you were setting %c as a local variable (/var or /set -l) then the variable is destroyed once the script finishes, so it would have no meaning in an on join event.


Gone.
#141167 06/02/06 12:56 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
ok thanks, what about something like this then

Code:
elseif ($2 == JOIN) {
var %c = %testvar

.timertest -m 1 100 echo -a This is a %c
}


how can i get it to echo the %c bit, because it only echos
'This is a'

#141168 06/02/06 02:00 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
If it only echoes 'this is a' then it means %c is $null, which in term means %testvar is $null, so you need to look at how and where %testvar is being set, because in its current state %testvar has no value.


Gone.
#141169 06/02/06 02:05 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
but i just want to make it echo..

This is a %testvar

#141170 06/02/06 02:13 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I don't think you are understanding the concepts of variables in mIRC here.

You assign the value of %testvar to a variable named %c. You then echo the value of %c and it shows that %c is empty. What does that tell you about %testvar? It tells you it has no value, so your results are completely natural.

If you want it to echo something, you will need to set the %testvar to some value prior to the setting to %c.

Or do you mean you want to actually echo "%testvar"? To do that you do: //echo -a % $+ testvar

Or if you wanna do it with another variable it's like this:

var %c = % $+ testvar
echo -a %c

BUT in a timer, things are evaluated two times when called from a script! One time when you call the timer, and one time when the timer triggers. Let's see what that does to your example:

var %c = % $+ testvar
.timer 1 0 echo -a %c

--> when the timer is initiated %c is evaluated to %testvar
--> when the timer triggers %testvar again evaluates, this time to $null, because %testvar has no value set.

Solution:

var %c = % $!+ testvar
.timer 1 0 echo -a %c

--> evaluates %c to % $+ testvar
--> evaluates % $+ testvar to %testvar


Gone.
#141171 06/02/06 02:25 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
thanks alot!!!


Link Copied to Clipboard