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 ➜ Plugins ➜ Plugin written/modified dates in PerlScript --HELP!!--

Plugin written/modified dates in PerlScript --HELP!!--

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


Posted by 1of10   Canada  (54 posts)  Bio
Date Mon 30 Sep 2002 12:11 PM (UTC)
Message
I've been building a plugin info script, similar to the ones provided by Nick, in PerlScript. It's primarily an aid to me to help get used to making plugins.

I'm having problems retrieving the written on and last modified date values. Below is a list of the formats attempted, and the whacky results returned.

$world->getPluginInfo($x,14)
Win32::OLE::Variant=SCALAR(0x1e0d20c)

${$world->getPluginInfo($x,14)}
31496000

I thought the second would be seconds, but when I put the value in localtime(), it returns Thu Dec 31 04:54:24 1970. Is this some obscure seconds since ... specific to the language the plugin engine assumes...or...? I'm completely lost here.

One of Ten
Secondary Adjunct of Unimatrix Z03
Top

Posted by 1of10   Canada  (54 posts)  Bio
Date Reply #1 on Wed 02 Oct 2002 08:51 PM (UTC)
Message
A closer inspection revealed what I thought was a decrementing number, to which I tried halfing the number before subtracting time(). This returned a timestamp a few months off of the real timestamp, but still not correct.

A little later on, with a friend poking through the code as well, it was discovered it's not really decrementing, but randomly(?) jumping back and forth.

Is the date returned for written and last modified an object/object reference? This is getting into areas I have not been yet, and I'm still confused... My friend is anxious to know what the solution is, as am I, so I can complete my plugin information plugin. It's quite detailed...

One of Ten
Secondary Adjunct of Unimatrix Z03
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 03 Oct 2002 12:10 PM (UTC)
Message
I can't really reproduce this. The following code:

$world->note ($world->GetPluginInfo ("4ea415972d64ffe602170f89", 13));

(when used with plugin "Idle_Message" which has an ID of "4ea415972d64ffe602170f89" displays this:

8/29/02 8:44:25 AM

However it might be worth commenting that if the date modified (14) is not provided you get an error because you get a null date returned.



- Nick Gammon

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

Posted by 1of10   Canada  (54 posts)  Bio
Date Reply #3 on Thu 03 Oct 2002 07:52 PM (UTC)

Amended on Thu 03 Oct 2002 08:01 PM (UTC) by 1of10

Message
I'm not quite sure how you managed to get an actual date from that. I'm using exactly the same code...

This is what I have in my script:

$world->note("Written: " . $world->getPluginInfo($item,13)); # reference
$world->note("Written: " . ${$world->getPluginInfo($item,13)}); # dereferenced value
$world->note("Written: " . localtime($world->getPluginInfo($item,13))); # as seconds since
$world->note("");
$world->note("Modified: " . ${$world->getPluginInfo($item,14)});
$world->note("Modified: " . localtime($world->getPluginInfo($item,14)));

And this is what I get:

Written: Win32::OLE::Variant=SCALAR(0x443c858)
Written: 71500508
Written: Fri Apr  7 20:17:08 1972

Modified: 71500404
Modified: Fri Apr  7 20:17:20 1972

The two times are very different in the plugin itself:

   date_written="2002-09-30 02:34"
   date_modified="2002-10-03 03:37"

And yet the returned values are never very far apart, almost like the values themselves are a pointer. Sometimes they change when executing the plugin a few seconds later, even though no change has been made to anything.

Extra Info:
------------
- $item contains the current plugin ID, retrieved in a foreach loop.
- Using ActivePerl v5.6.1 Build 633.
- Using MUclient 3.26.

Entire plugin may be downloaded from my webserver at:
http://fr.1of10.net/nx01/
The part I'm having problems with begins on line 202, with the first "written" note shown above.

One of Ten
Secondary Adjunct of Unimatrix Z03
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Thu 03 Oct 2002 11:50 PM (UTC)
Message
The problem is the concatenation of the strings. When you pass the date down to world.note the OLE conversion converts it to a string. However doing this:


$world->note ("Written: " . $world->GetPluginInfo ("636a1df5adb9fb54adb38d8b", 13));


gives ...


Written: Win32::OLE::Variant=SCALAR(0x12c2828)


One workaround is to send them as different strings, like this:


$world->tell ("Written: ");
$world->note ($world->GetPluginInfo ("636a1df5adb9fb54adb38d8b", 13));


Or, you can let MUSHclient do the conversion for you, but setting and getting a variable, eg.


# convert time to a string
$world->setvariable ("x", $world->GetPluginInfo ("636a1df5adb9fb54adb38d8b", 13));

# get it back
$x = $world->getvariable ("x");

# display it
$world->note ("Written: $x");


- Nick Gammon

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

Posted by 1of10   Canada  (54 posts)  Bio
Date Reply #5 on Fri 04 Oct 2002 06:52 AM (UTC)
Message
Thank you!

One of Ten
Secondary Adjunct of Unimatrix Z03
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.


21,242 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.