← Back to team overview

mudlet-makers team mailing list archive

[Bug 1234540] [NEW] Raise an event when all scripts have finished loading

 

Public bug reported:

Mudlet should raise an event when all scipts have finished loading.
This'll allow scripts that need functions from other scripts already
declared to load easier.

At the moment, the original script itself can raise an event mentioning
that it is ready - but not all packages do this, as it is not automatic.

Alternatively, one can use a tempTimer with a time of 0 to get their
code to run after other scripts have loaded - but that is ugly.

Raising an event when all scripts are loaded would be similar to
Javascript, where document.ready can be used to run your stuff once all
scripts and page content has loaded.

This was based off this conversation:
(15:57:04) Ephemeral: hi, i'm having a problem where i've extended on some other people's scripts in a seperate package and for some reason if i don't deactivate and reactivate the script after starting the client up, none of the commands work and error out instead
(15:57:28) Ephemeral: is there like an event akin to document.ready in javascript where I can trigger a script to load after all other scripts have?
(16:24:19) vadi: Hello!
(16:25:30) vadi: Ephemeral: Yes, the issue you're having is indeed because other scripts have not loaded when you're trying to run yours - and you 'fix' it by re-running after others have loaded
(16:26:00) vadi: There isn't a specific event in Mudlet per-se (though that'd be a good idea, haven't thought about it that way) - typically whatever you're dependant on ought to raise an event when it has loaded, then you can hook your script on it. 
(16:26:25) vadi: If it doesn't do that, there is a trick you can do - in your script, use tempTimer(0, function() <all code here> end) - it will run after all scripts have loaded.

** Affects: mudlet
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Mudlet
Makers, which is subscribed to Mudlet.
https://bugs.launchpad.net/bugs/1234540

Title:
  Raise an event when all scripts have finished loading

Status in Mudlet the MUD client:
  New

Bug description:
  Mudlet should raise an event when all scipts have finished loading.
  This'll allow scripts that need functions from other scripts already
  declared to load easier.

  At the moment, the original script itself can raise an event
  mentioning that it is ready - but not all packages do this, as it is
  not automatic.

  Alternatively, one can use a tempTimer with a time of 0 to get their
  code to run after other scripts have loaded - but that is ugly.

  Raising an event when all scripts are loaded would be similar to
  Javascript, where document.ready can be used to run your stuff once
  all scripts and page content has loaded.

  This was based off this conversation:
  (15:57:04) Ephemeral: hi, i'm having a problem where i've extended on some other people's scripts in a seperate package and for some reason if i don't deactivate and reactivate the script after starting the client up, none of the commands work and error out instead
  (15:57:28) Ephemeral: is there like an event akin to document.ready in javascript where I can trigger a script to load after all other scripts have?
  (16:24:19) vadi: Hello!
  (16:25:30) vadi: Ephemeral: Yes, the issue you're having is indeed because other scripts have not loaded when you're trying to run yours - and you 'fix' it by re-running after others have loaded
  (16:26:00) vadi: There isn't a specific event in Mudlet per-se (though that'd be a good idea, haven't thought about it that way) - typically whatever you're dependant on ought to raise an event when it has loaded, then you can hook your script on it. 
  (16:26:25) vadi: If it doesn't do that, there is a trick you can do - in your script, use tempTimer(0, function() <all code here> end) - it will run after all scripts have loaded.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mudlet/+bug/1234540/+subscriptions


Follow ups

References