egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[SOLVED]Change from weeks to years instead

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Thu May 07, 2020 4:13 pm    Post subject: [SOLVED]Change from weeks to years instead Reply with quote

Hello,

how can i change the output of this :

at the moment it shows 455 weeks 1 day.

How can i make it to show years instead?

Code:
proc timedate{ timeis } {
   global bopen bclose
   
   set timestamp [lindex $timeis 0]
   set added [ctime $timestamp]
    set time1 [clock seconds]
    incr time1 -$timestamp
   set ago [string map {" years" "y" " weeks" "w" " days" "d" " hours" "h" " minutes" "m" " seconds" "s" " year" "y" " week" "w" " day" "d" " hour" "h" " minute" "m" " second" "s"} [duration $time1]]
   set timedate $ago ago $added\00315"
   
   return $timedate
}


UPDATE:

Thanks to thommey for this fix.
If you have multiple scripts, with '[duration]' then it will be overwritten by other scripts.

A hacky solution is:

At the bottom of your conf file, where you load your scripts at this BEFORE the 'source sctipt/xxx.tcl'

Code:
rename duration egg_duration; proc duration {s} {return $s}


and AFTER your scripts put this:

Code:
rename duration ""; rename egg_duration duration

_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze


Last edited by Fire-Fox on Tue May 12, 2020 6:47 am; edited 4 times in total
Back to top
View user's profile Send private message MSN Messenger
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Thu May 07, 2020 11:35 pm    Post subject: Reply with quote

Try starting by fixing this code error line
Code:
set timedate $ago ago $added\00315"
maybe more like this?
Code:
set timedate "$ago ago $added\00315"

_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Fri May 08, 2020 2:41 am    Post subject: Reply with quote

Thanks for the reply, but that dosnt change it Sad
it was me that made a typeo
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Fri May 08, 2020 9:34 am    Post subject: Reply with quote

I can not recreate your strange result from that [duration] line...
Code:
set ago [string map {" years" "y" " weeks" "w" " days" "d" " hours" "h" " minutes" "m" " seconds" "s" " year" "y" " week" "w" " day" "d" " hour" "h" " minute" "m" " second" "s"} [duration $time1]]


Quote:
;set time1 275271000
--> Tcl: 275271000
;set ago [string map {" years" "y" " weeks" "w" " days" "d" " hours" "h" " minutes" "m" " seconds" "s" " year" "y" " week" "w" " day" "d" " hour" "h" " minute" "m" " second" "s"} [duration $time1]]
--> Tcl: 8y, 39w, 1d, 10m


Have you overwrote the built-in eggdrop [duration] process??
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Fri May 08, 2020 10:38 am    Post subject: Reply with quote

Overwrote, my eggdrop duration. I don't think so Shocked how can i check?
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri May 08, 2020 10:46 am    Post subject: Reply with quote

Code:

.tcl duration 275271000
Tcl: 8 years 38 weeks 10 minutes

I think it's the other way around it SpiKe. I'm running eggdrop v1.8.4 and TCL is version 8.6.8. Smile

Edit: Just to be clear:
Code:

.tcl string map {" years" "y" " weeks" "w" " days" "d" " hours" "h" " minutes" "m" " seconds" "s" " year" "y" " week" "w" " day" "d" " hour" "h" " minute" "m" " second" "s"} [duration 275271000]
Tcl: 8y 38w 10m

_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Fri May 08, 2020 10:57 am    Post subject: Reply with quote

I get:

kindda strange, i have not been inside the core files.

Code:
16:56:58 .tcl string map {" years" "y" " weeks" "w" " days" "d" " hours" "h" " minutes" "m" " seconds" "s" " year" "y" " week" "w" " day" "d" " hour" "h" " minute" "m" " second" "s"} [duration 275271000]
16:56:58 Tcl: 455w 1d 0h 10m

_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Fri May 08, 2020 11:31 am    Post subject: Reply with quote

Interesting all three of us get a different result of that command:)
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Fri May 08, 2020 11:33 am    Post subject: Reply with quote

another bot i have, shows up right:



Code:
17:32:41 .tcl string map {" years" "y" " weeks" "w" " days" "d" " hours" "h" " minutes" "m" " seconds" "s" " year" "y" " week" "w" " day" "d" " hour" "h" " minute" "m" " second" "s"} [duration 275271000]
17:32:41Tcl: 8y 8m 20d 11h 4m 16s


what gives?

Will a recompile of the bot solve it. they have all the same version? only the .conf have been changed?
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Fri May 08, 2020 12:24 pm    Post subject: Reply with quote

a tip i have learned kill the bot then comment the script line run the bot then uncomment the line and restart the bot worked for me on a few scripts hope it helps Wink
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Fri May 08, 2020 12:40 pm    Post subject: Reply with quote

Did your stuff had something to do with [duration] ?
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Fri May 08, 2020 12:51 pm    Post subject: Reply with quote

hmm it was crazycats chanrelay.tcl it could have i am not sure but one thing i am sure about is the bot would for sure not start until i did what i did now they all work perfect bots and scripts i think it would fix your propblem Very Happy

but i have had seperate time scripts that also requried this
so let me put it again as clear to make it easy

Step 1 kill the bot if it's already offline good if not kill it

Step 2 comment the script line on the eggdrop config file

Step 3 start the bot

Step 4 uncomment the line of the script

Step 5 Restart bot

and it should work Very Happy
_________________
ComputerTech


Last edited by ComputerTech on Fri May 08, 2020 12:57 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Fri May 08, 2020 12:56 pm    Post subject: Reply with quote

My bot is starting up fine Smile
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Fri May 08, 2020 12:58 pm    Post subject: Reply with quote

yeah i thought so but still my trick can fix scripts that dont work properly give it a go anyway Laughing

also if it works on one bot and it doesnt on another bot most lightly the bot is at fault


EDIT

ah is the problem in the core of the eggdrop config and not a single script ?
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Fri May 08, 2020 4:59 pm    Post subject: Reply with quote

First post updated!
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber