[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Level Timer - with seconds

Level Timer - with seconds

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


Posted by Nikkei   Singapore  (8 posts)  [Biography] bio
Date Sun 18 Jun 2006 11:17 AM (UTC)
Message
Hi, may I get help with a timer that gives minutes and seconds for each level?

level message:
Congratulations hero. You have increased your powers!

Output Message:
grouptell Leveltime: 90seconds, 1.500 minutes

Can anyone help me think of a simple script?

Also when i loaded the lvltimer plugin from mush, an alert msg came out, "unable to create the plugin save state file blablabla-state.xml"
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 18 Jun 2006 09:30 PM (UTC)
Message
The level timer plugin (Level_Timer.xml) should do it if you amend the trigger. If it can't save its state maybe there is no "state" directory.

Depending on where you installed MUSHclient, state files should be saved somewhere like:


C:\Program Files\MUSHclient\plugins\state


Make sure you have such a directory under your MUSHclient install directory.

It needs the state file to save to disk when you previously levelled, in case it isn't in the same session.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #2 on Tue 20 Jun 2006 12:04 AM (UTC)
Message
Hmm. Bit of a question on a similar issue.. When I installed XP, I just copied everything straight over from the old install. If I "manually" save the world file I get the same error on "every" installed plugin. However, when Mushclient saves states on its own (some do in fact show changes as of 06/19/2006, so I know they are saving), they are updated correctly. Any idea why this might be happening Nick? It isn't a huge problem, since it is saving the states normally, but its sort of odd if I need to change something in the world file and save it, only to get a whole list of, "unable to create the plugin save state file blablabla-state.xml", errors for every installed plugin. This is using version 3.74.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Tue 20 Jun 2006 02:44 AM (UTC)

Amended on Tue 20 Jun 2006 02:54 AM (UTC) by Nick Gammon

Message
Quote:

... but its sort of odd if I need to change something in the world file and save it, only to get a whole list of, "unable to create the plugin save state file blablabla-state.xml", errors for every installed plugin ...


OK, let's work this one through. First the error message should have given a full pathname. Does that path actually exist? Something like:


C:\mushclient\plugins\state\03c761d33c14fbd2d442f040-fba8f08ebbdd03bcae94ab05-state.xml


In this example, confirm the directory 'C:\mushclient\plugins\state\' exists.

When MUSHclient saves a state file it creates the pathname like this:


  • Plugins directory - print (GetInfo (60)) - to see what this is. If this string is empty - failure.

  • Append: 'state\'

  • Append: world ID - print (GetWorldID()) - to see what this is. If this string is empty - failure.

  • Append a hyphen.

  • Append the plugin ID (see inside plugin for what this is).

  • Append: '-state.xml'


It then attempts to create and open this file for writing, writes the plugin variables to it, and closes it. If it cannot open the file (or create it) you will get that error message:


Unable to create the plugin save state file: (file name as above)


Quote:

If I "manually" save the world file I get the same error on "every" installed plugin.


This is a bit of a puzzle, except that maybe somehow the plugins directory is changing midstream if you manually save the world. I would check what it is from GetInfo (60) and see if a different value ends up in there after a manual save compared to an automatic save.


Maybe check under Global Preferences -> Plugins, to see what value is there for the Plugins directory.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #4 on Tue 20 Jun 2006 04:33 AM (UTC)

Amended on Tue 20 Jun 2006 04:35 AM (UTC) by Shadowfyr

Message
Ok, as one example>

"Unable to create the plugin save state file:
.\worlds\plugins\state\b4231b380ebf45f5c61edce-b5a12674355d40240455d8a1-state.xml"

The global plugins directory is: .\worlds\plugins

A directory list shows:
06/19/2006  09:08 PM               541 b42313b380ebf45f5c61edce-9365fba7c9ec60a3b12eb729-state.xml
06/19/2006  09:08 PM             1,581 b42313b380ebf45f5c61edce-b5a12674355d40240455d8a1-state.xml
06/19/2006  09:08 PM               487 b42313b380ebf45f5c61edce-b8b341965ebdc25f541daecf-state.xml
06/19/2006  09:08 PM               948 b42313b380ebf45f5c61edce-d1e9332dc13f7b13e8e4eeb5-state.xml
06/19/2006  09:08 PM             1,157 b42313b380ebf45f5c61edce-fba8f08ebbdd03bcae94ab05-state.xml

All five are failing when doing a manual save, yet they are obviously there and all up to date as of when I logged off. I even tried to reinstall the latest version over the one I simply copied into place and it didn't fix it. Its almost as though somehow the files are access locked when you try to do a manual save, but are unlocked during normal operation, or XP is getting confused and thinking they are "exclusive" to the client and that the manual save isn't the same application somehow. This is all quite strange...

Oh, its XP Pro sp2 and in admin mode, since I haven't quite got everything tweaked to where I am comfortable running a limited account, so it can't be an access level violation, as far as I understand how that "should" work.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Tue 20 Jun 2006 05:01 AM (UTC)
Message
I'm a bit worried about where ".\worlds" location is. It might depend on where the current directory is. I would go into global configuration and put a specific path there.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nikkei   Singapore  (8 posts)  [Biography] bio
Date Reply #6 on Tue 20 Jun 2006 01:11 PM (UTC)
Message
Unhidden my mushclient folder, and set the ./world for plugin as exact path. Yay no more error msg.

For the timer however, how do I amend that plugin to work for my case? Currently it shows days and minutes.

I need it to send to world only seconds, and the equivelant minutes.

Example: If i level in 90 seconds, it will show:

grouptell Level in 90 seconds, 1.500 minutes

Not sure how to code, anyone can advice how to amend the plugin? Or do I even need a script to handle this? Prolly afew triggers will do?

Thanks alot :)
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #7 on Tue 20 Jun 2006 06:22 PM (UTC)
Message
Now that is damn strange.. lol I think you have a "little" code problem in the global settings. Yes, apparently .\worlds "is" some current directory in the manual save, instead of appending the mushclient path in there it just sticks the current one in it. More interestingly, the only way to fix it is to adjust "both" paths in Global Preferences, which doesn't mean just clicking the button, seeing that its is pointing at the right place, then scratching your head in complete confusion. I had to select a different directory first, then select the correct one for the dialog to actually change it.

I think this qualifies as a minor bug Nick, one that probably didn't appear on my other system because I normally have a habit of setting the "execution path", or what ever its called, in the shortcuts to the executable directory. Never understood why the hell windows doesn't do that automatically myself. :p But, your getting inconcistent behaviour here, where the auto-save knows what it is doing, but the global system doesn't have a clue that the "." should refer to the mushclient directory path. It would probably be safe to fix that by automatically checking for that and substituting the correct path, instead of relying on Windows to know where its "supposed" to be doing things, which in this case is probably the bloody desktop, or where ever the heck it places quicklaunch shortcuts.
[Go to top] top

Posted by NeoFryBoy   USA  (42 posts)  [Biography] bio
Date Reply #8 on Sun 25 Jun 2006 05:11 AM (UTC)
Message
I just wanted to mention, I've been taking Atreidess' zMud scripts and switching them to MUSH scripts, but I've goto finish debugging the pot script before I set to work on the leveling script.
[Go to top] top

Posted by Nikkei   Singapore  (8 posts)  [Biography] bio
Date Reply #9 on Sun 25 Jun 2006 05:40 AM (UTC)
Message
Thanks for the help all! managed to alter the lvl timer plugin enuff for what I need :)
Here are the outlines:

Trigger 1:
Match: You gain * trains.
Send:

world.SetVariable "puptrain", "%1"

Trigger 2:
Match: Lucky! You gain an extra * training session*
Send:

world.SetVariable "bonustrain", "%1"

dim oldtime
dim newtime
dim minutes, duration, seconds

oldtime = GetVariable ("last_level_time")

'
if IsEmpty (oldtime) or not IsDate (oldtime) then
SetVariable "last_level_time", now
Note "Level time noted."
end if

'
duration = DateDiff ("s", CDate (oldtime), Now)
minutes = (fix(duration / 60))
seconds = duration-minutes*60
'
world.send "gt Level Time: " & minutes & "m " & seconds & "s + " & (cint(world.getvariable("puptrain")) + cint(world.getvariable("bonustrain"))) & " Trains"

SetVariable "last_level_time", now
[Go to top] 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.


26,409 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]