How to change order text, eg "resurrect" = "rez"

How to change order text, eg "resurrect" = "rez"

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

How to change order text, eg "resurrect" = "rez"

Post by Caydr »

The wildly varying size of order text has gotten on my nerves since day one. Surely with LUA there's a way to override the text with something better?

I mean, "Load Units". What are you going to load, structures? "Area Attack" should be divided into two lines. Etc. Order buttons are a square, what's the point of having one 30-letter long line at 2pt?
Last edited by Caydr on 14 Aug 2009, 23:46, edited 1 time in total.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: How to change order text, eg "resurrect" = "rez"

Post by lurker »

Structures are units too. :cry:
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: How to change order text, eg "resurrect" = "rez"

Post by Forboding Angel »

Ya this is a pet peeve of mine as well, but I have no idea how to fix it so... bleh.
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: How to change order text, eg "resurrect" = "rez"

Post by Regret »

Caydr wrote:The wildly varying size of order text has gotten on my nerves since day one. Surely with LUA there's a way to override the text with something better?

I mean, "Load Units". What are you going to load, structures? "Area Attack" should be divided into two lines. Etc. Order buttons are a square, what's the point of having one 30-letter long line at 2pt?

I've previously reduced the size of text and it was awesome, but the text doesn't center automatically, how do you do that? Ya, I'm nub.
Just to point out: this is a Red UI issue afaik.

The text for the icons is defined as a caption for a rectangle object, which means that it autoresizes/fits the text to fill the rectangle as much as possible without deforming it.

Your best bet would be to draw some pretty icons for commands and I could then make some option in the widget for them to be used.
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: How to change order text, eg "resurrect" = "rez"

Post by Caydr »

Regret wrote:
Caydr wrote:The wildly varying size of order text has gotten on my nerves since day one. Surely with LUA there's a way to override the text with something better?

I mean, "Load Units". What are you going to load, structures? "Area Attack" should be divided into two lines. Etc. Order buttons are a square, what's the point of having one 30-letter long line at 2pt?

I've previously reduced the size of text and it was awesome, but the text doesn't center automatically, how do you do that? Ya, I'm nub.
Just to point out: this is a Red UI issue afaik.

The text for the icons is defined as a caption for a rectangle object, which means that it autoresizes/fits the text to fill the rectangle as much as possible without deforming it.

Your best bet would be to draw some pretty icons for commands and I could then make some option in the widget for them to be used.
Oh yeah, pictures would work perfectly, good idea.
eyu100
Posts: 182
Joined: 05 Jul 2008, 04:10

Re: How to change order text, eg "resurrect" = "rez"

Post by eyu100 »

lurker wrote:Structures are units too. :cry:
NOTA has transportable turrets.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: How to change order text, eg "resurrect" = "rez"

Post by jK »

Caydr wrote:The wildly varying size of order text has gotten on my nerves since day one. Surely with LUA there's a way to override the text with something better?

I mean, "Load Units". What are you going to load, structures? "Area Attack" should be divided into two lines. Etc. Order buttons are a square, what's the point of having one 30-letter long line at 2pt?
check layout.lua
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: How to change order text, eg "resurrect" = "rez"

Post by Caydr »

Unfortunately, no joy. I looked all through it, I don't see anything relevant.

Actually you got me thinking though, and I did a complete search of the entire Spring directory for the word "resurrect" - since it would have to be spelled in plain text SOMEWHERE to define the default - and it's nowhere to be found.

So I searched BA. XTA. CA. Nothing relevant :(

Then I searched the entire Spring source, and I found a couple of references:

Code: Select all

Find 'resurrect' in 'spring svn\rts\Game\SelectedUnits.cpp':
spring svn\rts\Game\SelectedUnits.cpp(548): 			if ( newDef->canResurrect && !oldDef->canResurrect) { return true;  }
spring svn\rts\Game\SelectedUnits.cpp(549): 			if (!newDef->canResurrect &&  oldDef->canResurrect) { return false; }
Found 'resurrect' 4 time(s).



Find 'resurrect' in 'spring svn\rts\Game\UI\CursorIcons.cpp':
spring svn\rts\Game\UI\CursorIcons.cpp(195): 		case CMD_RESURRECT:       cursorName = "Resurrect";    break;
Found 'resurrect' 2 time(s).



Find 'resurrect' in 'spring svn\rts\Game\UI\GuiHandler.cpp':
spring svn\rts\Game\UI\GuiHandler.cpp(3515): 							case CMD_RESURRECT:    { color = cmdColors.resurrect;   break; }
Found 'resurrect' 2 time(s).



Find 'resurrect' in 'spring svn\rts\Lua\LuaConstCMD.cpp':
spring svn\rts\Lua\LuaConstCMD.cpp(82): 	PUSH_CMD(RESURRECT);
Found 'resurrect' 1 time(s).
----------------------------------------
Find 'resurrect' in 'spring svn\rts\Lua\LuaConstGame.cpp':
spring svn\rts\Lua\LuaConstGame.cpp(144): 	LuaPushNamedNumber(L, "resurrectEnergyCostFactor",      modInfo.resurrectEnergyCostFactor);
Found 'resurrect' 2 time(s).
----------------------------------------
Find 'resurrect' in 'spring svn\rts\Lua\LuaFeatureDefs.cpp':
spring svn\rts\Lua\LuaFeatureDefs.cpp(486): 	ADD_INT("resurrectable", fd.resurrectable);
Found 'resurrect' 2 time(s).



Find 'resurrect' in 'spring svn\rts\Sim\Misc\ModInfo.cpp':
spring svn\rts\Sim\Misc\ModInfo.cpp(81): 	// resurrect
spring svn\rts\Sim\Misc\ModInfo.cpp(82): 	const LuaTable resurrectTbl = root.SubTable("resurrect");
spring svn\rts\Sim\Misc\ModInfo.cpp(83): 	resurrectEnergyCostFactor  = resurrectTbl.GetFloat("energyCostFactor",  0.5);
Found 'resurrect' 5 time(s).



Find 'resurrect' in 'spring svn\rts\Sim\Misc\ModInfo.h':
spring svn\rts\Sim\Misc\ModInfo.h(57): 	// Resurrect behaviour
spring svn\rts\Sim\Misc\ModInfo.h(58): 	/// How much should energy should resurrect cost, default 0.5
spring svn\rts\Sim\Misc\ModInfo.h(59): 	float resurrectEnergyCostFactor;
Found 'resurrect' 3 time(s).
----------------------------------------
Find 'resurrect' in 'spring svn\rts\Sim\Units\UnitDef.h':
spring svn\rts\Sim\Units\UnitDef.h(169): 	float resurrectSpeed;
spring svn\rts\Sim\Units\UnitDef.h(358): 	bool canResurrect;
Found 'resurrect' 2 time(s).
----------------------------------------
Find 'resurrect' in 'spring svn\rts\Sim\Units\UnitDefHandler.cpp':
spring svn\rts\Sim\Units\UnitDefHandler.cpp(398): 	ud.resurrectSpeed = udTable.GetFloat("resurrectSpeed", ud.buildSpeed);
spring svn\rts\Sim\Units\UnitDefHandler.cpp(420): 	ud.canResurrect   = udTable.GetBool("canResurrect",       false);
Found 'resurrect' 4 time(s).




Find 'resurrect' in 'spring svn\rts\Sim\Units\UnitTypes\Builder.cpp':
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(46): 				CR_MEMBER(resurrectSpeed),
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(49): 				CR_MEMBER(curResurrect),
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(50): 				CR_MEMBER(lastResurrected),
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(77): 	resurrectSpeed(100),
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(80): 	curResurrect(0),
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(81): 	lastResurrected(0),
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(106): 	if (curResurrect)  SetBuildStanceToward(curResurrect->pos);
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(124): 	resurrectSpeed = scale * def->resurrectSpeed;
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(305): 		else if(curResurrect && f3SqDist(curResurrect->pos, pos)<Square(buildDistance+curResurrect->radius) && inBuildStance){
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(306): 			const UnitDef* ud=unitDefHandler->GetUnitByName(curResurrect->createdFromUnit);
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(308): 				if ((modInfo.reclaimMethod != 1) && (curResurrect->reclaimLeft < 1)) {
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(310): 					// before we can let the player resurrect it.
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(311): 					curResurrect->AddBuildPower(repairSpeed, this);
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(314): 					// Corpse has been restored, begin resurrection
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(315): 					if (UseEnergy(ud->energyCost * resurrectSpeed / ud->buildTime * modInfo.resurrectEnergyCostFactor)) {
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(316): 						curResurrect->resurrectProgress+=resurrectSpeed/ud->buildTime;
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(317): 						CreateNanoParticle(curResurrect->midPos,curResurrect->radius*0.7f,gs->randInt()&1);
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(319): 					if(curResurrect->resurrectProgress>1){		//resurrect finished
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(320): 						curResurrect->UnBlock();
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(321): 						CUnit* u = unitLoader.LoadUnit(curResurrect->createdFromUnit, curResurrect->pos,
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(322): 													team, false, curResurrect->buildFacing, this);
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(331): 						for (CUnitSet::iterator it = cai->resurrecters.begin(); it != cai->resurrecters.end(); ++it) {
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(336): 							if (c.id != CMD_RESURRECT || c.params.size() != 1)
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(339): 							if (cmdFeatureId - uh->MaxUnits() == curResurrect->id && teamHandler->Ally(allyteam, bld->allyteam))
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(340): 								bld->lastResurrected = u->id; // all units that were rezzing shall assist the repair too
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(343): 						curResurrect->resurrectProgress=0;
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(344): 						featureHandler->DeleteFeature(curResurrect);
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(455): void CBuilder::SetResurrectTarget(CFeature* target)
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(457): 	if(curResurrect==target || target->createdFromUnit=="")
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(463): 	curResurrect=target;
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(464): 	AddDeathDependence(curResurrect);
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(523): 	if(curResurrect)
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(524): 		DeleteDeathDependence(curResurrect);
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(530): 	curResurrect=0;
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(666): 	if(o==curResurrect){
spring svn\rts\Sim\Units\UnitTypes\Builder.cpp(667): 		curResurrect=0;
Found 'resurrect' 49 time(s).



Find 'resurrect' in 'spring svn\rts\Sim\Units\UnitTypes\Builder.h':
spring svn\rts\Sim\Units\UnitTypes\Builder.h(54): 	void SetResurrectTarget(CFeature* feature);
spring svn\rts\Sim\Units\UnitTypes\Builder.h(64): 	float resurrectSpeed;
spring svn\rts\Sim\Units\UnitTypes\Builder.h(68): 	CFeature* curResurrect;
spring svn\rts\Sim\Units\UnitTypes\Builder.h(69): 	int lastResurrected;
Found 'resurrect' 4 time(s).
Dunno if that will help anyone try to find how to custom-define it. I removed references that originated in AI-related directories. I figured, "resurrect" has to be a pretty rare term compared to "move" "stop" "attack" etc, so wherever "resurrect" is defined, the others probably are as well.

I'll start going through the files later on, maybe I'll figure out how to define them on my own. Anything's possible...
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: How to change order text, eg "resurrect" = "rez"

Post by jK »

Caydr wrote:Unfortunately, no joy. I looked all through it, I don't see anything relevant.

Actually you got me thinking though, and I did a complete search of the entire Spring directory for the word "resurrect" - since it would have to be spelled in plain text SOMEWHERE to define the default - and it's nowhere to be found.

So I searched BA. XTA. CA. Nothing relevant :(
This wasn't an assumption, it was a fact. The LayoutHandler is both very mighty and hard to use. And no it doesn't need to print the word "resurrect" somewhere it just needs the CMDid/action/...
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: How to change order text, eg "resurrect" = "rez"

Post by Caydr »

I guess I'm just overthinking things. I'll try to figure it out.
Post Reply

Return to “Lua Scripts”