mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
Hi all,
Just back from holliday in noticed an error in a piece of code i was helped with.
However; this code doesn't show numbers (in a line)

the code:

alias teller {
var %i = 1, %total = $numtok($1-,32), %output
while (%i <= %total) {
var %x = $len($gettok($1-,%i,32))
var %output = %output $+ $str(+,%x) $+ $chr(160)
inc %i
}
$iif($isid,return,msg #myroom) Line: %output
}

if, for example, this is a line: in 1895 the world experienced etc. etc.

i just see: in /spaces/ the world experienced etc. etc.

who knows a solution?

Thanxs in advange
Aaron


Deridio fatum
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
It returns:
Line: ++ ++++ +++ +++++ +++++++++++ ++++ +++
here. Since you didn't tell us what the correct answer should be, I assume you wanted this.
The code you gave is correct, there is no reason for the 1895 to be replaced by spaces...

If you want another way (keeps spaces, does not replace them with $chr(160))
alias teller {
var %output, %a = $regsub($1-,/\S/g,+,%output)
$iif($isid,return,msg #myroom) Line: %output
}

You can change the \S to \w if you only want a-zA-Z0-9_ to be replaced and to [-\w] to also replace the -

Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
hi Kelder.

well, after using teller the line: in 1895 the world experienced etc. etc. needs to look like this:
inw1895xtheyworldkexpierencedletc.xetc.
by coloring de letters yellow on black and the random extra letters black on black the normal text is visible again. (to sortoff prevent copying) but the numbers are black on black aswell, so not visible either.

hope i was clear.
Aaron


Deridio fatum
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

Usage: $anticheat(string)
Code:
 
alias anticheat {
  tokenize 32 $1
  var %a = 1, %b = $1
  while $gettok($2-,%a,32) != $null { %b = $+(%b,01,$r(a,z),08,$v1) | inc %a }
  return 08,01 $+ %b 
}

At first I would have given you a solution with $replace, but it's limited when your input string is long, so a while loop is more appropriate.

Greets

Last edited by FiberOPtics; 14/09/04 06:01 PM.

Gone.
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
both routines are working, but still no numbers are visible

question: what happened in 1800 in USA
it still shows what happened in /spaces/ in USA

Greetz
Aaron



Deridio fatum
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
Although its an idea, I wouldnt imagine it'd be very effective, to simply replace spaces with a random letter, because, since you are putting a colour code either side of it, people can just remove the entire string, from the first color code to the last and replace it with a space.

Eamonn.

Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
hi coolkill

Yep, you're absolutely right smile

i just thought that it will give people a harder time to do so.

anyway; i don't use the routine no longer because of that reason. crazy

Greetz
Aaron


Deridio fatum
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

obviously anyone with some decent scripting skills can always find ways around the anticheat. However, and I speak out of experience, some of the less experienced scripters are scared away by it, so I'd still run it nevertheless.

Regarding the issue you are having, I cannot reproduce it, so it must be something else in your scripts interfering. I get that string just fine with $anticheat.

08,01what01d08happened01c08in01n08180001r08in01j08USA

Greets

Last edited by FiberOPtics; 15/09/04 10:57 AM.

Gone.
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
ah, in that case:

alias triviaencode {
var %output = $1-, %r = 1,1 $+ $rand(a,z) $+ 8,01
while ( $regsub(%output,\s,%r,%output) ) { var %r = 1,1 $+ $rand(a,z) $+ 8,01 }
$iif($isid,return,msg #myroom) 8,01Line: %output $+ 
}

Had to use while loop to get different random characters inbetween. Notice the 01 as background color to prevent numbers in the text from being appended.

Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
Hi Kelder

your triviaencode works awesome smile
thank you ever so much.
Also thanks to fiberOptics for your efforts.

you guys are the best.

greetz from a happy
Aaron


Deridio fatum

Link Copied to Clipboard