Jump to content
  • 0

OnClock not working


pojiejapan

Question


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  126
  • Reputation:   6
  • Joined:  11/18/11
  • Last Seen:  

Here is my script. It supposed only shows at friday between 12 hour only right? Its not working. It's on everyday

odin_tem03,193,300,5 script Mrs.Friday 811,{
//=========================== Settings ====================================
set .@changername$,"[ Mrs.Friday ]";// YOU MAY CHANGE THE NAME OF THE NPC
set .tcgid,20104;
set @tcgamount,1;
//======================= Settings End ====================================
//*************************************************************************
mes .@changername$;
mes "??";
mes "???";
mes "????";
next;
switch(select("Hello Mrs. Friday:Cancel"))
{
case 1:
if (countitem(20103) > 0)
{
mes .@changername$;
mes "Hello "+strcharinfo(0)+" ,";
mes "What business do you have with me?";
mes "I am very busy, there's evil need to be wipe";
mes "Mankind like you won't even stand a chance";
next;
mes "Hmm. Is that stone from Mr. Thursday?";
mes "I see you have meet all my family then.";
mes "It means you are seeking a stone to make a powerful item.";
next;
switch(select("How do you know?:Cancel"))
{
case 1:
mes .@changername$;
mes "You are seeking the corpse of Icefrog right?";
mes "To make the legendary DoTA Weapon";
mes "It's a very powerfull weapon and in the wrong hand can cause a destruction";
next;
switch(select("I will help you perish the evil:Cancel"))
{
case 1:
mes .@changername$;
mes "Then if you are worthy enough, go and find me something in return";
mes "Make me one ^FF0000 Valkyrie Helm ^000000";
mes "All my family ask for material but I'm asking for the equipment";
mes "and I need 20 ^0000FF TCG ^000000";
next;
switch(select("I have it right now:Cancel"))
{
case 1:
mes .@changername$;
mes "Okay let me check if";
mes "you have the material";
next;
mes .@changername$;
mes "Rustle... Rustle...";
if((countitem(5171) > 0) && (countitem(7227) > 19))
{
delitem 5171,1;
//delitem 7063,99;
delitem 7227,20;
//delitem 982,1;
next;
mes .@changername$;
getitem .tcgid,@tcgamount; //Change to next Item!
mes "Here take this and go at the second last level of Endless Tower";
mes "There you will the coffin of IceFrog!";
close;
}
else
{
mes .@changername$;
mes "Sorry you have to get the items first!";
close;
}
case 2:
mes .@changername$;
mes "Okay goodbye!";
close;
}
case 2:
mes .@changername$;
mes "Okay goodbye!";
close;
}
case 2:
mes .@changername$;
mes "Okay goodbye!";
close;
}
}
else
{
mes .@changername$;
mes "How rude you young man!";
mes "Try to cheat on me";
close;
}
case 2:
mes .@changername$;
mes "Okay goodbye!";
close;
}
// Enabling
OnClock0655: // 06:55 AM
if(GetTime(4) == 5) // Tuesday
EnableNPC("Mrs.Friday");
End();
// Enabling
OnClock1805: // 06:05 PM
if(GetTime(4) == 5) // Tuesday
DisableNPC("Mrs.Friday");
End();
}
[/codeBOX]

This is the On Clock part

[code]
// Enabling
OnClock0655: // 06:55 AM
if(GetTime(4) == 5) // Tuesday
EnableNPC("Mrs.Friday");
End();
// Enabling
OnClock1805: // 06:05 PM
if(GetTime(4) == 5) // Tuesday
DisableNPC("Mrs.Friday");
End();
[/code]

Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

Week day (0 for Sunday, 6 is Saturday)

So, 5 = Friday, not tuesday.

Tuesday = 2.

Edit: well just a wrong comment since you mentionned Friday in your post...

Something like this:

OnInit:
// not friday or before 06:55 or after 1805, hide the npc
if ( gettime(4) != 5 || gettime(3) * 100 + gettime(2) < 655 || gettime(3) * 100 + gettime(2) > 1805 )
	DisableNPC("Mrs.Friday");

Edited by KeyWorld
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  126
  • Reputation:   6
  • Joined:  11/18/11
  • Last Seen:  

Sir KeyWorld. So the full script will be like this?

odin_tem03,193,300,5 script Mrs.Friday 811,{
//=========================== Settings ====================================
set .@changername$,"[ Mrs.Friday ]";// YOU MAY CHANGE THE NAME OF THE NPC
set .tcgid,20104;
set @tcgamount,1;
//======================= Settings End ====================================
//*************************************************************************
mes .@changername$;
mes "??";
mes "???";
mes "????";
next;
switch(select("Hello Mrs. Friday:Cancel"))
{
case 1:
if (countitem(20103) > 0)
{
mes .@changername$;
mes "Hello "+strcharinfo(0)+" ,";
mes "What business do you have with me?";
mes "I am very busy, there's evil need to be wipe";
mes "Mankind like you won't even stand a chance";
next;
mes "Hmm. Is that stone from Mr. Thursday?";
mes "I see you have meet all my family then.";
mes "It means you are seeking a stone to make a powerful item.";
next;
switch(select("How do you know?:Cancel"))
{
case 1:
mes .@changername$;
mes "You are seeking the corpse of Icefrog right?";
mes "To make the legendary DoTA Weapon";
mes "It's a very powerfull weapon and in the wrong hand can cause a destruction";
next;
switch(select("I will help you perish the evil:Cancel"))
{
case 1:
mes .@changername$;
mes "Then if you are worthy enough, go and find me something in return";
mes "Make me one ^FF0000 Valkyrie Helm ^000000";
mes "All my family ask for material but I'm asking for the equipment";
mes "and I need 20 ^0000FF TCG ^000000";
next;
switch(select("I have it right now:Cancel"))
{
case 1:
mes .@changername$;
mes "Okay let me check if";
mes "you have the material";
next;
mes .@changername$;
mes "Rustle... Rustle...";
if((countitem(5171) > 0) && (countitem(7227) > 19))
{
delitem 5171,1;
//delitem 7063,99;
delitem 7227,20;
//delitem 982,1;
next;
mes .@changername$;
getitem .tcgid,@tcgamount; //Change to next Item!
mes "Here take this and go at the second last level of Endless Tower";
mes "There you will the coffin of IceFrog!";
close;
}
else
{
mes .@changername$;
mes "Sorry you have to get the items first!";
close;
}
case 2:
mes .@changername$;
mes "Okay goodbye!";
close;
}
case 2:
mes .@changername$;
mes "Okay goodbye!";
close;
}
case 2:
mes .@changername$;
mes "Okay goodbye!";
close;
}
}
else
{
mes .@changername$;
mes "How rude you young man!";
mes "Try to cheat on me";
close;
}
case 2:
mes .@changername$;
mes "Okay goodbye!";
close;
}

OnInit:
// not friday or before 06:55 or after 1805, hide the npc
if ( gettime(4) != 5 || gettime(3) * 100 + gettime(2) < 655 || gettime(3) * 100 + gettime(2) > 1805 )
DisableNPC("Mrs.Friday");
}
[/codeBOX]

Edited by Brian
[codebox]
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

No, don't remove the onclock.. part, just add the OnInit after and I think it will work.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  126
  • Reputation:   6
  • Joined:  11/18/11
  • Last Seen:  

Like this sir?

}
// Enabling
OnClock0655:  // 06:55 AM
if(GetTime(4) == 5) // Tuesday
 EnableNPC("Mrs.Friday");
End();
// Enabling
OnClock1805:  // 06:05 PM
if(GetTime(4) == 5) // Tuesday
 DisableNPC("Mrs.Friday");
End();
OnInit:
// not friday or before 06:55 or after 1805, hide the npc
if ( gettime(4) != 5 || gettime(3) * 100 + gettime(2) < 655 || gettime(3) * 100 + gettime(2) > 1805 )
DisableNPC("Mrs.Friday");
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

Yeah :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  126
  • Reputation:   6
  • Joined:  11/18/11
  • Last Seen:  

mr key, if i want to change the day. for example anothe NPC is only to be open in tuesday, do i need to alter your script or leave it alone?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

You have to change all gettime(4) to change the day (In OnClock.. and OnInit)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  63
  • Reputation:   6
  • Joined:  11/15/11
  • Last Seen:  

You have to change all gettime(4) to change the day (In OnClock.. and OnInit)

i think he's mean using another npc ..

-pojiejapan

If you use other day in another NPC, will not have problems :P

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...