UCC Code

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
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

UCC Code

Post by Wizardry Dragon »

I am wondering a few things...

1:) Does someone have a complete function list for UCC somewhere?
2:) How *exactly* do I get someone to join?
3:) Are there any unused flags in SI that I can use for additional story elements?

~ Wizardry Dragon
"Not sea shanty again!"
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: UCC Code

Post by drcode »

1. For SI, you'd have to look at the file 'siintrinsics.h' in the usecode directory, and 'intrinsics.cc' to see what they do. I'm sorry for the lack of documentation...
2. I'm pretty sure there's an intrinsic to do this (something like "add_party").
3. You can use flags past the end, but I'm not sure which one to start with.
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Wizardry Dragon »

If I can get enough information together I can try my hand at documenting it :)

More questions:

1) After what function number is it safe to add new functions? That is, what's the last UC function # in SI?

2) One last thing, I know theres the snippets on the screenys page, but is there a whole conversation script somewheres I can use as an example to look at?

3) What flag specifies if the Banes are released in SI? (Or how do I check for that?) I'm adding some NPCs and I want to have some conversation options that only come up after that occurs.

4) How do I get another character to interject in a conversation? Like Iolo or Shamino or something... and how do I check if they're around? (especially if they're not in the party, it's easy enough to check if the companions are in the party)

Thanks for the help, I'm just starting to get my feet wet in UC :)

~ Wizardry Dragon
"Not sea shanty again!"
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Ezric
Posts: 55
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Ezric »

Do the normal games even check to see if someone is around to interject? I can recall occasions in BG where an NPC lying dead at my feet would interject into a conversation.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Dominus »

to get you started get the Exult add-on from the source (/content...) and look at usecode.uc for some functions. Also how to get an NPC to join.
--
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!
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Wizardry Dragon »

Hmm.

If I got all this stuff together into documentation would I be the only one to use it? :) I could do that if there's interest.

I still could use info on how to detect if the Banes have been released yet in SI...

Also, is bartering a. la. SI an intrinsic or do I have to script it?

~ Wizardry Dragon
"Not sea shanty again!"
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Dominus »

a documentation would be very interesting as newcomers to this would have some nice help :-)
--
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!
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Wizardry Dragon »

I've started work on some of it - going to post what I have to the internet when it's enough to warrant it :)

I must press: which flag is the Banes? My own scripting can't go on until I figure that out. Also trying to figure out bartering ... is that an intrinsic function or do you have to script it?

~ Wizardry Dragon
"Not sea shanty again!"
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: UCC Code

Post by drcode »

A few more answers:

1. What you need to do is disassemble si's 'usecode' file. I don't have the tool in front of me, but you need to use the '-a' option to disassemble the whole thing, and you also have to pass an option ('-si'?) to decode it using SI's intrinsic names. This will create a 10MB assembly-language file with all the functions, so you can see which ones are used and how they're organized. Note: 0-0x3ff are for shapes (by shape #), 0x400-0x4ff are for NPC's.

2. Look at our "island patch" from the downloads page.

3. It's not easy to answer. We've figured out flags by studying the disassembled usecode, but it's not an easy thing to do. If you're running on Linux, you can see what's being executed as you play, which can help.

4. The island patch might have an example of this; can't remember exactly. I believe there's an intrinsic function to see if a given NPC (by NPC #) is nearby.
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Wizardry Dragon »

To the answers, more questions:

1:) What tool do you use to disassemble usecode? WUC?

2:) Is there a way to implement new code dynamically or do I have to rebuild the Usecode every single time I edit the usecode?

3:) Is batering an intrinsic or is it scripted?

4:) Could you list the flags you do know? I'll add them to the UCC docs I'm writing up :)

5:) Is there a way to change the Avatar shape without it changing back?

6:) Can I exceed 0x4ff or 0x3ff? Are they programmer-enforced limits or does the game enforce them? (or get confused if you use something exceeding them) I was going to use 0x9xx for custom UC

7:) Am I correct in assuming decompiled usecode is in pure usecode and not usecode c (UCC) ?
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Wizardry Dragon »

(hit post before I was done :x)

and finally,

8:) You wouldn't considering having the docs for UCC here if I made them, would you? :)

~ Wizardry Dragon
"Not sea shanty again!"
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: UCC Code

Post by drcode »

1. I think it's 'wud'.
2. I think (it's been a while) you can just compile your new functions and place the result (named 'usecode') in the 'patch' directory (which should be at the same level as 'static' and 'gamedat'. Exult first reads 'static/usecode', then 'patch/usecode'.
3. I think it's scripted. There's probably a single function in SI's usecode that gets called, but I don't have that memorized:-)
4. I don't know any at the moment.
5. I think you can do it with the 'polymorph' intrinsic.
6. Only 1024 shapes are allowed, so you can't exceed 0x3ff for shapes. I think you can have up to 2048 NPC's. Any other unused numbers can be used as you like.
7. Yes, it's assembly language for a virtual machine.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Dominus »

8.) we are actually in need of good documentation of the ucc language and we would like to make it availlable whenever you feel like it :-).
Pertex started some kind of documentation some time ago. it can be found at http://www.sophen.de/exult/ and might be of some help to you (the link can be found in the Exult Studio docs)
--
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!
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Wizardry Dragon »

Okay, how do I compile a new function?
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Dominus »

do you have the source of Exult?
Then take a closer look at the content dir :-)
"ucc -o usecode usecode.uc", this will give a new file called usecode (or an error message if something is wrong :-))
--
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!
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Wizardry Dragon »

I don't have the source, but I have a strong suspicion I should get it :)

~ Wizardry Dragon
"Not sea shanty again!"
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Wizardry Dragon »

Random question ... what's the relevance of the Usecode Item # listed in the F2 cheat screen for NPCs?

~ Wizardry Dragon
"Not sea shanty again!"
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Wizardry Dragon »

Okay, been trying to do this and it only works partially.

I have a script, it compiles fine with ucc -o C:\serpent\patch\usecode usecode.uc with no errors, but when I put it into Serpent Isle, nothing within converse{ ... } works ... maybe it's something about the intrinsics?

I tried to compile it with ucc -si (which seemed to be common sense) but it says:

C:\u7stuff\usecode\usecode.uc: [1]: Expected INDENTIFIER

Anyone know what's going on?

I can post the offending script if you want...

~ Wizardry Dragon
"Not sea shanty again!"
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: UCC Code

Post by drcode »

Sure, I'll take a look. I don't think any of us have tried doing scripts for SI yet.
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Wizardry Dragon »

I'll post it somewheres on the internet ... it's too long to post here :)

BTW, it has a few definete plot spoilers in it, anyone that wants to be surprised with one of the things that I'm adding in, don't look at it when I get it up :)

(I like the idea of having the banes take over the three main cities :) )

~ Wizardry Dragon
"Not sea shanty again!"
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Wizardry Dragon »

Okay, I will hopefully have all the code up within a couple of business days, I applied for a project on SF (I had one back in the day, but it became an inactive mess of a site and I forget the password. Ought to just be deleted one of these days)

I'll post it there if and when it goes through and I get a project :)

~ Wizardry Dragon
"Not sea shanty again!"

ps. If I do get a project, the site'll be at u7blackrock.sf.net
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: UCC Code

Post by drcode »

Creating this as a SF project is a good idea.
Colourless
Site Admin
Posts: 731
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Colourless »

Just a slight warning here. Be very very careful with the license you use for your project. It would be a violation of the GPL if the USECODE you write is under the GPL and it interacts with the USECODE from the original game.

Your usecode in such a case must not be GPL'd.

-Colourless Dragon
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC Code

Post by Wizardry Dragon »

I was thinking the Library licensce ... but I don't know ... any ideas on a good license?

~ Wizardry Dragon
"Not sea shanty again!"
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Locked