Jump to content

Question

Posted (edited)

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

10 answers to this question

Recommended Posts

Posted (edited)

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
Posted (edited)


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

set time, gettimetick ( 2 ) + 900;

getitem apple,1;

 

Edited by kadze
Posted
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.

Posted

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?

Posted

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'.
Posted (edited)

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
Posted

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!

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