mIRC Home    About    Download    Register    News    Help

Print Thread
no reaction on space - enter #133664 23/10/05 02:46 PM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
Hi all.
Hope someone can help me out here

When a player (trivia) geives a space and hits enter the question is answered. Since that isn't what i want, the bot most { return } on space - enter.

this is the code sofar.
Code:
 
alias -l cryptos.control {
  if ($strip($2-) == %cryptos.answer) || ($strip($2-) == %cryptos.goodaswell) {
    if ($chr(124) isin $nick) { return }
    write-score
 


i try'd this
Code:
if ($strip($2-) == $chr(160)) || ($strip($2-) == $chr(32)) { return }

But that dowsn't work.
What do i wrong, or what can i do to prevent space - enter.

thnxs in advange
Aaron


Deridio fatum
Re: no reaction on space - enter #133665 23/10/05 02:49 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
When an on text even with matchtext * triggers on space - ctrl+enter, $0 will be 0 so you can check for that.

Btw no one can send a space with "space + enter", it does nothing. It needs to be ctrl+enter.

If they send a hard space (0160 on some fonts), then you simply do a check for if ($1- == $chr(160))

You could combine both in a regex like:

on $*:text:/[^ \240]/:#channel: ...

or

on $*:text:/(?!\240)\S/:#channel: ...

The above codes allows for $chr(160) only if there is atleast 1 other character that is neither a space or $chr(160). I assume this is what you want.


Gone.
Re: no reaction on space - enter #133666 23/10/05 03:13 PM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
thnxs FiberOptics.

they use space CTRL+enter. Problem is that i don't know how to make the bot react on that. so help is appriciated smile

greetz
Aaron


Deridio fatum
Re: no reaction on space - enter #133667 23/10/05 03:16 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I already gave you the code, look carefully.

If you use that as on text event, you don't even need to worry for checking, as i't won't trigger the event if they message either a "ctrl+enter - space" or "$chr(160)" That is, still in the assumption that those two are allowed if there is atleast 1 character that is neither, which you still haven't confirmed.


Gone.
Re: no reaction on space - enter #133668 23/10/05 03:34 PM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
sorry my fault. didn't look well enough. now i have this..

Code:
on $*:text:/[^ \240]/:#bank: { if (%loopspel != ON) { if ($strip($1-) == !start) || ($strip($1-) == !trivia) { cryptos.on } } }


still doesn't work

greetz
Aaron.


Deridio fatum
Re: no reaction on space - enter #133669 23/10/05 03:40 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Define "it still doesn't work".

It has nothing to do with the regex if your code doesn't work, the error is somewhere on your side, as that regex works fine. Btw, you do know that it won't have any effect if you have an on text event in the same script file above it with matchtext *, right? As that one will consume all on text.

Your original question has been answered, we can't help you further with your script, as it's something specific on your side.

Note that the regex matchtext was only added in mIRC 6.1, and that there was a fix for it in 6.15


Gone.
Re: no reaction on space - enter #133670 23/10/05 03:41 PM
Joined: Aug 2003
Posts: 314
S
Sigh Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
Try using:

Code:
on $*:text:/^(?![ \240]$)/:#bank:{


Edit: actually the others should also do, this one just checks if ($1- = $chr(32)) || ($1- = $chr(160))

Last edited by Sigh; 23/10/05 03:43 PM.
Re: no reaction on space - enter #133671 23/10/05 03:47 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Indeed, it has nothing to do with the regex. If the other ones didn't work, neither will that one. It's a problem on his side which we can't help with.


Gone.
Re: no reaction on space - enter #133672 23/10/05 07:54 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
You migth look here

if ($strip($2-) == %cryptos.answer) || ($strip($2-) == %cryptos.goodaswell) {

$2- more than likely is nothing and %cryptos.goodaswell more than likely has no value either, so you may be getting a $null == $null true condition.

Re: no reaction on space - enter #133673 23/10/05 08:41 PM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
i'v solved it with
Code:
if ($gettok($2-,1,160) == $true) { return }

and that works fine.

Everyone thanks for the suggestions and help.

Greetz
Aaron


Deridio fatum
Re: no reaction on space - enter #133674 24/10/05 08:57 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I shudder a bit at that, I just have no idea what might have been passed as $2- that that worked.

However if it does it does smile