Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Perlscript ➜ Timerproblem

Timerproblem

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Simon   Sweden  (39 posts)  Bio
Date Mon 28 Jun 2004 08:20 PM (UTC)
Message
I try this in my script:
$world->note($world->addtimer("commandtimer", 0, 1, 30, "", 1+4+1024+16384, "timetrig1"));

And I get 30009, script name is not in script file. This kinda boggles me since I don't think addtimer is supposed to be able to return that. Plus I don't know what it means :P

Any suggestions?

Best regards,
Simon

- "Where do you live, Simon?"
- "I live in the sick and wounded, doc."
Session 9
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #1 on Mon 28 Jun 2004 08:34 PM (UTC)
Message
eScriptNameNotLocated: The script name cannot be located in the script file
Is at the bottom of return on this page:
http://www.gammon.com.au/scripts/function.php?name=AddTimer



Your problem is the script name that your timer is supposed to call, doesnt exist. Make a routine in your script file and you should be fine.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Simon   Sweden  (39 posts)  Bio
Date Reply #2 on Mon 28 Jun 2004 09:28 PM (UTC)
Message
Ah thanks. But I do have that routine. It's just above the routine where I make the timer.

- "Where do you live, Simon?"
- "I live in the sick and wounded, doc."
Session 9
Top

Posted by Simon   Sweden  (39 posts)  Bio
Date Reply #3 on Mon 28 Jun 2004 09:31 PM (UTC)
Message
This is the routines:



sub commandhook
{
if($world->istimer("commandtimer"))
{
$world->deletetimer("commandtimer");
}
$world->note($world->addtimer("commandtimer", 0, 1, 30, "", 1+4+1024+16384, "timetrig1"));
}

sub timetrig1
{
$world->setvariable("commands", 0);
$world->addtimer("commandtimer", 0, 3, 20, "", 1+4+1024+16384, "timetrig2");
}

sub timetrig2
{
$world->sound("bork.wav");
}


- "Where do you live, Simon?"
- "I live in the sick and wounded, doc."
Session 9
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 29 Jun 2004 04:11 AM (UTC)
Message
I pasted that snippet you gave there into a script file, enabled Perl scripting and then typed (into the command window):

/commandhook

It showed 0 (success) on the output window, and the timer was added.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Simon   Sweden  (39 posts)  Bio
Date Reply #5 on Tue 29 Jun 2004 05:22 AM (UTC)
Message
Funny enough, it does that for me also. But I'm calling this function from my plugin:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Monday, June 28, 2004, 8:59 PM -->
<!-- MuClient version 3.50 -->

<!-- Plugin "Commandcall" generated by Plugin Wizard -->

<muclient>
<plugin
name="Commandcall"
author="Simon Lundmark"
id="09b6d58de9fc047136bcac86"
language="PerlScript"
purpose="Calls commandhook() in your script (using prefix /) when the user types a command."
save_state="y"
date_written="2004-06-28 20:58:24"
requires="3.50"
version="1.0"
>

</plugin>


<!-- Get our standard constants -->

<include name="constants.pl"/>

<!-- Script -->


<script>
<![CDATA[
## On received a command ##
sub OnPluginSend
{
$world->execute("/commandhook();");
return 1;
}
#################################################
]]>
</script>


</muclient>


And that's when it starts to bug out.

- "Where do you live, Simon?"
- "I live in the sick and wounded, doc."
Session 9
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Tue 29 Jun 2004 05:39 AM (UTC)

Amended on Tue 29 Jun 2004 05:40 AM (UTC) by Nick Gammon

Message
Hmm - I gather you are trying to communicate from the plugin to the global script?

It seems that the current plugin script space is still active when you do a world.Execute, *however* there is a workaround.


  1. Change your plugin to read:

    $world->execute("some_word_you_wont_use_normally");

    instead of:

    $world->execute("/commandhook();");

  2. Make an alias in the *global* script (not the plugin) to catch that word, and execute commandhook, like this:

    
    <aliases>
      <alias
       match="some_word_you_wont_use_normally"
       enabled="y"
       send_to="12"
       sequence="100"
      >
      <send>commandhook</send>
      </alias>
    </aliases>
    



What this will do is switch to the global script space to process the alias, and then "commandhook" will be executed in global script space. I assume this is what it is all about.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Simon   Sweden  (39 posts)  Bio
Date Reply #7 on Tue 29 Jun 2004 02:51 PM (UTC)
Message
That got it kicking! Many many thanks.

- "Where do you live, Simon?"
- "I live in the sick and wounded, doc."
Session 9
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


30,183 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.