mIRC Homepage
Posted By: Talon new identifier $rawinput - 30/12/07 05:52 AM
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.
Posted By: Riamus2 Re: new identifier $rawinput - 30/12/07 11:20 AM
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.
Posted By: Rand Re: new identifier $rawinput - 31/12/07 09:32 PM
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
Posted By: argv0 Re: new identifier $rawinput - 01/01/08 06:47 AM
$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.
© mIRC Discussion Forums