Page 1 of 1

Simple Request?

Posted: Sun May 31, 2015 4:29 am
by Flython
All I want to do is make the high score list read a little better. I'd be happy just having it say "so and so died in The Trollmire, killed by Ce'Nelaith the rattlesnake. It'd be better if it would just say that for named monsters and for regular monsters say "killed by a skeleton mage/ an army ant" but that's splitting hairs.

From what I've seen it should just be a simple edit to mod/init.lua but I just can't get it too work. Well that's not quite right, I did get it to work once by editing the tome.team file directly but doing so again stops me from picking anything when I start a new game.

I know this is a stupid complaint but If I'm going to die as often as I do I'd like my record of failure to read nicely.

Re: Simple Request?

Posted: Mon Jun 01, 2015 9:38 pm
by Crim, The Red Thunder
If you got it working once, there's no reason you shouldn't be able to get it working as an addon.

How far into making it an addon did you get before you gave up? It's entirely possible we can help you fix it up.

Re: Simple Request?

Posted: Tue Jun 02, 2015 6:32 pm
by Flython
Crim, The Red Thunder wrote:If you got it working once, there's no reason you shouldn't be able to get it working as an addon.

How far into making it an addon did you get before you gave up? It's entirely possible we can help you fix it up.
I'm not a coder in any way, shape or form but I thought I'd give this a go because it seemed so simple.

From what I could see I only needed to change two lines in the mod/init.lua file by making a folder containing a copy of the file with my changes and arranged like this tome-test/overload/mod/init.lua.

Code: Select all

score_formatters = {
	["Maj'Eyal"] = {
		alive="#LIGHT_GREEN#{score} : #BLUE#{name}#LAST# the #LIGHT_RED#level {level} {subrace} {subclass}#LAST# is still alive and well on #GREEN#{where}#LAST##WHITE#",
		dead="{score} : #BLUE#{name}#LAST# the #LIGHT_RED#level {level} {subrace} {subclass}#LAST# died on #GREEN#{where}#LAST#, killed by a #RED#{killedby}#LAST#"

to

score_formatters = {
	["Maj'Eyal"] = {
		alive="#LIGHT_GREEN#{score} : #BLUE#{name}#LAST# the #LIGHT_RED#level {level} {subrace} {subclass}#LAST# is still alive and well in the #GREEN#{where}#LAST##WHITE#",
		dead="{score} : #BLUE#{name}#LAST# the #LIGHT_RED#level {level} {subrace} {subclass}#LAST# died in the #GREEN#{where}#LAST#, killed by #RED#{killedby}#LAST#"
All I needed to do after that was borrow an init.lua file from another mod and modify it suit mine. Stuff like short_name = "Archeryfix" to short_name = "test" and so on.

I just don't see why it doesn't work, do I need use hooks or is init.lua a difficult file to change or something? At this point I'm just so frustrated that something so seemingly simple has beaten me. Thanks for replying Crim. :)

Re: Simple Request?

Posted: Wed Jun 03, 2015 1:41 am
by HousePet
I'm not sure it is safe to modify init.lua.

But we still don't have enough info to see what has gone wrong.

In what way does it not work?
Does it do nothing, or refuse to load or what?

Re: Simple Request?

Posted: Wed Jun 03, 2015 5:35 am
by Flython
It does nothing. Sorry I should have put that in the first post.

I've done a little test and I think you might be right about the init.lua file. I changed nothing about my mod except for adding a mod/class/actor.lua file with a change to give 30 skill points of level up. That change worked perfectly. :lol:

Looks like it's just ignoring my changes to the high score list.

Re: Simple Request?

Posted: Wed Jun 03, 2015 6:12 am
by HousePet
I'll have a look when I get home to see where the score_formatters table is stored.
If I can find it, I can give you some code to edit it via the load hook.

Re: Simple Request?

Posted: Wed Jun 03, 2015 10:10 am
by HousePet
Instead of the overload, try putting this code into your-mod/hooks/load.lua:

Code: Select all

class:bindHook("ToME:load", function(self, data)
      game.__mod_info.score_formatters.["Maj'Eyal"] = {
      alive="#LIGHT_GREEN#{score} : #BLUE#{name}#LAST# the #LIGHT_RED#level {level} {subrace} {subclass}#LAST# is still alive and well in the #GREEN#{where}#LAST##WHITE#",
      dead="{score} : #BLUE#{name}#LAST# the #LIGHT_RED#level {level} {subrace} {subclass}#LAST# died in the #GREEN#{where}#LAST#, killed by #RED#{killedby}#LAST#"
      }
end)

Re: Simple Request?

Posted: Fri Jun 05, 2015 9:01 pm
by Flython
HousePet wrote:Instead of the overload, try putting this code into your-mod/hooks/load.lua:

Code: Select all

class:bindHook("ToME:load", function(self, data)
      game.__mod_info.score_formatters.["Maj'Eyal"] = {
      alive="#LIGHT_GREEN#{score} : #BLUE#{name}#LAST# the #LIGHT_RED#level {level} {subrace} {subclass}#LAST# is still alive and well in the #GREEN#{where}#LAST##WHITE#",
      dead="{score} : #BLUE#{name}#LAST# the #LIGHT_RED#level {level} {subrace} {subclass}#LAST# died in the #GREEN#{where}#LAST#, killed by #RED#{killedby}#LAST#"
      }
end)
Sorry I haven't replied to this HousePet, work's been crazy the past few days. I'll give this a go and report my findings.