Jump to content
  • 0

adding time on bot checker help


Question

Posted

help me to add 30seconds timer on this bot checker

-	script	AntiBot	-1,{


OnNPCKillEvent:
set @Kill,@Kill + 1;
if( @Kill < 243 ) end; // 100 kill to trigger
set @Kill,0;

atcommand "@option 2 0 3";
sc_start sc_berserk, 1000000000, 1;
set .@A,rand(10);
set .@B,rand(10);
mes "If A = "+.@A+"   B = "+.@B;
switch( rand(1) ){
Case 0:
set .@Answer,.@A + .@B;
mes "How many is A + B ?";
break;
//Case 1:
set .@Answer,.@A - .@B;
mes "How many is A - B ?";
break;
//Case 2:
set .@Answer,.@A * .@B;
mes "How many is A * B ?";
break;
//Case 3:
set .@Answer,.@A / .@B;
mes "How many is A / B ?";
break;
}
input .@Input;
if( .@Input != .@Answer ){
mes "Wrong";
sc_end sc_berserk;
atcommand "@option 0";
atcommand "@load";
atcommand "@alootid";
atcommand "@autoloot 0";
atcommand "@mute 15 "+strcharinfo(0);
}

else if( .@Input == .@Answer ){
mes "Good Job!";
sc_end sc_berserk;
atcommand "@option 0";
percentheal 0,100; // since berserk use your 100% sp
}
close;

}

6 answers to this question

Recommended Posts

Posted (edited)

http://www.eathena.ws/board/index.php?s=&showtopic=242936&view=findpost&p=1323849

-	script	antibot	-1,{
OnPCLoginEvent:
	setoption 0x40, 1;
	pcblockmove getcharid(3), 1;
	sc_start sc_berserk, 1000000000, 1;
	addtimer 10000, "antibot::OnCheat";
	set @respond, gettimetick(2);
	mes "[ xxxRO Antibot ]";
	mes "Are you player or bot ?";
	mes "Must respond all within 10 seconds";
	next;
	if ( select ( "Bot", "Player" ) == 1 ) end;
	mes "[ xxxRO Antibot ]";
	mes "Are you sure ?";
	next;
	if ( gettimetick(2) > @respond +10 ) end; // try comment this line
	else if ( select ( "Yes", "No" ) == 2 ) end;
	deltimer "antibot::OnCheat";
	setoption 0x40, 0;
	pcblockmove getcharid(3), 0;
	sc_end sc_berserk;
	percentheal 100,100;
	mes "[ xxxRO AntiBot ]";
	mes "Congratulation !!";
	mes "You have passed the test.";
	close;
OnCheat:
	atcommand "@kick "+ strcharinfo(0);
	end;
}
I wonder is there anybody else having a better method ?

this method is already 3 years old

Edited by AnnieRuru
Posted

http://www.eathena.ws/board/index.php?s=&showtopic=242936&view=findpost&p=1323849

 

-	script	antibot	-1,{
OnPCLoginEvent:
	setoption 0x40, 1;
	pcblockmove getcharid(3), 1;
	sc_start sc_berserk, 1000000000, 1;
	addtimer 10000, "antibot::OnCheat";
	set @respond, gettimetick(2);
	mes "[ xxxRO Antibot ]";
	mes "Are you player or bot ?";
	mes "Must respond all within 10 seconds";
	next;
	if ( select ( "Bot", "Player" ) == 1 ) end;
	mes "[ xxxRO Antibot ]";
	mes "Are you sure ?";
	next;
	if ( gettimetick(2) > @respond +10 ) end; // try comment this line
	else if ( select ( "Yes", "No" ) == 2 ) end;
	deltimer "antibot::OnCheat";
	setoption 0x40, 0;
	pcblockmove getcharid(3), 0;
	sc_end sc_berserk;
	percentheal 100,100;
	mes "[ xxxRO AntiBot ]";
	mes "Congratulation !!";
	mes "You have passed the test.";
	close;
OnCheat:
	atcommand "@kick "+ strcharinfo(0);
	end;
}
I wonder is there anybody else having a better method ?

this method is already 3 yeathanks

thanks annie...uhmm is there a better bot checker?

btw why OnPCLoginEvent?? why not OnNPCKillEvent?

Posted (edited)

<.< ... this is support section so of course I'm just posting an example ...

the method that I'm talking is the part how to kick the bot, not the bot-checking algorithm

if you wanted spoon feed you should've tell earlier

-	script	AntiBot	-1,{
OnPCLoginEvent:
	setoption 0x40, 0; // prevent abuse
	end;
OnCheat:
	dispbottom "too long";
	sc_end sc_berserk;
	percentheal 100,100;
	setoption 0x40, 0;
	end;
OnNPCKillEvent:
	if ( rand(100) ) end; // 1% chance to triggering
	setoption 0x40, 1;
	sc_start sc_berserk, 1000000000, 1;
	addtimer 30000, strnpcinfo(0)+"::OnCheat";
	.@respond = gettimetick(2);
	mes "if A = "+( .@a = rand(1,10) )+", B = "+( .@b = rand(1,10) );
	setarray .@arithmetic$, "+", "-", "*", "/";
	mes "How many is A "+ .@arithmetic$[ .@arithmetic = rand(4) ] +" B ?";
	switch ( .@arithmetic ) {
	default: .@answer = .@a + .@b; break;
	case 1: .@answer = .@a - .@b; break;
	case 2: .@answer = .@a * .@b; break;
	case 3: .@answer = .@a / .@b;
	}
	next;
	input .@input, -100, 100;
	deltimer strnpcinfo(0)+"::OnCheat";
	sc_end sc_berserk;
	percentheal 100,100;
	setoption 0x40, 0;
	if ( gettimetick(2) > .@respond +30 ) {
		mes "you taken too long to answer";
		close;
	}
	else if ( .@input == .@answer ) {
		mes "Good Job";
		close;
	}
	else {
		mes "Wrong";
		close;
	}
}
and do you know the input only allow positive numbers ?

if a = 2, b = 5,

a - b = -3

players can never input -3 because it is negative

a = 4, b = 0

a / b = ∞

so I put rand(1,10) for it

Edited by AnnieRuru
Posted

<.< ... this is support section so of course I'm just posting an example ...

the method that I'm talking is the part how to kick the bot, not the bot-checking algorithm

if you wanted spoon feed you should've tell earlier

-	script	AntiBot	-1,{
OnPCLoginEvent:
	setoption 0x40, 0; // prevent abuse
	end;
OnCheat:
	dispbottom "too long";
	sc_end sc_berserk;
	percentheal 100,100;
	setoption 0x40, 0;
	end;
OnNPCKillEvent:
	if ( rand(100) ) end; // 1% chance to triggering
	setoption 0x40, 1;
	sc_start sc_berserk, 1000000000, 1;
	addtimer 30000, strnpcinfo(0)+"::OnCheat";
	.@respond = gettimetick(2);
	mes "if A = "+( .@a = rand(1,10) )+", B = "+( .@b = rand(1,10) );
	setarray .@arithmetic$, "+", "-", "*", "/";
	mes "How many is A "+ .@arithmetic$[ .@arithmetic = rand(4) ] +" B ?";
	switch ( .@arithmetic ) {
	default: .@answer = .@a + .@b; break;
	case 1: .@answer = .@a - .@b; break;
	case 2: .@answer = .@a * .@b; break;
	case 3: .@answer = .@a / .@b;
	}
	next;
	input .@input, -100, 100;
	deltimer strnpcinfo(0)+"::OnCheat";
	sc_end sc_berserk;
	percentheal 100,100;
	setoption 0x40, 0;
	if ( gettimetick(2) > .@respond +30 ) {
		mes "you taken too long to answer";
		close;
	}
	else if ( .@input == .@answer ) {
		mes "Good Job";
		close;
	}
	else {
		mes "Wrong";
		close;
	}
}
and do you know the input only allow positive numbers ?

if a = 2, b = 5,

a - b = -3

players can never input -3 because it is negative

a = 4, b = 0

a / b = ∞

so I put rand(1,10) for it

 

sorry and thanks T_T

Posted

<.< ... this is support section so of course I'm just posting an example ...

the method that I'm talking is the part how to kick the bot, not the bot-checking algorithm

if you wanted spoon feed you should've tell earlier

-	script	AntiBot	-1,{
OnPCLoginEvent:
	setoption 0x40, 0; // prevent abuse
	end;
OnCheat:
	dispbottom "too long";
	sc_end sc_berserk;
	percentheal 100,100;
	setoption 0x40, 0;
	end;
OnNPCKillEvent:
	if ( rand(100) ) end; // 1% chance to triggering
	setoption 0x40, 1;
	sc_start sc_berserk, 1000000000, 1;
	addtimer 30000, strnpcinfo(0)+"::OnCheat";
	.@respond = gettimetick(2);
	mes "if A = "+( .@a = rand(1,10) )+", B = "+( .@b = rand(1,10) );
	setarray .@arithmetic$, "+", "-", "*", "/";
	mes "How many is A "+ .@arithmetic$[ .@arithmetic = rand(4) ] +" B ?";
	switch ( .@arithmetic ) {
	default: .@answer = .@a + .@b; break;
	case 1: .@answer = .@a - .@b; break;
	case 2: .@answer = .@a * .@b; break;
	case 3: .@answer = .@a / .@b;
	}
	next;
	input .@input, -100, 100;
	deltimer strnpcinfo(0)+"::OnCheat";
	sc_end sc_berserk;
	percentheal 100,100;
	setoption 0x40, 0;
	if ( gettimetick(2) > .@respond +30 ) {
		mes "you taken too long to answer";
		close;
	}
	else if ( .@input == .@answer ) {
		mes "Good Job";
		close;
	}
	else {
		mes "Wrong";
		close;
	}
}
and do you know the input only allow positive numbers ?

if a = 2, b = 5,

a - b = -3

players can never input -3 because it is negative

a = 4, b = 0

a / b = ∞

so I put rand(1,10) for it

 

mam error

 

 
script error on npc/rns/main/bot.txt line 16
    parse_line: expect command, missing function name or calling undeclared function
    11 : OnNPCKillEvent:
    12 :        if ( rand(100) ) end; // 1% chance to triggering
    13 :        setoption 0x40, 1;
    14 :        sc_start sc_berserk, 1000000000, 1;
    15 :        addtimer 30000, strnpcinfo(0)+"::OnCheat";
*   16 :        '.'@respond = gettimetick(2);
    17 :        mes "if A = "+( .@a = rand(1,10) )+", B = "+( .@b = rand(1,10) );
    18 :        setarray .@arithmetic$, "+", "-", "*", "/";
    19 :        mes "How many is A "+ .@arithmetic$[ .@arithmetic = rand(4) ] +" B ?";
    20 :        switch ( .@arithmetic ) {
    21 :        default: .@answer = .@a + .@b; break;

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...