Delay?

Posted by Dele on Fri 13 Oct 2006 12:08 AM — 11 posts, 35,919 views.

#0
I was wondering what the command for a delay in a script is... Basically i need it to delay for a few seconds before the command and am not sure how to do this...

You feel a fish nibbling on your hook.

Delay 2.7 seconds

Tease line


You feel a fish make a small strike at your bait.

Delay 2.5 seconds

Jerk Pole



Can anyone help me figure this out?
Australia Forum Administrator #1
Use DoAfter. Here is an example with Lua as the scripting language, make sure you enable scripting.


<triggers>
  <trigger
   custom_colour="4"
   enabled="y"
   match="You feel a fish nibbling on your hook."
   send_to="12"
   sequence="100"
  >
  <send>DoAfter (2.7, "Tease line")</send>
  </trigger>
</triggers>

#2
<triggers>
<trigger
custom_colour="4"
enabled="y"
match="You feel a fish nibbling on your hook."
send_to="12"
sequence="100"
>
<send>DoAfter (2.7, "Tease line")</send>
</trigger>
</triggers>

So I understand the do after part but whats the Enabled and send _TO stuff for? Sorry am really new at this kind of stuff. i tried to read the introduction to scripting but its very confusing

Edit: Also do i save the trigger as a .lua and load it as a script?

Edit edit: ok so i saved it as a .lua and i importeted it but am not sure how to enable scripting all take a look around the forums though maybe all find it

Okay I found it but the problem is i imported the script so when i go to scripts and then try and load it it says there is an error in the >

Amended on Fri 13 Oct 2006 12:51 AM by Dele
Australia Forum Administrator #3
Read this, you just paste it into the trigger list:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4777
#4
Send-to-script cannot execute because scripting is not enabled.

How do i enable this? I am still unsure
USA #5
World options->Scripting, and there should be a check box.
#6
When i clip the check box and then ok i get this

Untrusted world Achaea, ID: 7d4718a967a99bbdb1ab63d1
Lua sandbox created, some functions disabled.
Loading of DLLs in scripts is disabled.
Australia Forum Administrator #7
It is a warning, you can ignore it. Your triggers should work now.

However what it is telling you is that the Lua "script sandbox" has disabled some things that potentially can be used to cause problems for you. Probably not by yourself directly, but if you installed a plugin that did things like delete files. There have been no reported cases of such things but we are being cautious.

You can do one of three things to make the warning message go away. Go to the File menu -> Global Preferences -> Lua tab, and:

  1. Suppress the warnings

    Change the line (right near the top):


    warn_if_not_trusted = true -- change to false to suppress warnings


    to:


    warn_if_not_trusted = false -- no warning messages


    That suppresses the warnings themselves.
  2. Trust all worlds

    Change the line (right near the top):


    trust_all_worlds = false -- change to true to trust all the worlds


    to:


    trust_all_worlds = true -- trusting scripts in all worlds


    This lets "dangerous" scripts be executed directly by world files (eg. triggers) but not plugins. There is a potential issue if you do this that a script that you or someone else writes (using "send to script") may cause a problem.
  3. Trust this particular world

    You know your world "ID" (identifier) which in your case is "7d4718a967a99bbdb1ab63d1". That was in the warning message.

    A little further down in the edit box on the Lua tab is a list of trusted worlds. Click the Edit button to see it more clearly. It looks like this:

    
      local trusted_worlds = {
     --    ["a4a1cc1801787ba88cd84f3a"] = true,  -- example world A
     --    ["cdc8552d1b251e449b874b9a"] = true,  -- example world B
     --    ["1ec5aac3265e472b97f0c103"] = true,  -- example world C
          }  -- end of trusted_worlds 
    


    You can change that to trust this particular world, by add a line similar to the ones shown, with your world ID in it:

    
      local trusted_worlds = {
           ["7d4718a967a99bbdb1ab63d1"] = true,  -- Achaea
     --    ["a4a1cc1801787ba88cd84f3a"] = true,  -- example world A
     --    ["cdc8552d1b251e449b874b9a"] = true,  -- example world B
     --    ["1ec5aac3265e472b97f0c103"] = true,  -- example world C
          }  -- end of trusted_worlds 
    

Amended on Fri 13 Oct 2006 08:58 PM by Nick Gammon
#8
I get this error when i load the script

Error number: 0

Event: Compile error

[string "Script file"]:2: unexpected symbol near '<'

Called by: Immediate execution
Amended on Fri 13 Oct 2006 09:30 PM by Dele
Australia Forum Administrator #9
The trigger I suggested does not use a script file. Please follow the method in this post for copying and pasting the trigger into your world file:

http://www.gammon.com.au/forum/?id=4777
#10
Alrght i got this to work! Now onto the next problemm

I am not sure what this is called but i have heard people refer to it as Gaging Text

basically i see

You have recovered balance on all limbs.

I want to see something like

|GO TIME! GO GO GO!!| < in RED And the size of two lines

Is this possible in mush?