Jump to content
  • 0

Timer Script


ToiletMaster

Question


  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  276
  • Reputation:   7
  • Joined:  08/11/12
  • Last Seen:  

Hi Guys,

 

Currently i have a  small request for a script to be made.

 

Example would be there is an npc that gives you an apple which will be refreshed every 15 minutes,

 

it will also display how long before the next apple is possible to gain. Within that 15 minutes, the npc will just be saying to wait till

 

15 minutes from where the last apple was taken.

 


 

Additional Info

-------------------

Apple was taken at 17:03 minutes, next apple can only be taken at 17:18 minutes. regardless of who the player is.

 

 

 

Hope it's enough information.

Edited by ToiletMaster
Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  318
  • Reputation:   54
  • Joined:  12/23/12
  • Last Seen:  

there is no line to display the time left to the user, try

if ($@time < gettimetick(2)) {

mes "You are able to take an apple";

close2;

set $@time, gettimetick(2) + 900; // 15 Minutes

getitem "Apple",1;

end;

}

Mes "Please wait " + (($@time - gettimetick(2)) / 60 ) + " Minutes before getting another apple";

close;

I wrote this on my phone -> Bad format ?

Edited by Metamorphic
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   5
  • Joined:  12/12/11
  • Last Seen:  


if (time>gettimetick(2)) { mes "You take your apple"; close; }

set time, gettimetick ( 2 ) + 900;

getitem apple,1;

 

Edited by kadze
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  276
  • Reputation:   7
  • Joined:  08/11/12
  • Last Seen:  

if (time>gettimetick(2)) { mes "You take your apple"; close; }
set time, gettimetick ( 2 ) + 900;
getitem apple,1;
 

Doesn't work, it only displays you take your apple that's all. doesn't go anything further than that.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   5
  • Joined:  12/12/11
  • Last Seen:  

it does not display the timer, but gives an apple every 15 minutes

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  56
  • Reputation:   9
  • Joined:  09/22/12
  • Last Seen:  

close2; instead of close;

Remember, close; teminates the script execution, means everything below close; wont happen.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  276
  • Reputation:   7
  • Joined:  08/11/12
  • Last Seen:  

Not sure is it me but i've tried close2 yet it doesn't seem to work the way i wanted to, it doesn't give any apples at all :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   5
  • Joined:  12/12/11
  • Last Seen:  

close2; instead of close;

Remember, close; teminates the script execution, means everything below close; wont happen.

close2? why? he gets an apple every 15 minutes, why make another one?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  56
  • Reputation:   9
  • Joined:  09/22/12
  • Last Seen:  

close2? why? he gets an apple every 15 minutes, why make another one?

 

 

*close;

This command will create a 'close' button in the message window for the invoking 
character. If no window is currently on screen, the script execution will end. This is one 
of the ways to end a speech from an NPC. Once the button is clicked, the NPC 
script execution will end, and the message box will disappear.

    mes "[Woman]";
    mes "I am finished talking to you. Click the close button.";
    close;
    mes "This command will not run at all, since the script has ended.";

---------------------------------------

*close2;

This command will create a 'close' button in the message window for the invoking 
character. WARNING: If no window is currently on screen, the script execution will halt 
indefinitely! See 'close'. There is one important difference, though - even though 
the message box will have closed, the script execution will not stop, and commands after 
'close2' will still run, meaning an 'end' has to be used to stop the script, unless you 
make it stop in some other manner.

    mes "[Woman]";
    mes "I will warp you now.";
    close2;
    warp "place",50,50;
    end;
    
Don't expect things to run smoothly if you don't make your scripts 'end'.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  318
  • Reputation:   54
  • Joined:  12/23/12
  • Last Seen:  

Reason to use Close2;

 

We want to allow the user to use the close button while the script still runs..

Using Close2; in the script before mine would have not worked, Only in the way I have done it.

Edited by Metamorphic
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  276
  • Reputation:   7
  • Joined:  08/11/12
  • Last Seen:  

there is no line to display the time left to the user, try

if ($@time < gettimetick(2)) {

mes "You are able to take an apple";

close2;

set $@time, gettimetick(2) + 900; // 15 Minutes

getitem "Apple",1;

end;

}

Mes "Please wait " + (($@time - gettimetick(2)) / 60 ) + " Minutes before getting another apple";

close;

I wrote this on my phone -> Bad format ?

Aside from the missing brackets,

 

This works great! exactly what i required! Thanks alot! Works flawlessly!

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