[MOD 0.10.x] Time Display - v1.0.0

Topics and discussion about specific mods
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by FreeER »

Here's my updated version for 11.x MP, note I haven't tested this in MP or with prior saves so... if something happens let me know (with the error message) :)

script commands updated to take the nickname (in "quotes") as the last parameter so that settings can be separate for each player.

note: double post is so that people subscribed to the topic will be notified of this post, editing my previous one wouldn't notify them.
FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by FishSandwich »

New error, both MP and SP maps. :(

Code: Select all

Error while running the event handler
__TimeDisplay__control.lua:159:attempt to index field '?' (a nil value)
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by FreeER »

FishSandwich wrote:New error, both MP and SP maps. :(
Hm, I didn't encounter that myself... I added a couple checks for what I assume happened there (that ontick got called when there was a player without any TD settings, not much else could happen there but I wouldn't have expected that since default settings are applied to during player creation and for all players during onload) and a fix for an error I noticed when I loaded a save (that didn't have the mod). download (last download link would also work since I updated Dropbox)
FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by FishSandwich »

Hmm, no error, no crash, but the clock doesn't show on MP saves. :/

Edit: Works on new games created in multiplayer.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by FreeER »

FishSandwich wrote:Hmm, no error, no crash, but the clock doesn't show on MP saves. :/
Edit: Works on new games created in multiplayer.
Right... I thought about that as soon as I made made the post and tried to change it before anyone noticed :lol: just to make sure this is line 159 of the one I first did

Code: Select all

if glob[player.name] and glob[player.name].minute_rounding and
    (event.tick % (UPDATE_INTERVAL * glob[player.name].minute_rounding) == 0) then 
then I updated dropbox to use this instead

Code: Select all

    if not glob[player.name] then
      set_defaults(playerindex)
      init_gui(playerindex)
    end
If you have the first then redownload (or do so anyways if you want) and try again, IF the 'updated' one still doesn't work then try enabling it via script the interface and let me know if that works.

Code: Select all

/c remote.call("TimeDisplay", "SetSetting", "enabled", true, "nickname")
edit: it seems like onload isn't working as desired for mp saves (ie, that the game.players list is empty during the event so the gui and settings aren't set properly)
FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by FishSandwich »

Okay so, it works fine when I use the remote.call, but after a few seconds the clock disappears again.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by FreeER »

FishSandwich wrote:Okay so, it works fine when I use the remote.call, but after a few seconds the clock disappears again.
I was afraid that might happen, onsave it's setup to remove the gui (so that if the mod is removed it doesn't leave the gui behind with no way to remove it except manual game commands), if onload isn't working then it doesn't bring it back up properly.
I made a further alteration in ontick to check for the gui actually being onscreen, if that for some reason isn't working for you then try removing the game.onsave code so that the gui isn't removed, if that doesn't work then I'm afraid I'll have to ask one of the other experts who can do proper testing to solve this. download, again :(
FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by FishSandwich »

FreeER wrote:try removing the game.onsave code so that the gui isn't removed
That worked. Thanks FreeER. :D
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by FreeER »

FishSandwich wrote:
FreeER wrote:try removing the game.onsave code so that the gui isn't removed
That worked. Thanks FreeER. :D
Glad I could help :P Sorry it took so long :lol:

For everyone who comes across this here's the download link with all of the changes made (all the previous ones I posted should work too, but people tend to jump to the end so...) including commenting out game.onsave.

to manually remove the gui (in case you forgot to disable it before removing the mod and don't want to reinstall the mod just to disable it), note this is also listed in the control.lua file (just search for 'manually remove' or 'game.onsave' and you'll find it). Also, all script interface commands are correctly commented at the end of the file as they were originally (updated to show that the nickname is also needed)
removal code
FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by FishSandwich »

Ack, my bad, premature celebrations here. ;_;

So, the clock still disappears with game.onsave commented out. I tried commenting out game.onload as well, and now it works as expected, but still need to use the remote.call
delfiler
Inserter
Inserter
Posts: 20
Joined: Tue Feb 10, 2015 1:38 pm
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by delfiler »

can i add your mod to a modpack?
kovarex
Factorio Staff
Factorio Staff
Posts: 8207
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by kovarex »

I was managing this bug report https://forums.factorio.com/forum/vie ... =29&t=8806
You could take a look at it

Just a notice, I made it clear, that you should never do the stuff you are doing in the onsave method, it can break a lot of stuff, I even added warning in the wiki.
https://forums.factorio.com/wiki/inde ... ame.onsave
User avatar
Mr. Thunder_Tw
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Mon Sep 29, 2014 2:15 pm
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by Mr. Thunder_Tw »

from kovarex
Just a notice, I made it clear, that you should never do the stuff you are doing in the onsave method, it can break a lot of stuff, I even added warning in the wiki.
I've also made a mod that does something similar though as an option that's off as default.
In case of some mod-switching after saving, when a mod has gui open, and mod turned off, there's no way to remove it...
>> onSave-gui-removing hase this fixed (that's why i found it somewhat usefull during development testing and it works in sp, mp not tested)
my Mod: ThunderGui
dragon011
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jul 03, 2014 9:19 pm
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by dragon011 »

How can I disable this time 07:41:43

Did the commands entered into the console Can you post what i copy must
Peter34
Smart Inserter
Smart Inserter
Posts: 1100
Joined: Mon Nov 10, 2014 12:44 pm
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by Peter34 »

This mod doesn't work. When I try to start Factorio, with the .zip file in my Mods folder, I get an error box popup saying something about a case-sensitive problem. When I delete the .zip file, Factorio starts up fine.
PurpleFrog
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Jul 11, 2015 8:31 pm
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by PurpleFrog »

The internal mod is expecting TimeDisplay_v1.0.0.zip as the file name. It currently downloads as TimeDisplay-v1.0.0.zip. If you change the dash to an underscore, the mod loads just fine.
FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: [MOD 0.10.x] Time Display - v1.0.0

Post by FishSandwich »

Peter34 wrote:This mod doesn't work. When I try to start Factorio, with the .zip file in my Mods folder, I get an error box popup saying something about a case-sensitive problem. When I delete the .zip file, Factorio starts up fine.
This version of the mod is the most up to date.
Post Reply

Return to “Mods”