mIRC Home    About    Download    Register    News    Help

Print Thread
#192361 30/12/07 05:52 AM
Joined: Dec 2002
Posts: 252
T
Talon Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
Lets talk about every scripters FAVORITE subject, THEMES AND THE REMOVAL OF MULTIPLE SPACES! that evil little pet pieve to just about every scripter out there, on an event we can simply use $rawmsg to get what the server actually sent us, rather than what the nasty $1- is gonna do. so example space fix

on ^*:text:*:?: {
haltdef
var %1- = $mid($gettok($regsubex($rawmsg, /(?<= |^)(?= |$)/g, $str($chr(2),2)),4-,32),2)
echo $nick 4< $+ $nick $+ 4> %1-
}

so from our raw msg and a simple regex, we can replace double spaces with [space][bold][bold][space] and now our echo is right. WE SEE MULTIPLE SPACES!!! I originally was using ctrl+o but thats the kill character, it stops color, bold, underline, reverse... anyways $rawinput I would like to return EXACTLY what was in the input box to avoid the nasty $1- problem in an on input event.

This method allows multiple spaces and proper copying if you dont need the colors, like a normal copy.. ctrl+copy is gonna give you a buncha [bold][bold]'s if theres multiple spaces.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Keep in mind that if the sender knows what he/she is doing, you *will* see multiple spaces if they send multiple spaces without needing to use any kind of script. For example, Invision has the ability to paste copied text (such as a script or ASCII art) without losing the spacing and anyone with or without Invision will see the correct spacing. For that matter, if someone uses multiple spaces when sending text from the edit line and he/she hits Ctrl-Enter instead of Enter, everyone will see those spaces as well, so it's really a matter of getting people who send such text to understand how to correctly send it. Of course, that isn't to say that making mIRC handle multiple spaces wouldn't be good, because it would.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
While $rawinput isn't a terrible idea (and at best, isn't a great work around), there are better workarounds available. Such as Saturn's "spaces.dll". This .dll is pretty nice, as it offers an easy way to echo messages, and send messages, with all spaces intact without the use of $chr(160) or use of double control codes between spaces.

Code:
on *:input:#:{
  if (/* iswm $1 && !$inpaste && !$ctrlenter) { return }

  var %input = $dll(spaces.dll, input, )
  var %me = $+(04<,$me,04>)
  noop $dll(spaces.dll, echo, -atci3 own %me %input)
  noop $dll(spaces.dll, send, PRIVMSG # : $+ %input)
  haltdef
}

on ^$*:text:/^(.*)$/:#:{
  var %n = $+(04<,$nick,04>)
  noop $dll(spaces.dll, echo, -mbfltci3 normal # %n $regml(1))
  haltdef
}



That's an example of how spaces.dll works. smile

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
$editbox($active) already returns the untokenized contents of the line of input if you really need it.. so really, the identifier you want already exists.

You still can't do much with it though, since mIRC tokenizes every /command.

And no, mIRC probably won't allow multiple spaces in your lifetime.. the parser is pretty heavily dependent on it, and many scripts using tokenization functions would break if it were to change.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Link Copied to Clipboard