The best USECODE viewer

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
Peter Olafson

The best USECODE viewer

Post by Peter Olafson »

Hi again!

Could someone point me to a Windows XP tool that allows the user to read the USECODE files for TBG and SI?

(I'm trying to sort out what actually triggers the departure of a party member on account of the Avatar's stealing and what might be done afterward to restore them to the party.)

Thanks!

Peter
Malignant Manor
Site Admin
Posts: 985
Joined: Thu May 14, 2020 1:34 pm

Re: The best USECODE viewer

Post by Malignant Manor »

UCXT is the program I use to change the format in the original usecode file into a somewhat useable format.

The command line function is "ucxt -si -a -ousecode.uc -fz" for extracting SI usecode. I think the command line function is "ucxt -bg -a -ousecode.uc -fz" for extracting BG usecode.

I use UCC to compile the code. It has patch capabilities so only relevant portions need changed. The "Seven Towers" link on the links page has more information on UCC.


Function Func0633 handles party members around theft but it doesn't seem to be called by Exult. Function 63A handles the text messages for party members when stealing. Party members seem to be oblivious to theft in Exult. I believe that Exult checks other npcs nearby and goes through a list of text messages and if it gets a random number that equals them calling guards, a Usecode function is called and the call_guards intrinsic is used. (I saw the code before but don't feel like searching for it.)

Here's a quick post of some of the relevant Usecode.

Code: Select all


extern Func063A 0x63A (var var0000);
extern var Func0937 0x937 (var var0000);
extern Func093F 0x93F (var var0000, var var0001);

Func0633 0x633 (var var0000)
{
	if (!(event == 0x0001)) goto labelFunc0633_00B6;
	item->Func063A();
	if (!(UI_die_roll(0x0001, 0x0008) == 0x0001)) goto labelFunc0633_00B6;
	if (!(UI_get_item_flag(0xFFFC, 0x0006) && Func0937(0xFFFC))) goto labelFunc0633_0050;
	UI_item_say(0xFFFC, "@I am leaving!@");
	UI_remove_from_party(0xFFFC);
	Func093F(0xFFFC, 0x000C);
	gflags[0x02EB] = true;
	return;
	labelFunc0633_0050:
		if (!(UI_get_item_flag(0xFFFD, 0x0006) && Func0937(0xFFFD))) goto labelFunc0633_0083;
		UI_item_say(0xFFFD, "@I am leaving!@");
		gflags[0x02EC] = true;
		UI_remove_from_party(0xFFFD);
		Func093F(0xFFFD, 0x000C);
		return;
	labelFunc0633_0083:
		if (!(UI_get_item_flag(0xFFFF, 0x0006) && Func0937(0xFFFF))) goto labelFunc0633_00B6;
		UI_item_say(0xFFFF, "@I am leaving!@");
		gflags[0x02EA] = true;
		UI_remove_from_party(0xFFFF);
		Func093F(0xFFFF, 0x000C);
		return;
	labelFunc0633_00B6:
		return;
}




extern Func0940 0x940 (var var0000);
extern Func08FE 0x8FE (var var0000);

Func063A 0x63A (var var0000)
{
	var var0001;
	var var0002;

	if (!(event == 0x0001)) goto labelFunc063A_006B;
	var0000 = UI_get_array_size(UI_get_party_list());
	var0001 = UI_die_roll(0x0001, 0x0004);
	if (!(var0001 == 0x0001)) goto labelFunc063A_0030;
	Func0940(0x001B);
	labelFunc063A_0030:
		if (!(var0000 == 0x0001)) goto labelFunc063A_003B;
		return;
	labelFunc063A_003B:
		if (!(var0001 == 0x0002)) goto labelFunc063A_004B;
		Func08FE("@Must we do this?@");
	labelFunc063A_004B:
		if (!(var0001 == 0x0003)) goto labelFunc063A_005B;
		Func08FE("@Is that virtuous?@");
	labelFunc063A_005B:
		if (!(var0001 == 0x0004)) goto labelFunc063A_006B;
		Func08FE("@Avatar?!@");
	labelFunc063A_006B:
		return;
}

Peter Olafson

Re: The best USECODE viewer

Post by Peter Olafson »

Thanks! I'd noticed hat the recent snapshot doesn't implement this function, but I seem to recall it has done so in the past.

Where does one find UCXT these days? (It seems to have once been part of Exult Tools, but is not currently. I did look on Google, but couldn't find any download locations. :( )

Peter
Malignant Manor
Site Admin
Posts: 985
Joined: Thu May 14, 2020 1:34 pm

Re: The best USECODE viewer

Post by Malignant Manor »

It's in the tools snapshot. It's not in the tools folder for some reason but in the chosen install directory.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The best USECODE viewer

Post by Dominus »

I *think* it's in the install directory (the Exult directory normally) because ucxt makes use of exult.cfg (I *think* so at least)
--
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!
Peter Olafson

Re: The best USECODE viewer

Post by Peter Olafson »

Is there a way to bring a member who's left over the Avatar's thieving ways back into the party? There -is- dalogue within the Usecode file for this purpose, but I've never seen it implemented.

With thanks,

Peter
Peter Olafson

Re: The best USECODE viewer

Post by Peter Olafson »

Hi! I'm having some trouble running UCXT. (I can't find documentation in any of the Tools files and the command line provided above doesn't seem to work. Could someone please advise how they've done so successfully? I'm sure I'm missing some small detail. Thanks!

Peter
Malignant Manor
Site Admin
Posts: 985
Joined: Thu May 14, 2020 1:34 pm

Re: The best USECODE viewer

Post by Malignant Manor »

Make sure the usecode file you want is in the same directory as UCXT.

-ousecode.uc is the output file name minus the "-o" switch.

You may want to change the line to -oBGusecode.uc (or whatever you want) for BG and -oSIusecode.uc of SI so that both have different file names.
Peter Olafson

Re: The best USECODE viewer

Post by Peter Olafson »

Thank you! That worked just great. I'll have a better shot at figuring out some of the more arcane stuff with the output in this form.

Meant also to ask: Is there a commented list of function calls, flags and variables anywhere?

Peter
Malignant Manor
Site Admin
Posts: 985
Joined: Thu May 14, 2020 1:34 pm

Re: The best USECODE viewer

Post by Malignant Manor »

You should check out Marzo's Site. There's some information in the source, but this is much more readable.
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: The best USECODE viewer

Post by Wizardry Dragon »

I use the U7TOOLS package to extract it, and then view it in ConText with a syntax highlighter Marzo and I use. I could put it on the TFL downloads site, if Marzo has no objections.

Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: The best USECODE viewer

Post by marzo »

I could put it on the TFL downloads site, if Marzo has no objections.
I don't see why not; it is already in the TFL CVS, so it is "public" already. I also have a highlighter for gtksourceview-based editors which I haven't made available online.
------
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: The best USECODE viewer

Post by Wizardry Dragon »

I'll stick it on the TFL Downloads page, then :-)

Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Locked