| View previous topic :: View next topic |
| Author |
Message |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Thu May 07, 2020 4:13 pm Post subject: [SOLVED]Change from weeks to years instead |
|
|
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 |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Thu May 07, 2020 11:35 pm Post subject: |
|
|
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 |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Fri May 08, 2020 2:41 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Fri May 08, 2020 9:34 am Post subject: |
|
|
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 |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Fri May 08, 2020 10:38 am Post subject: |
|
|
Overwrote, my eggdrop duration. I don't think so how can i check? _________________ GreatZ
Fire-Fox | Denmark
Scripts: Relay | Store Text | TvMaze |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri May 08, 2020 10:46 am Post subject: |
|
|
| 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.
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 |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Fri May 08, 2020 10:57 am Post subject: |
|
|
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 |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Fri May 08, 2020 11:31 am Post subject: |
|
|
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 |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Fri May 08, 2020 11:33 am Post subject: |
|
|
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 |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Fri May 08, 2020 12:24 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Fri May 08, 2020 12:40 pm Post subject: |
|
|
Did your stuff had something to do with [duration] ? _________________ GreatZ
Fire-Fox | Denmark
Scripts: Relay | Store Text | TvMaze |
|
| Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Fri May 08, 2020 12:51 pm Post subject: |
|
|
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
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  _________________ ComputerTech
Last edited by ComputerTech on Fri May 08, 2020 12:57 pm; edited 1 time in total |
|
| Back to top |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Fri May 08, 2020 12:56 pm Post subject: |
|
|
My bot is starting up fine  _________________ GreatZ
Fire-Fox | Denmark
Scripts: Relay | Store Text | TvMaze |
|
| Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Fri May 08, 2020 12:58 pm Post subject: |
|
|
yeah i thought so but still my trick can fix scripts that dont work properly give it a go anyway
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 |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Fri May 08, 2020 4:59 pm Post subject: |
|
|
First post updated! _________________ GreatZ
Fire-Fox | Denmark
Scripts: Relay | Store Text | TvMaze |
|
| Back to top |
|
 |
|