This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

[SOLVED]Change from weeks to years instead

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
Fire-Fox
Master
Posts: 289
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

[SOLVED]Change from weeks to years instead

Post by Fire-Fox »

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: Select all

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: Select all

rename duration egg_duration; proc duration {s} {return $s}
and AFTER your scripts put this:

Code: Select all

rename duration ""; rename egg_duration duration
Last edited by Fire-Fox on Tue May 12, 2020 6:47 am, edited 4 times in total.
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Try starting by fixing this code error line

Code: Select all

set timedate $ago ago $added\00315"
maybe more like this?

Code: Select all

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
.
User avatar
Fire-Fox
Master
Posts: 289
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

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

Scripts: Relay | Store Text | TvMaze
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

I can not recreate your strange result from that [duration] line...

Code: Select all

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 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
.
User avatar
Fire-Fox
Master
Posts: 289
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

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

Scripts: Relay | Store Text | TvMaze
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

.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. :)

Edit: Just to be clear:

Code: Select all

.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.
User avatar
Fire-Fox
Master
Posts: 289
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

I get:

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

Code: Select all

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
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

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
.
User avatar
Fire-Fox
Master
Posts: 289
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

another bot i have, shows up right:


Code: Select all

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
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

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 ;)
ComputerTech
User avatar
Fire-Fox
Master
Posts: 289
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

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

Scripts: Relay | Store Text | TvMaze
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

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 :D

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 :D
Last edited by ComputerTech on Fri May 08, 2020 12:57 pm, edited 1 time in total.
ComputerTech
User avatar
Fire-Fox
Master
Posts: 289
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

My bot is starting up fine :)
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

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

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
User avatar
Fire-Fox
Master
Posts: 289
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

First post updated!
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Post Reply