Jump to content
  • 0

Fact event add timer


mrlongshen

Question


  • Group:  Members
  • Topic Count:  98
  • Topics Per Day:  0.02
  • Content Count:  1302
  • Reputation:   77
  • Joined:  12/04/12
  • Last Seen:  

someone ? how i do add a timer on this script ? I want every 20 minute in hour, i will auto triggered. thx

//===== eAthena Script =====================================================================
//=  Fact Event
//===== By: ================================================================================
//= Hellflaem
//===== Current Version: ===================================================================
//= 1.0
//===== Compatible With: ===================================================================
//= Eathena SVN and 3ceam
//===== Description: =======================================================================
//= It's a Facts Event based on about 52 Facts from the Facts Announcer Script by xienne15.
//= The Event is started by players, They just have to click the npc.
//= Players are asked to fill in the missing word(s) of the facts.
//= If they get it right they get an item. Player just have to say the answer outloud.
//========Credits===========================================================================
//=ToastOfDoom
//=RxChris
//==========================================================================================
mora,137,171,3 script Facts Event 917,{
if ($@EventON){end;}
 function DefineQuestion;
 function GetQuestion;
 function GetAnswer;
 //set .i, (.i + 1) % .numQuestions; //This is for testing.
 set .i, rand(.numQuestions); // Randomly picks a fact.
 set $rewarditem, 7539; //Poring Coins
 set $rand, rand(1,500);  // Randomly picks from 1 to 5.
 set $@EventON,1;
 npctalk "Sila isi dalam tempat kosong:";
 sleep2 2000;
 npctalk "Jika anda rasa ia betul. Saya akan memberikan anda beberapa syiling poring!";
 sleep2 4000;
 npctalk "Fact " + .i + ": " + GetQuestion(.i);
 set .@answer$,GetAnswer(.i);
 defpattern 1, "([^:]+):.*\\s"+.@answer$+"(.*)", "Right";
 activatepset 1;
 initnpctimer;
 end;
OnTimer30000:
 npctalk "Maaf, anda mengambil masa yang amat panjang.";
 deletepset 1;
 set $@EventON,0;
 stopnpctimer;
 setnpctimer 0;
 end;
Right:
 npctalk "Itu adalah betul, sila ambil ini.";
 getitem $rewarditem,$rand;
 deletepset 1;
 stopnpctimer;
 setnpctimer 0;
 set $@EventON,0;
 end;

 function DefineQuestion {
  set .@a, .numQuestions % 128;
  set .@b, .numQuestions / 128;

  setd(".question_" + .@a + "$[" + .@b + "]", getarg(0));
  setd(".answer_" + .@a + "$[" + .@b + "]", getarg(1));
  set .numQuestions, .numQuestions + 1;
  return;
 }
 function GetQuestion {
  return getd(".question_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]");
 }
 function GetAnswer {
  return getd(".answer_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]");
 }
OnInit:
set $@EventON,0;
DefineQuestion("What is your mum name ? _____ ","poring");
}

Link to comment
Share on other sites

13 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Then try this one

//===== eAthena Script =====================================================================
//=  Fact Event
//===== By: ================================================================================
//= Hellflaem
//===== Current Version: ===================================================================
//= 1.0
//===== Compatible With: ===================================================================
//= Eathena SVN and 3ceam
//===== Description: =======================================================================
//= It's a Facts Event based on about 52 Facts from the Facts Announcer Script by xienne15.
//= The Event is started by players, They just have to click the npc.
//= Players are asked to fill in the missing word(s) of the facts.
//= If they get it right they get an item. Player just have to say the answer outloud.
//========Credits===========================================================================
//=ToastOfDoom
//=RxChris
//==========================================================================================
mora,137,171,3	script	Facts Event	917,{
end;
function DefineQuestion; function GetQuestion; function GetAnswer;

OnMinute20:
OnMinute40:
OnMinute00:
    announce "The fact Event will begin in 3 minutes.",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
	sleep 60000;
    announce "The fact Event will begin in 2 minutes.",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
	sleep 60000;
    announce "The Fact Event will begin 1 minute.",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
	sleep 60000;
    announce "The fact Event has begun!",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
L_loop:
	freeloop(1);
	do {
		set .@i, rand( .numQuestions ); // Randomly picks a fact.
		.@c++;
	}
	while( callsub( L_check, .@i ) && .@c < 100 );
	freeloop(0);
	callsub( L_check, .@i, 0 );
	if( !.count ) {
		npctalk "Sila isi dalam tempat kosong:";
		sleep 2000;
		npctalk "Jika anda rasa ia betul. Saya akan memberikan anda beberapa syiling poring!";
	}
	.count++;
	sleep 4000;
	npctalk "Fact: " + GetQuestion(.@i);
	defpattern 1, "([^:]+):.*\\s"+ GetAnswer( .@i ) +"(.*)", "Right";
	activatepset 1;
	initnpctimer;
	end;
OnTimer30000:
	npctalk "Maaf, anda mengambil masa yang amat panjang.";
	goto L_continue;
Right:
	npctalk "Itu adalah betul, sila ambil ini.";
	getitem .rewarditem, rand( 1,500 ); // Randomly picks from 1 to 5.
L_continue:
	deletepset 1;
	stopnpctimer;
	if( .count < .max_questions ) goto L_loop;
	.count = 0; // end of event
	while( getd( ".Q_session"+ .@j ) ) {
		setd ".Q_session"+ .@j, 0;
		.@j++;
	}
	npctalk "end of event";
	end;
L_check:
	.@i = getarg(0);
	while( .@j * 30 < .@i ) .@j++;
	.@j--;
	.@tmp = .@i - .@j * 30;
	if( getarg( 1,1 ) )
		return getd( ".Q_session"+ .@j ) & 1 << .@tmp;
	else {
		setd ".Q_session"+ .@j, getd( ".Q_session"+ .@j ) | 1 << .@tmp;
		return;
	}
		
function DefineQuestion {
	set .@a, .numQuestions % 128;
	set .@b, .numQuestions / 128;

	setd(".question_" + .@a + "$[" + .@b + "]", getarg(0));
	setd(".answer_" + .@a + "$[" + .@b + "]", getarg(1));
	set .numQuestions, .numQuestions + 1;
	return;
}
function GetQuestion {
	return getd(".question_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]");
}
function GetAnswer {
	return getd(".answer_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]");
}
OnInit:
	set .rewarditem, 7539;	//Poring Coins
	.max_questions = 10;	// 10 questions if more than 10 questions are defined
	DefineQuestion("What is your mum name ? _____ ","poring");
	DefineQuestion("What is your father name ? _____ ","poporing");
	if( .numQuestions < .max_questions ) .max_questions = .numQuestions;
	end;
}

~unlimit fact

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

This ?

OnMinute<minute>:

mora,137,171,3    script    Facts Event    917,{
end;
OnMinute20:
OnMinute40:
OnMinute00:
...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  98
  • Topics Per Day:  0.02
  • Content Count:  1302
  • Reputation:   77
  • Joined:  12/04/12
  • Last Seen:  

thx bro. its work fine, but why the npc is not continue ask question ? i got 10 question. it just start the 1st question only.. :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Because of this part:

Right:
 npctalk "Itu adalah betul, sila ambil ini.";
 getitem $rewarditem,$rand;
 deletepset 1;
 stopnpctimer;
 setnpctimer 0;
 set $@EventON,0;
 end;

You can use a Loop or While to add more questions.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  98
  • Topics Per Day:  0.02
  • Content Count:  1302
  • Reputation:   77
  • Joined:  12/04/12
  • Last Seen:  

Because of this part:

Right:
 npctalk "Itu adalah betul, sila ambil ini.";
 getitem $rewarditem,$rand;
 deletepset 1;
 stopnpctimer;
 setnpctimer 0;
 set $@EventON,0;
 end;

You can use a Loop or While to add more questions.

haha, idk to edit script :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  98
  • Topics Per Day:  0.02
  • Content Count:  1302
  • Reputation:   77
  • Joined:  12/04/12
  • Last Seen:  

This ?

OnMinute<minute>:

mora,137,171,3    script    Facts Event    917,{
end;
OnMinute20:
OnMinute40:
OnMinute00:
...

 

please help me and trigger the loops :(

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


//===== eAthena Script =====================================================================

//= Fact Event

//===== By: ================================================================================

//= Hellflaem

//===== Current Version: ===================================================================

//= 1.0

//===== Compatible With: ===================================================================

//= Eathena SVN and 3ceam

//===== Description: =======================================================================

//= It's a Facts Event based on about 52 Facts from the Facts Announcer Script by xienne15.

//= The Event is started by players, They just have to click the npc.

//= Players are asked to fill in the missing word(s) of the facts.

//= If they get it right they get an item. Player just have to say the answer outloud.

//========Credits===========================================================================

//=ToastOfDoom

//=RxChris

//==========================================================================================

mora,137,171,3 script Facts Event 917,{

end;

function DefineQuestion; function GetQuestion; function GetAnswer;

OnMinute20:

OnMinute40:

OnMinute00:

do

set .@i, rand( .numQuestions ); // Randomly picks a fact.

while( .Q_session & 1 << .@i && .Q_session && .count < .numQuestions );

set .Q_session, .Q_session | 1 << .@i;// max 32 questions

if( !.count ) {

npctalk "Sila isi dalam tempat kosong:";

sleep 2000;

npctalk "Jika anda rasa ia betul. Saya akan memberikan anda beberapa syiling poring!";

}

.count++;

sleep 4000;

npctalk "Fact: " + GetQuestion(.@i);

defpattern 1, "([^:]+):.*\\s"+ GetAnswer( .@i ) +"(.*)", "Right";

activatepset 1;

initnpctimer;

end;

OnTimer30000:

npctalk "Maaf, anda mengambil masa yang amat panjang.";

goto L_continue;

Right:

npctalk "Itu adalah betul, sila ambil ini.";

getitem .rewarditem, rand( 1,500 ); // Randomly picks from 1 to 5.

L_continue:

deletepset 1;

stopnpctimer;

if( .count < .max_questions ) goto OnMinute00; // loop 10 questions

.count = 0; // end of event

.Q_session = 0;

npctalk "end of event";

end;

function DefineQuestion {

set .@a, .numQuestions % 128;

set .@b, .numQuestions / 128;

setd(".question_" + .@a + "$[" + .@b + "]", getarg(0));

setd(".answer_" + .@a + "$[" + .@b + "]", getarg(1));

set .numQuestions, .numQuestions + 1;

return;

}

function GetQuestion {

return getd(".question_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]");

}

function GetAnswer {

return getd(".answer_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]");

}

OnInit:

set .EventON, 0;

set .rewarditem, 7539; //Poring Coins

.max_questions = 10; // 10 questions if more than 10 questions are defined

DefineQuestion("What is your mum name ? _____ ","poring");

DefineQuestion("What is your father name ? _____ ","poporing");

if( .numQuestions < .max_questions ) .max_questions = .numQuestions;

end;

}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  98
  • Topics Per Day:  0.02
  • Content Count:  1302
  • Reputation:   77
  • Joined:  12/04/12
  • Last Seen:  

@capuche, thanks alot. btw. how to add 5 minute before event start, there will be a annoucement.

bc_all. where to add it?

 

set .ResetCounter,.ResetCounter+1;
    set .EventON,1;
    set .Timer,1;
    set .Wait,1;
    announce "The fact Event will begin in 3 minutes.",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
    setnpctimer 0;
    initnpctimer;
    end;
OnTimer60000:
    if (.Timer!=1) end;
    announce "The fact Event will begin in 2 minutes.",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
    end;
OnTimer120000:
    if (.Timer!=1) end;
    announce "The Fact Event will begin 1 minute.",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
    end;
OnTimer180000:
    if (.Timer!=1) end;
    announce "The fact Event has begun!",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
    set .Timer,0; stopnpctimer;
    setnpctimer 0; initnpctimer;
Edited by mrlongshen
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

//===== eAthena Script =====================================================================
//=  Fact Event
//===== By: ================================================================================
//= Hellflaem
//===== Current Version: ===================================================================
//= 1.0
//===== Compatible With: ===================================================================
//= Eathena SVN and 3ceam
//===== Description: =======================================================================
//= It's a Facts Event based on about 52 Facts from the Facts Announcer Script by xienne15.
//= The Event is started by players, They just have to click the npc.
//= Players are asked to fill in the missing word(s) of the facts.
//= If they get it right they get an item. Player just have to say the answer outloud.
//========Credits===========================================================================
//=ToastOfDoom
//=RxChris
//==========================================================================================
mora,137,171,3	script	Facts Event	917,{
end;
function DefineQuestion; function GetQuestion; function GetAnswer;

OnMinute20:
OnMinute40:
OnMinute00:
    announce "The fact Event will begin in 3 minutes.",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
	sleep 60000;
    announce "The fact Event will begin in 2 minutes.",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
	sleep 60000;
    announce "The Fact Event will begin 1 minute.",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
	sleep 60000;
    announce "The fact Event has begun!",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
L_loop:
	do
		set .@i, rand( .numQuestions ); // Randomly picks a fact.
	while( .Q_session & 1 << .@i && .Q_session && .count < .numQuestions );
	set .Q_session, .Q_session | 1 << .@i;// max 32 questions
	if( !.count ) {
		npctalk "Sila isi dalam tempat kosong:";
		sleep 2000;
		npctalk "Jika anda rasa ia betul. Saya akan memberikan anda beberapa syiling poring!";
	}
	.count++;
	sleep 4000;
	npctalk "Fact: " + GetQuestion(.@i);
	defpattern 1, "([^:]+):.*\\s"+ GetAnswer( .@i ) +"(.*)", "Right";
	activatepset 1;
	initnpctimer;
	end;
OnTimer30000:
	npctalk "Maaf, anda mengambil masa yang amat panjang.";
	goto L_continue;
Right:
	npctalk "Itu adalah betul, sila ambil ini.";
	getitem .rewarditem, rand( 1,500 ); // Randomly picks from 1 to 5.
L_continue:
	deletepset 1;
	stopnpctimer;
	if( .count < .max_questions ) goto L_loop; // loop 10 questions
	.count = 0; // end of event
	.Q_session = 0;
	npctalk "end of event";
	end;

function DefineQuestion {
	set .@a, .numQuestions % 128;
	set .@b, .numQuestions / 128;

	setd(".question_" + .@a + "$[" + .@b + "]", getarg(0));
	setd(".answer_" + .@a + "$[" + .@b + "]", getarg(1));
	set .numQuestions, .numQuestions + 1;
	return;
}
function GetQuestion {
	return getd(".question_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]");
}
function GetAnswer {
	return getd(".answer_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]");
}
OnInit:
	set .EventON, 0;
	set .rewarditem, 7539;	//Poring Coins
	.max_questions = 10;	// 10 questions if more than 10 questions are defined
	DefineQuestion("What is your mum name ? _____ ","poring");
	DefineQuestion("What is your father name ? _____ ","poporing");
	if( .numQuestions < .max_questions ) .max_questions = .numQuestions;
	end;
}

~ I add after OnMinute

OnMinute00:
    announce "The fact Event will begin in 3 minutes.",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
	sleep 60000;
    announce "The fact Event will begin in 2 minutes.",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
	sleep 60000;
    announce "The Fact Event will begin 1 minute.",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
	sleep 60000;
    announce "The fact Event has begun!",bc_all | bc_blue;
    announce "The Event is being held in Event Room. Please use custom warper to go there.",bc_all | bc_blue;
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  98
  • Topics Per Day:  0.02
  • Content Count:  1302
  • Reputation:   77
  • Joined:  12/04/12
  • Last Seen:  

@capuche

that means, the event will start 1st or the event start and broadcast at the same time ?

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

That means at 00, 20, 40 minutes the event start.

- There is a broadcast every minute (3, 2, 1 min) then the questions are asked

- the npc ask max 10 questions but just 3 if you set just 3 questions etc..

- the npc doesn't ask the same question in the same event

- you can set 32 questions max in the setting (tell me if you want exceed this limit)

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  98
  • Topics Per Day:  0.02
  • Content Count:  1302
  • Reputation:   77
  • Joined:  12/04/12
  • Last Seen:  

@capuche

thanks a lot man !!!

how to set more than 32 fact ?

because the original is 52.

Edited by mrlongshen
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  98
  • Topics Per Day:  0.02
  • Content Count:  1302
  • Reputation:   77
  • Joined:  12/04/12
  • Last Seen:  

thanks man. i will upload this to download for release to public. really thanks bro.

/no1

Link to comment
Share on other sites

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.

×
×
  • Create New...