Char type and Usecode scripts problems

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
Sleepy Emp
Posts: 20
Joined: Thu May 14, 2020 1:34 pm

Char type and Usecode scripts problems

Post by Sleepy Emp »

Greetings, comrades!

We are a team of translators currently working on bringing the magic of Ultima 7 to Mother Russia. And we are in a desperate need of help. Basically, the translation is finished. Only two major problems remain. We've tried getting some advice on the IRC channel, but due to the lack of time we've failed. So, here we are, trying to seek the counsel of the Exult and Usecode gurus once more.

1. After the Avatar 'meets' another character, he can click on that character and his/her name is displayed. Currently, the function responsible for this feature does not display font frames above #127, being limited by the 'signed' data type. We need this limit raised up to frame #255 (changing char type to unsigned should solve this). We've submitted this issue as a bug, but still no answer.

2. Due to the complexity of the Russian language we need to reprogram the functions responsible for the trainers' texts, introducing new "trainee's gender" checks into the scipts. We've decompiled the needed usecode functions into scripts (UCXT format) using the utilities the Exult team kindly provided. But we've stumbled upon a frustrating problem - those functions do not compile back.

For example, the command

ucc.exe 0875.ucxt

results in a crash with a series of errors:

0875.ucxt:41: 'UcMessage' not declared
0875.ucxt:42: 'UcSay' not declared
0875.ucxt:42: parse error

We've consulted Marzo's excellent ES Guides and these forums, but haven't been able to find the solution for the problem.

We hope for help,
Thanks in advance!
U7Rus team - http://catslair.ucoz.ru
wjp
Site Admin
Posts: 1708
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by wjp »

The reason I'm hesitant about fixing the first problem in actorio.cc is the following:

http://exult.cvs.sourceforge.net/exult/ ... og#rev1.39

This commit from August 2000 adds a check to loading NPC names that explicitly stops reading at characters below 32 and above 126. The log message is:

"This one will fix the invalid characters problem. It is now not allowed to have a name with characters out of the range of c = 127. So only normal ascii characters, no extended ones."

This makes me wonder if there are some U7 versions which have invalid characters trailing the NPC names instead of a 0 terminator.
artaxerxes
Site Admin
Posts: 1310
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by artaxerxes »

I can tell from experience that Si-French allows text with char > 128. As for the names, AFAICT, accentuated letters worked fine too. For instance, single-clicking on Dupre would give Dupré in Si-French

Artaxerxes
Sleepy Emp
Posts: 20
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by Sleepy Emp »

wjp: I'm not too good at all that technical stuff, but I wonder, what harm would it cause to allow higher-ASCII characters to be displayed on screen? As far as I know, there were only two versions of the original U7 game: 3.0 and 3.4. Maybe 3.0 had some problems with the extended characters, but I'm pretty sure 99,9% of Ultima fans are using the patched version of the game. And if that's not true, the patch is readily available now.

Artaxerxes: The reason behind Dupré's name being properly displayed is that it, like any other Companion's name, is taken from text.flx, not initgame.dat or npc.dat like any other name in the game. Try adding a higher-ASCII character to Finnigan's name, for example.
wjp
Site Admin
Posts: 1708
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by wjp »

> As far as I know, there were only two versions of the original U7 game

And quite a few non-English versions.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by marzo »

We've decompiled the needed usecode functions into scripts (UCXT format) using the utilities the Exult team kindly provided. But we've stumbled upon a frustrating problem - those functions do not compile back.
The main reason being that UCXT output is not exactly UCC friendly (the converse also being true); for example:
0875.ucxt:41: 'UcMessage' not declared
0875.ucxt:42: 'UcSay' not declared
If you switch 'UcMessage' to 'message' and 'UcSay' to 'say' in 0875.ucxt, these errors should go away; but there will likely be others.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
SB-X
Posts: 980
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by SB-X »

On the other hand, WUD and WUC are completely compatible - if you don't mind writing usecode assembly.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by marzo »

"This one will fix the invalid characters problem. It is now not allowed to have a name with characters out of the range of c = 127. So only normal ascii characters, no extended ones."

This makes me wonder if there are some U7 versions which have invalid characters trailing the NPC names instead of a 0 terminator.
Yeah. At least for the Ultima Collection versions, though, there are no extended ASCII chars and the c < ' ' condition is enough. I have an older version of U7 which I'll have to dig up to test it; this will not mean anything about non-english versions, though.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
wjp
Site Admin
Posts: 1708
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by wjp »

The "c < ' '" condition is the one that catches the extended characters because namebuf is a signed char array. (So chars above 127 are negative.)
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by marzo »

because namebuf is a signed char array.
Hadn't noticed that. Still, after correcting for it, extended chars do not seem to be an issue in the Ultima Collection version. I also dug up the older version of BG (pre-FoV, don't know the exact version) and it works with it too. But once again, this doesn't give any info on non-english versions...
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by Wizardry Dragon »

On the second point, I'm not entirely sure, but isFemale should work in theory, although you'd have to go through the game and ensure the female flage is set on the appropriate NPCs.
---------
Peter M Dodge aka Wizardry Dragon
Lead Designer,
Ultima VII: The Feudal Lands
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by drcode »

I can't recall: Is there any information in the data files as to what language is being used? We could make the character test conditional.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by marzo »

On the second point, I'm not entirely sure, but isFemale should work in theory
My guess is that you are thinking about the 'is_pc_female' intrinsic; in which case, it doesn't work for anyone but the avatar.

Their best bet would be to create a function which contains a list of (say) the female NPCs and returns true if a given NPC is in the list. Something along the lines of

Code: Select all

var IsFemale (var npc)
{
    var female_npcs = [ /* list of female NPC [i]numbers goes[/i] here */ ];
    if (npc->get_npc_number() in female_npcs)
        return true;
    else
        return false;
}
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by Wizardry Dragon »

That was the intrinsic I meant, yes, sorry about that, it was just off the top of my head as opposed to from UCC or anything.

I was under the impression you could set the female flags for other NPCs in SI at least, if not in BG, and I thought the game just returned the value of the flag.

I might be wrong though. Wouldn't be the first time :P
--------
Peter M Dodge aka Wizardry Dragon
Lead Designer,
Ultima VII: The Feudal Lands
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Sleepy Emp
Posts: 20
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by Sleepy Emp »

Concerning the first problem:

wjp: Taking into account the fact that the c = 127 range so that we could use it? Should there be reports of it causing problems (which I doubt), you could bring that restriction back.

Or, DrCode's suggestion would be a perfect solution if that's not too hard to implement.



Concerning the second problem:

Marzo: I've tried to compile the trainers' functions following your suggestion. The same or almost the same problems appeared in every function. The compiler also complained about the lack of brackets in the Say command. After I changed all "say;" to "say();" the compiler mumbled:

UI_count_objects_28 not declared
UI_remove_party_items_2B not declared.

I wanted to kill myself, but decided to ask for help again. Is there some kind of a guide to adapting the UCXT script to UCC standards?
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by drcode »

Okay, I made the change tonight so we should allow c >= 127 in NPC names. If we get reports of problems, then I'll make a configuration option. Or, maybe we could check the font to see if there are any characters above 127, since there aren't in my English version.
Sleepy Emp
Posts: 20
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by Sleepy Emp »

Thank you! ^_^
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by marzo »

UI_count_objects_28 not declared
UI_remove_party_items_2B not declared.
Ah, yes; I had forgotten that kind of thing (it has been a while since I toyed with ucxt output). In this case, removing the '_XX' at the end of anything starting with 'UI_' does the trick.
Is there some kind of a guide to adapting the UCXT script to UCC standards?
(shameless plug) Not exactly a guide, but a small introduction and a (windows) command-line utility that can partially do the job at ESGuides: UCXT to UCC guide
(Edit: turned the url into an actual link)
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Sleepy Emp
Posts: 20
Joined: Thu May 14, 2020 1:34 pm

Third issue

Post by Sleepy Emp »

First of all, thanks for the char fix! The names have been translated.

Second, thanks for the trainer functions compiling tips - the editing process is about to begin.

But there's also a third issue that we need help with. As you all know, much of Britannia's charm comes from the runic font used in the game. And here comes the problem of translation. There are just not enough runes available to directly translate the signs and plaques into Russian. And of course, just replacing runes with the traditional font is not acceptable.

Here's the solution we've come up with - adding the translation written in normal font just below the runes. So, as we see it, what we're trying to do now is to rewrite and recompile the three functions: 017B, 02CB and 0334.

Using UCXT we've tried to recompile those functions. However, the 0334 function won't compile, crashing with an error 'abrt() not declared'. I guess that's another one of those UCXT -> UCC compatibility problems.

I'm asking for help again!

Thank you.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by marzo »

However, the 0334 function won't compile, crashing with an error 'abrt() not declared'. I guess that's another one of those UCXT -> UCC compatibility problems.
Yes it is; simply replace 'abrt()' by 'abort' throughout.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Sleepy Emp
Posts: 20
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by Sleepy Emp »

Hmm. After I make the aforementioned changes, the #0334 script compiles, but it breaks Penumbra's plaque puzzle. Placing the hammer near the plaque hangs up the game. What might be the cause?
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by marzo »

Post the script here so I take a look at it; and please enclose it in 'code' tags.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Sleepy Emp
Posts: 20
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by Sleepy Emp »

Here's what I tried to do. After I first discovered that the script breaks the puzzle, I took the original usecode, extracted the 0334 script from it, changed all "abrt()" commands to "abort" and immediately recompiled the script, not trying to change anything else in it. Then I inserted the result into the original usecode and tested it. It still breaks the puzzle. Here it is:

Code: Select all

// externs
extern var Func093D 0x93D (var var0000, var var0001);
extern var Func0908 0x908 ();
extern Func08FF 0x8FF (var var0000);
extern var Func0932 0x932 (var var0000);
extern Func08FE 0x8FE (var var0000);

Func0334 0x334 (var var0000)
{
	var var0001;
	var var0002;
	var var0003;
	var var0004;
	var var0005;
	var var0006;
	var var0007;
	var var0008;
	var var0009;
	var var000A;
	var var000B;
	var var000C;

	var0000 = item;
	var0001 = UI_get_item_quality(var0000);
	if (!(event == 0x0003)) goto labelFunc0334_0154;
	if (!(UI_get_item_shape(item) != 0x0334)) goto labelFunc0334_0049;
	var0000 = UI_find_nearby(var0000, 0x0334, 0x0005, 0x00B0);
	var0000 = Func093D(var0000, var0000);
	if (!(!var0000)) goto labelFunc0334_0049;
	abort;
	labelFunc0334_0049:
		var0001 = UI_get_item_quality(var0000);
		var0002 = [];
		if (!(var0001 == 0x0007)) goto labelFunc0334_0072;
		var0002 = [0x0258, 0x026F, 0x022D];
	labelFunc0334_0072:
		if (!(var0001 == 0x0008)) goto labelFunc0334_0082;
		var0002 = 0x0273;
	labelFunc0334_0082:
		if (!(var0001 == 0x0009)) goto labelFunc0334_0092;
		var0002 = 0x0280;
	labelFunc0334_0092:
		if (!(var0001 == 0x000A)) goto labelFunc0334_00A2;
		var0002 = 0x028E;
	labelFunc0334_00A2:
		if (!(var0001 == 0x000B)) goto labelFunc0334_00BB;
		var0002 = [0x0284, 0x0285, 0x0286];
	labelFunc0334_00BB:
		var0003 = false;
		//enum();
	labelFunc0334_00C0:
		for (var0006 in var0002 with var0004 to var0005) //goto labelFunc0334_014C when done;
		if (!UI_find_nearby(var0000, var0006, 0x0005, 0x00B0)) goto labelFunc0334_0149;
		if (!(var0001  0x0041)) goto labelFunc0334_018B;
		var000A = "This is not a valid plaque ";
		goto labelFunc0334_09FA;
	labelFunc0334_018B:
		if (!(var0001 == 0x0000)) goto labelFunc0334_01AD;
		var000A = ["important", "event", "to|be", "recorded", "here"];
		goto labelFunc0334_09FA;
	labelFunc0334_01AD:
		if (!(var0001 == 0x0001)) goto labelFunc0334_01CF;
		var000A = ["tomb|of", "kronos", "forgotten", "but|not", "forgiven"];
		goto labelFunc0334_09FA;
	labelFunc0334_01CF:
		if (!(var0001 == 0x0002)) goto labelFunc0334_01E8;
		var000A = ["royal", "(+tre"];
		goto labelFunc0334_09FA;
	labelFunc0334_01E8:
		if (!(var0001 == 0x0003)) goto labelFunc0334_0201;
		var000A = ["FELLOWSHIP", "HALL"];
		goto labelFunc0334_09FA;
	labelFunc0334_0201:
		if (!(var0001 == 0x0004)) goto labelFunc0334_021D;
		var000A = ["TEST", "OF", "STRENGTH"];
		goto labelFunc0334_09FA;
	labelFunc0334_021D:
		if (!(var0001 == 0x0005)) goto labelFunc0334_0236;
		var000A = ["MEDITATION", "RETREAT"];
		goto labelFunc0334_09FA;
	labelFunc0334_0236:
		if (!(var0001 == 0x0006)) goto labelFunc0334_024F;
		var000A = ["SHRINE OF", "THE CODEX"];
		goto labelFunc0334_09FA;
	labelFunc0334_024F:
		if (!(var0001 == 0x0007)) goto labelFunc0334_026E;
		var000A = ["hammer", "here", "to", "enter"];
		goto labelFunc0334_09FA;
	labelFunc0334_026E:
		if (!(var0001 == 0x0008)) goto labelFunc0334_029C;
		var000A = ["pick|item", "carefully", "to|k)p", "goi*"];
		Func08FF(["By Jove, I think thou art on the right track!", "The sign appears to have changed!", "Look at it now!"]);
		goto labelFunc0334_09FA;
	labelFunc0334_029C:
		if (!(var0001 == 0x0009)) goto labelFunc0334_02BB;
		var000A = ["a|golden", "ring|of", "tru(", "faces|()"];
		goto labelFunc0334_09FA;
	labelFunc0334_02BB:
		if (!(var0001 == 0x000A)) goto labelFunc0334_02DA;
		var000A = ["grasp", "not", "at", "(r+ds"];
		goto labelFunc0334_09FA;
	labelFunc0334_02DA:
		if (!(var0001 == 0x000B)) goto labelFunc0334_02FC;
		var000A = ["(e", "royal|mint", "shall|not", "hold|()", "back"];
		goto labelFunc0334_09FA;
	labelFunc0334_02FC:
		if (!(var0001 == 0x000C)) goto labelFunc0334_030F;
		var000A = "GO THIS WAY";
		goto labelFunc0334_09FA;
	labelFunc0334_030F:
		if (!(var0001 == 0x000D)) goto labelFunc0334_032B;
		var000A = ["DO NOT", "GO", "THIS WAY"];
		goto labelFunc0334_09FA;
	labelFunc0334_032B:
		if (!(var0001 == 0x000E)) goto labelFunc0334_034A;
		var000A = ["DO NOT GO", "IN", "THE", "WOODEN DOOR"];
		goto labelFunc0334_09FA;
	labelFunc0334_034A:
		if (!(var0001 == 0x000F)) goto labelFunc0334_036C;
		var000A = ["DO NOT", "GO IN", "THE", "WINDOWED", "DOOR"];
		goto labelFunc0334_09FA;
	labelFunc0334_036C:
		if (!(var0001 == 0x0010)) goto labelFunc0334_038E;
		var000A = ["GO", "IN", "THE", "STEEL", "DOOR"];
		goto labelFunc0334_09FA;
	labelFunc0334_038E:
		if (!(var0001 == 0x0011)) goto labelFunc0334_03AD;
		var000A = ["DO NOT", "GO", "IN THE", "GREEN DOOR"];
		goto labelFunc0334_09FA;
	labelFunc0334_03AD:
		if (!(var0001 == 0x0012)) goto labelFunc0334_03CF;
		var000A = ["ONLY", "ONE", "OF THESE", "SIGNS", "IS TRUE"];
		goto labelFunc0334_09FA;
	labelFunc0334_03CF:
		if (!(var0001 == 0x0013)) goto labelFunc0334_03EE;
		var000A = ["AT LEAST", "TWO SIGNS", "ARE", "FALSE"];
		goto labelFunc0334_09FA;
	labelFunc0334_03EE:
		if (!(var0001 == 0x0014)) goto labelFunc0334_0407;
		var000A = ["NATIONAL", "BRANCH"];
		goto labelFunc0334_09FA;
	labelFunc0334_0407:
		if (!(var0001 == 0x0015)) goto labelFunc0334_0423;
		var000A = ["ART THOU", "AN", "AVATAR?"];
		goto labelFunc0334_09FA;
	labelFunc0334_0423:
		if (!(var0001 == 0x0016)) goto labelFunc0334_0442;
		var000A = ["RESERVE", "THY", "SEATS", "NOW!"];
		goto labelFunc0334_09FA;
	labelFunc0334_0442:
		if (!(var0001 == 0x0017)) goto labelFunc0334_0464;
		var000A = ["THE BONES OF", "ZOG:", "EARLIEST", "BRITANNIAN", "FOSSIL"];
		goto labelFunc0334_09FA;
	labelFunc0334_0464:
		if (!(var0001 == 0x0018)) goto labelFunc0334_0483;
		var000A = ["SWAMP BOOTS", "ONCE WORN", "BY THE", "AVATAR"];
		goto labelFunc0334_09FA;
	labelFunc0334_0483:
		if (!(var0001 == 0x0019)) goto labelFunc0334_04A2;
		var000A = ["MANITTZI'S", "HARPSICORD", "USED WHILE", "COMPOSING"];
		goto labelFunc0334_09FA;
	labelFunc0334_04A2:
		if (!(var0001 == 0x001A)) goto labelFunc0334_04BE;
		var000A = ["|ANIA", "OF", "SPRING|"];
		goto labelFunc0334_09FA;
	labelFunc0334_04BE:
		if (!(var0001 == 0x001B)) goto labelFunc0334_04DD;
		var000A = ["|marney|", "skara|braes", "fine,", "flower"];
		goto labelFunc0334_09FA;
	labelFunc0334_04DD:
		if (!(var0001 == 0x001C)) goto labelFunc0334_04F9;
		var000A = ["(e", "wayfarers", "inn"];
		goto labelFunc0334_09FA;
	labelFunc0334_04F9:
		if (!(var0001 == 0x001D)) goto labelFunc0334_0515;
		var000A = ["(e", "blue", "boar"];
		goto labelFunc0334_09FA;
	labelFunc0334_0515:
		if (!(var0001 == 0x001E)) goto labelFunc0334_052E;
		var000A = ["royal", "museum"];
		goto labelFunc0334_09FA;
	labelFunc0334_052E:
		if (!(var0001 == 0x001F)) goto labelFunc0334_054A;
		var000A = ["(e", "music", "hall"];
		goto labelFunc0334_09FA;
	labelFunc0334_054A:
		if (!(var0001 == 0x0020)) goto labelFunc0334_0563;
		var000A = ["town", "hall"];
		goto labelFunc0334_09FA;
	labelFunc0334_0563:
		if (!(var0001 == 0x0021)) goto labelFunc0334_057C;
		var000A = ["royal", "mint"];
		goto labelFunc0334_09FA;
	labelFunc0334_057C:
		if (!(var0001 == 0x0022)) goto labelFunc0334_059E;
		var000A = ["THE", "THRONE", "OF", "MANY", "CHANGES"];
		goto labelFunc0334_09FA;
	labelFunc0334_059E:
		if (!(var0001 == 0x0023)) goto labelFunc0334_05BD;
		var000A = ["THE", "THRONE", "OF", "VIRTUE"];
		goto labelFunc0334_09FA;
	labelFunc0334_05BD:
		if (!(var0001 == 0x0024)) goto labelFunc0334_05D9;
		var000A = ["LORD", "BRITISH'S", "MUSKET"];
		goto labelFunc0334_09FA;
	labelFunc0334_05D9:
		if (!(var0001 == 0x0025)) goto labelFunc0334_05F8;
		var000A = ["THE", "STONES", "OF", "VIRTUE"];
		goto labelFunc0334_09FA;
	labelFunc0334_05F8:
		if (!(var0001 == 0x0026)) goto labelFunc0334_061A;
		var000A = ["SILVER", "HORN", "ONCE USED", "BY THE", "GARGOYLES"];
		goto labelFunc0334_09FA;
	labelFunc0334_061A:
		if (!(var0001 == 0x0027)) goto labelFunc0334_0639;
		var000A = ["TO SUMMON", "THE", "SILVER", "SNAKES"];
		goto labelFunc0334_09FA;
	labelFunc0334_0639:
		if (!(var0001 == 0x0028)) goto labelFunc0334_065B;
		var000A = ["THE ANKH", "", "SYMBOL OF", "THE", "VIRTUES"];
		goto labelFunc0334_09FA;
	labelFunc0334_065B:
		if (!(var0001 == 0x0029)) goto labelFunc0334_0674;
		var000A = ["LORD", "BRITISH"];
		goto labelFunc0334_09FA;
	labelFunc0334_0674:
		if (!(var0001 == 0x002A)) goto labelFunc0334_068D;
		var000A = ["THE", "AVATAR"];
		goto labelFunc0334_09FA;
	labelFunc0334_068D:
		if (!(var0001 == 0x002B)) goto labelFunc0334_06A9;
		var000A = ["THE", "VORTEX", "CUBE"];
		goto labelFunc0334_09FA;
	labelFunc0334_06A9:
		if (!(var0001 == 0x002C)) goto labelFunc0334_06CB;
		var000A = ["THE", "RUNES", "OF", "THE", "VIRTUES"];
		goto labelFunc0334_09FA;
	labelFunc0334_06CB:
		if (!(var0001 == 0x002D)) goto labelFunc0334_06ED;
		var000A = ["(e", "game", "of", "knights", "bridge"];
		goto labelFunc0334_09FA;
	labelFunc0334_06ED:
		if (!(var0001 == 0x002E)) goto labelFunc0334_0706;
		var000A = ["DO NOT", "ENTER"];
		goto labelFunc0334_09FA;
	labelFunc0334_0706:
		if (!(var0001 == 0x002F)) goto labelFunc0334_0728;
		var000A = ["blow", "horn", "to", "summon", "ferry"];
		goto labelFunc0334_09FA;
	labelFunc0334_0728:
		if (!(var0001 == 0x0030)) goto labelFunc0334_07F7;
		var0008 = UI_get_object_position(item);
		var000B = UI_get_object_position(0xFFE9);
		if (!((Func0932((var0008[0x0001] - var000B[0x0001])) <= 0x0002) && (Func0932((var0008[0x0002] - var000B[0x0002])) <= 0x0002))) goto labelFunc0334_07DC;
		var0007 = UI_execute_usecode_array(item, [0x55, 0x0609, 0x55, 0x0609, 0x55, 0x0609, 0x2D]);
		var0007 = UI_execute_usecode_array(0xFFE9, [0x27, 0x0003, 0x58, 0x0013, 0x61, 0x6D, 0x58, 0x0056, 0x01, 0x6E, 0x55, 0x0334]);
		Func08FE(["", "@He's dead, Avatar!@", "@Yancey-Hausman will pay!@"]);
		var0007 = UI_execute_usecode_array(0xFE9C, [0x23, 0x56, 0x001A]);
		return;
		goto labelFunc0334_07F7;
	labelFunc0334_07DC:
		var000A = ["THE", "THRONE", "ROOM", "OF", "LORD", "BRITISH"];
		goto labelFunc0334_09FA;
	labelFunc0334_07F7:
		if (!(var0001 == 0x0031)) goto labelFunc0334_0819;
		var000A = ["SEE IF", "THOU ART", "THE NEXT", "LORD OF", "BRITANNIA"];
		goto labelFunc0334_09FA;
	labelFunc0334_0819:
		if (!(var0001 == 0x0032)) goto labelFunc0334_083B;
		var000A = ["in", "lovi*", "memory", "of", "mama"];
		goto labelFunc0334_09FA;
	labelFunc0334_083B:
		if (!(var0001 == 0x0033)) goto labelFunc0334_0857;
		var000A = ["BEWARE", "THE", "DRAGON"];
		goto labelFunc0334_09FA;
	labelFunc0334_0857:
		if (!(var0001 == 0x0034)) goto labelFunc0334_0879;
		var000A = ["for", "(e", "love", "of", "marney"];
		goto labelFunc0334_09FA;
	labelFunc0334_0879:
		if (!(var0001 == 0x0035)) goto labelFunc0334_089B;
		var000A = ["|j|r|r|t|", "a|gr+t", "man", "a|gr+t", "writer"];
		goto labelFunc0334_09FA;
	labelFunc0334_089B:
		if (!(var0001 == 0x0036)) goto labelFunc0334_08B7;
		var000A = ["THE", "BRITANNIAN", "LENS"];
		goto labelFunc0334_09FA;
	labelFunc0334_08B7:
		if (!(var0001 == 0x0037)) goto labelFunc0334_08D3;
		var000A = ["THE", "GARGOYLE", "LENS"];
		goto labelFunc0334_09FA;
	labelFunc0334_08D3:
		if (!(var0001 == 0x0038)) goto labelFunc0334_08EC;
		var000A = ["EX", "POR"];
		goto labelFunc0334_09FA;
	labelFunc0334_08EC:
		if (!(var0001 == 0x0039)) goto labelFunc0334_090B;
		var000A = ["(e", "te,", "of", "love"];
		goto labelFunc0334_09FA;
	labelFunc0334_090B:
		if (!(var0001 == 0x003A)) goto labelFunc0334_092A;
		var000A = ["(e", "te,", "of", "courage"];
		goto labelFunc0334_09FA;
	labelFunc0334_092A:
		if (!(var0001 == 0x003B)) goto labelFunc0334_0949;
		var000A = ["nor(", "is", "(e", "way"];
		goto labelFunc0334_09FA;
	labelFunc0334_0949:
		if (!(var0001 == 0x003C)) goto labelFunc0334_0965;
		var000A = ["tru(", "is", "tru("];
		goto labelFunc0334_09FA;
	labelFunc0334_0965:
		if (!(var0001 == 0x003D)) goto labelFunc0334_0984;
		var000A = ["only", "app+rances", "are", "deceptive"];
		goto labelFunc0334_09FA;
	labelFunc0334_0984:
		if (!(var0001 == 0x003E)) goto labelFunc0334_099D;
		var000A = ["well", "done"];
		goto labelFunc0334_09FA;
	labelFunc0334_099D:
		if (!(var0001 == 0x003F)) goto labelFunc0334_09BC;
		var000A = ["(e", "keys", "of", "tru("];
		goto labelFunc0334_09FA;
	labelFunc0334_09BC:
		if (!(var0001 == 0x0040)) goto labelFunc0334_09DB;
		var000A = ["tru,|not", "always|(e", "obvious", "path"];
		goto labelFunc0334_09FA;
	labelFunc0334_09DB:
		if (!(var0001 == 0x0041)) goto labelFunc0334_09FA;
		var000A = ["(ou", "do,|not", "wish|to", "see|(is"];
		goto labelFunc0334_09FA;
	labelFunc0334_09FA:
		UI_display_runes(0x0033, var000A);
		return;
}
If not for the puzzle, everything else seems to be working fine (I mean the text display). I haven't tested whether the "Lord British accident" script works, though.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by marzo »

Here is the issue:

Code: Select all

	labelFunc0334_00C0:
		for (var0006 in var0002 with var0004 to var0005) //goto labelFunc0334_014C when done;
		if (!UI_find_nearby(var0000, var0006, 0x0005, 0x00B0)) goto labelFunc0334_0149;
		if (!(var0001 < 0x000B)) goto labelFunc0334_010D;
		var0001 = (var0001 + 0x0001);
		var0007 = UI_set_item_quality(var0000, var0001);
		UI_close_gumps();
		var0003 = true;
		goto labelFunc0334_014C;
		goto labelFunc0334_0149;
	labelFunc0334_010D:
		var0008 = UI_get_object_position(var0000);
		UI_sprite_effect(0x0007, var0008[0x0001], var0008[0x0002], 0x0000, 0x0000, 0x0000, 0xFFFF);
		UI_play_sound_effect(0x0044);
		UI_remove_item(var0000);
		UI_close_gumps();
		abort;
	labelFunc0334_0149:
		goto labelFunc0334_00C0;
	labelFunc0334_014C:
		if (!(!var0003)) goto labelFunc0334_0154;
		abort;
The problem is that UCC expects a set of curly braces which ucxt doesn't add to the output. To get this to work, put a '{' below the 'for' statement and a '}' just above the line 'labelFunc0334_014C:'; like this:

Code: Select all

	labelFunc0334_00C0:
		for (var0006 in var0002 with var0004 to var0005) //goto labelFunc0334_014C when done;
		{
		if (!UI_find_nearby(var0000, var0006, 0x0005, 0x00B0)) goto labelFunc0334_0149;
		if (!(var0001 < 0x000B)) goto labelFunc0334_010D;
		var0001 = (var0001 + 0x0001);
		var0007 = UI_set_item_quality(var0000, var0001);
		UI_close_gumps();
		var0003 = true;
		goto labelFunc0334_014C;
		goto labelFunc0334_0149;
	labelFunc0334_010D:
		var0008 = UI_get_object_position(var0000);
		UI_sprite_effect(0x0007, var0008[0x0001], var0008[0x0002], 0x0000, 0x0000, 0x0000, 0xFFFF);
		UI_play_sound_effect(0x0044);
		UI_remove_item(var0000);
		UI_close_gumps();
		abort;
	labelFunc0334_0149:
		goto labelFunc0334_00C0;
		}
	labelFunc0334_014C:
		if (!(!var0003)) goto labelFunc0334_0154;
		abort;
Without these brackets, the 'for' will execute only the first 'if' instead of all of the code I placed between the braces.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Sleepy Emp
Posts: 20
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by Sleepy Emp »

Just tried that. The game still hangs...
Sleepy Emp
Posts: 20
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by Sleepy Emp »

Oh dear... Just decompiling the script and recompiling it again helped.

Thanks!
Sleepy Emp
Posts: 20
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by Sleepy Emp »

Hello again.

We've just found out that the characters above 127 are not displayed during intro and endgame sequences. Would it be possible to fix that as well?
SB-X
Posts: 980
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by SB-X »

Does this still need to be fixed?
This forum topic gets a lot of spam. I hope you guys resolve this issue so you can freeze the thread.
Sleepy Emp
Posts: 20
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by Sleepy Emp »

This issue has been solved. It turned out that the intro-endgame fonts were stored in the flx files, so we just had to draw the new fonts specially for intro and endgame sequences. So the translation is complete now, thank you.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: Char type and Usecode scripts problems

Post by Dominus »

Good news! Congratulations!!!
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Locked