mIRC Home    About    Download    Register    News    Help

Print Thread
#80756 26/04/04 06:43 PM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
hi all
since a few weeks i'm trying to replace te spaces in a line into random a/z.
The line is colored yellow on black, but the spaces needs to be random a/z in the black color, so a normal colored line appears, but when copied you will see this

sinceawhengdoesxaqhorse et.etc.

i try'd %tmp = $replace(%line,$chr(160),$rand(a,z))
but that didn't work.
help appriciated.

Greetings
Aaron


Deridio fatum
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Try this:
Code:
alias storl return $remove($($lf $+ $replace($1,$chr(160),$lf $!+ $!r(a,z) $!+ $lf),2),$lf)
Usage: $storl(text goes here)

Note that I assumed that all spaces in the text are going to be char 160. If this isn't true, the alias has to be modified.

Last edited by qwerty; 26/04/04 07:17 PM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
To prevent someone from making a script that can cheat at a trivia game, I suspect?

Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
hi qwerti
yep all spaces are $chr(160) and no.. your solutions doesn't work for me. crazy
Wolfie: yes. you're right smile perhaps you know a solution?

greetings
Aaron


Deridio fatum
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
I tried the solution offered and it does the trick for me
It could be that you are using $chr(32) but thinking you are using $chr(160) - try that and see if that works.

and I was only wondering because I like to sometimes try to figure out ways of defeating trivia's that try to prevent cheating. grin

Which wouldn't be too difficult in this case. smile Even with the random characters added in.

Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
hi wolfie.
i changed the 160 into 32 and now the trick is also working for me.
qwerti: thank you for the script. smile

Wolfie: i know that real programmers can avoid the cheat-protection, but he.. smile i gotta do something and at least it gives the kiddos a hard time.

Greetings
Aaron


Deridio fatum
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Nice coding, as always laugh

Would this work too?

alias storl return $($replace($1,$chr(160),$chr(32) $!+ $!r(a,z) $!+ $chr(32)),2)

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
There would be a problem if one of the words besides the 1st is a variable/identifier. That's because of the
$($replace($1,$chr(160),$chr(32) $!+ $!r(a,z) $!+ $chr(32)),2)
if $1 is "one<chr60>two<chr60>$me"
the string inside $(...,2) would be "one $+ $r(a,z) $+ two $+ $r(a,z) $+ $me"
so eval-ing it twice would make it "oneRtwoRqwerty"

However, it turns out that the OP meant char 32, not char 160. I rewrote the alias to accomodate for that; this also made it smaller/faster. Here it is:
Code:
alias storl return $remove($($lf $+ $replace($1,$chr(32),$lf $!r(a,z) $lf),2),$lf,$chr(32))


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
thats a nice piece of code qwerty. Thank you again.

But is it also possible to include numbers aswell?
like $!r(a,z..0,9) or something like that?, because year numbers are gone aswell now smile

Greetings
Aaron


Deridio fatum
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Yes, if you change $!r(a,z) to $!iif($r(0,1),$r(a,z),$r(0,9))

$!base($r(0,35),10,36) would work too (© qwerty)

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
I see. Thanks for the explanation laugh

Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
i did the changing as you told me, and the numbers are visible now smile
however.. the questions looks like this now:
onwich planet isthe ... etc. confused

greetings
Aaron

P.S. i learn alot here. smile


Deridio fatum
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
perhaps showing the script where it calls on the randomization and sends it could provide better assistance.

grin


Link Copied to Clipboard