mIRC Home    About    Download    Register    News    Help

Print Thread
$RETURN(xyz) or /RETURN(xyz) #124190 03/07/05 08:44 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I dont know how possable it is due to the way lines are processed,

but the idea is that rather than issuing a /RETURN xyz you can issue a $RETURN(xyz) or just /RETURN(xyz)
xyz is the return value of course,

Reason? Well i just realised that consecutive spaces in a returned value are swallowed up

example
Code:
alias example {
  var %returnvalue = $replace(a...e,.,$chr(32))
  echo -a Len of returnvalue pre return is $len(%returnvalue)
  return %returnvalue
}


//echo -a Len of returnvalue post return is $len($example)
Len of returnvalue pre return is 5
Len of returnvalue post return is 3

Re: $RETURN(xyz) or /RETURN(xyz) #124191 03/07/05 10:24 AM
Joined: Apr 2004
Posts: 853
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 853
I agree, I've run into this problem as well, and it would be great if there was a way around this behaviour of (especially) /return.

However, I'd much rather see some kind of command prefix that prevents double consecutive spaces from being stripped off, for any command.. That would solve this problem, and more.

I suggest the ^ character, e.g.
Code:
  ^return %returnvalue
because of the close relation to "halting default text", although I can already hardly wait for some people to post that they already use ^commands in their scripts. grin Anyway, it could also be a command on itself, instead of a prefix.

The idea is then that if this prefix is present, the parameters would still be tokenized, but all double consecutive spaces minus one (as well as all leading/trailing spaces) would be made part of the next parameter (or previous one, if there are no more) instead of being stripped off. This is clean, simple to use and backwards compatible, and it should be fairly easy to implement..

Additionally, I'd like $rawmsg to work for every event that uses $1- (especially "on INPUT"), instead of just for events triggered by text from IRC servers, but that's another story.

Last edited by Sat; 03/07/05 10:59 AM.

Saturn, QuakeNet staff
Re: $RETURN(xyz) or /RETURN(xyz) #124192 04/07/05 10:49 AM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I like the prefix idea, since it could work for any command.


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