Usecoding

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
Valliant Dragon

Usecoding

Post by Valliant Dragon »

Okay, another little survey thing.

I was wondering how many people (developers included) would be interested in me taking the scripting/debugging functions I've written for the IPack front edn (www.ultimadragon.0catch.com/IPack Front End.zip) and expand and use them to make a Usecode development studio, perhaps like the MS Developer Studio environment like VB6.

Id like to see some yes/no responses (and why would help too) from people, if they don't mind. Any ideas or suggestions for features would be great as well.

Thanks,
Valliant Dragon
SB-X
Posts: 980
Joined: Thu May 14, 2020 1:34 pm

Re: Usecoding

Post by SB-X »

Only thing I can think of that I ever thought of like this that would be convenient for Usecode is maybe a dialog editor, where you select the
NPC and you use drop-downs and input boxes to control how their communication will go, and there are special areas where you can add custom usecode to be executed in response to some answers.
SB-X
Posts: 980
Joined: Thu May 14, 2020 1:34 pm

Re: Usecoding

Post by SB-X »

Oh... also, I should mention that it automatically generate the Usecode source file and run UCC or whatever over it to generate bytecode, and it would place it in the proper directory, merging it with existing usecode if necessary.

But I think this would be best as part of Exult Studio.
Mirek

Re: Usecoding

Post by Mirek »

I think that any activity in this area is good. Some kind of more easy-to-use tools for usecode would make it more accessible to people who are not assembler programmers. The above mentioned dialog editor is a prime example.


Mirek
Telemachos

Re: Usecoding

Post by Telemachos »

Actually I think there is still alot to do to make Usecode more easy to use. I'm by no means a usecode expert but I have some interest in virtual machines and domain specific programming languages and from what I've seen from quickly browsing through the Exult code writing usecode still involves a lot of hex numbers etc? Isn't it correct for example that in Exult studio a NPC refers to it's usecode functions through hex numbers rather than symbolic names? It seems to me that currently writing usecode is actually a bit like writing machine code - or assembly code at least. I understand that the exult team cannot possibly assign names to all the usecode functions in the original U7 games if those names are not stored in the compiled file but I think it should be possible by now to define a grammar for usecode and create a high-level programming language which compiles to usecode. This way usecode could be written at a higher level at least for new games using Exult studio. Now it should also be possible to add yet another layer to this by creating an even higher level language specifically designed to easily script dialogs. A "dialog" compiler could then compile from this dialog language to usecode - either directly to the compiled usecode that the game engine understands OR to high level usecode which can then be compiled in a second step using the normal usecode compiler. I don't have heaps of spare time but I'm willing to help out with these things if anyone desides to start on them..
wjp
Site Admin
Posts: 1708
Joined: Thu May 14, 2020 1:34 pm

Re: Usecoding

Post by wjp »

Telemachos: Jeff already wrote a compiler from a language like C to usecode. (ucc; it's in the usecode/compiler directory)
It's not entirely finished, but we did already use it for the usecode in the exultstudio demo
nadir
Site Admin
Posts: 407
Joined: Thu May 14, 2020 1:34 pm

Re: Usecoding

Post by nadir »

My plan, if I ever have time to implement it, is to add a syntax-coloured Usecode viewer using Scintilla
Colourless
Site Admin
Posts: 731
Joined: Thu May 14, 2020 1:34 pm

Re: Usecoding

Post by Colourless »

Here is a sample of Usecode from the exultstudio demos:

/*
* Egg on island created just E. of Trinsic.
*/

new_island_egg0 0x740 ()
{
// Get random NPC (or Avatar).
var party = UI_get_party_list();
var party_cnt = UI_get_array_size(party);
var npc;
if (party_cnt > 1) // Companions?
npc = party[1 + UI_get_random(party_cnt - 1)];
else
npc = party[UI_get_random(party_cnt)];
if (npc)
{
UI_show_npc_face(npc);
say("Do I detect . . .~",
". . . the smell of Usecode?");
UI_remove_npc_face(npc);
}
}
Valliant Dragon

Re: Colouring

Post by Valliant Dragon »

I have code that will colour that for you, Im using it in the Image Packager front end to highlight the "Archive" "Palette" and "flat" keywords in the IPack script.

I could implement it as part of a dev studio. I could most certainly work to implement it in ExultStudio. I'll probably make the front end in VB and compile to DLL and put the actual code in Pascal (I can port Pascal to near anything) I just wanted to get some ideas flowing.

I could also implement the following:

- Syntax auto-complete (like the MS Developer Studio - drop down code
showing function or method syntax)

- Keyword colouring. Already got that.

- Debugging. (Mem register check, dialogue consistency check, even a
spell check for the dialogue if it's wanted.)

- Cross-game usecoding, such as for Ultima 8.

- Dialogue previewing. Perhaps a small game-shell that will just have
players in dialogue.

- Dialogue wizard - give the program a dialogue tree and it does the rest.

- Script wizrd - tell the program what to do where .. eg. put shape x here.

Any other ideas are welcome.

Thanks,
Valliant Dragon
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Usecoding

Post by drcode »

SB-X: Yes, it would be a nice feature to have ExultStudio compile the usecode, show errors, and put the result in the right directory. Even nicer would be a Usecode debugger, but that will be a lot more work.

Valliant: A tool to make conversation-creation easier would be a good thing. Another would be some sort of 'director' tool for creating scenes like the 'Fawn Trial'. But keep in mind that 'ucc' is barely finished and only minimally tested. Its syntax could still change.

Also, it would be nice if the tools are cross-platform, with my preferred toolkit being GTK+.
Valliant Dragon

Re: Crossplatforming

Post by Valliant Dragon »

DrCode:

1:) Im working already on a debugger. Started out just to save me some trouble, but I can share :-)

2:) Id have a core syntax function that would use keyword references. If the syntax changed, Id just change the data in the reference.

3:) A scene wizard could possilby be an extension to the dialogue wizrd (user clicks button "I would like to use this in a scene"?)

3:) Well, I'd be using Borland's compiler, not Microsoft's, so the platform is just a touch less skewed. :-) If I just stay away from Windows functions, I'll be fine for cross platforming.
Telemachos

Re: Crossplatforming

Post by Telemachos »

wjp: but from the example colourless postet it seems that the usecode functions still has hex numbers instead of symbolic names - leaving it up to the scripter to remember these numbers and make certain there is not another function with that number (ok this might not be true - I guess you could still have a symbol checking phase to check that.. I haven't checked if this is the case in ucc). Also the code snippet seems to only use functions build into the language (say, UI_get_party_list etc.? Those are build-in functions right?) but if a scripter wanted a usecode function to call another usecode function he would have to refer to that function again using its hex number right?
wjp
Site Admin
Posts: 1708
Joined: Thu May 14, 2020 1:34 pm

Re: Crossplatforming

Post by wjp »

Functions also have names ("new_island_egg0") in this snippet.
I'm not really sure what the call semantics are right now, but we're definitely planning on making them name-based.
nadir
Site Admin
Posts: 407
Joined: Thu May 14, 2020 1:34 pm

Re: Crossplatforming

Post by nadir »

Important things (to me):


These tools should be an integrated part of ExultStudio
These tools should be done with glade and gtk+
Valliant Dragon should get CVS access
Valliant Dragon

Q/A

Post by Valliant Dragon »

Telemachus:

- Hex or name should work when calling.

wjp:

- I can work on call semantics. Just tell me what you guys want.

Nadir:

- If the ExultStudio team can send me a line about integrating, I'd only be too happy to provide the Image Packager (front end) and the Usecode developer.

- I've no clue how to use either. Help would be nice. (Until such time as I know how to, Im programming using Pascal; it's my native language, so to speak)

- Don't butter me up :-)

Thanks,
Valliant Dragon
Valliant Dragon

Usecode Language

Post by Valliant Dragon »

Would it be possible (I hate to step on UCC's toes, but ...) for me to create my own functions that use the core uscode functions? If so I could include a library of some sort of predefined utility functions? And what kind of utility functions would peopel be wanting, if any?

Also, for GTK+ implementation, I'd need help coding it. I've never worked with it or Glade, so I'd be coding in the dark without some help. Any and all help on that subject would be appreciated.

The tools I'm/I'd be making in Pascal don't rely on Windows functions so cross-platforming should have no problems.

The current iteration of the studio is at www.ultimadragon.0catch.com/UsecodeStudio.zip. It's not much now, but it's about five minutes of work's worth so :-) Beyond the core code interpreters, the wizards are the first thing to get implemented.

Thanks,
Valliant Dragon
SB-X
Posts: 980
Joined: Thu May 14, 2020 1:34 pm

Re: Usecode Language

Post by SB-X »

If Valliant Dragon gets CVS access, will people start assigning bugs for Valliant Dragon to fix? :)
Valliant Dragon

No bugs !!!

Post by Valliant Dragon »

I guess so. Grr... :-/

Thanks,
Valliant Dragon
Locked