YolkfolkThe Dizzy Fansite 0 logged in0 playing
Community discussion

ObjSetName forces capitals?

Started by Queex on 7 December 2010 • 4,914 views

9 posts
#54848
Does ObjSetName() force the name input into upper case?

Because despite setting the name in lower case, by the time it's pulled out in the inventory dialog it's back in capital letters.

Is there any way to put this right without some tedious strexplode strsub strlow strimplode manipulation in DialogInventory()?
👍 0
#72240
hmmmmm as far as I can tell, it must either store the name (using ObjSetName) as all uppercase, or retrieve it (using ObjGetName) as uppercase.

of course it could be that it simply can't tell the difference, and whether you use Z or z it will find the same square on the font tile. *shrugs*

as for an easier workaround..... hmmmm one or two ideas spring to mind (such as writing your own equivalent of the ObjSetName/ObjGetName code and using that instead), but nothing obviously easy I'm afraid.
👍 0
#72241

OK, how about this:

in function DialogInventory in menus.gs, replace this line:

text += ObjGetName(idx);

with this line:

text += FindObjName(idx);

then write a new function, as so:

func FindObjName(idx)
{
	if(ObjGet(idx,O_ID)==1000) return "A Bucket";
	if(ObjGet(idx,O_ID)==1001) return "A Large Sponge";
	if(ObjGet(idx,O_ID)==1002) return "A Heavy Filing Cabinet";
	// etc etc...

	return "";
}

with the above code, you'd have no further use for the ObjSetName() function (I think...)

I can't help feeling however, that this solution is too simple, and that I may have missed something...

👍 0
#72242
Right, I've just modified the above code, which now works (and returns lower case text too). :smile:

That was easier than I thought!
👍 0
#72243
of course, there are a few limitations to that code.

- you can't rename an item in the normal way. (you'd have to set up some kind of 'if' statement for the item in question)
- ermmm...
- ummm.

I may think of more in time, but atm that's the only one I can think of
👍 0
#72244
I've ended up doing something similar, as the only alternative would seem to be waiting for a fix in the engine, which will not be swift in coming. I just wanted to make sure I wasn't missing something somewhere. Cheers!
👍 0
#72246
I've noticed a similar feature with room names.
👍 0
#72384
Yes, both the objects and the rooms have upper case names. This happens internally in the "set" functions. Don't know why I did so. If you people want, I can change it to store the names the way they are given.

An alternative hack would be to store the names with a special symbol before the upper chars, like "*THE *STONE", and when retrieved for display the name would be converted into "The Stone" with a scripted function. But I don't recommend such hacks.

Just let me know, and I'll update the engine if you wish.
👍 0
#72497
It sounds like a simple update to make, so it would be cool- although probably in a way that preserves the old behaviour to avoid too many annoying conversion issues when updating old games to a newer engine.

If the set functions set the names verbatim, perhaps add a G_ variable to indicate whether item and room names should be fully capitalised when returned by the get functions. That way, the new template can set the variable early on, but older games will leave it unset and preserve the old behaviour.

For the editor, I guess it doesn't really matter if the capitalisation is a little off when converting.
👍 0