ES Guides tutorial question
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
ES Guides tutorial question
Going through the usecode for dummies tutorial (adding an NPC and usecode for it), I can't get the usecode to work and I don't see whats wrong.
-The usecode function number is the same as the NPC function number
-the usecode is the same as in example 2b3
-the usecode.uc is in the patch folder of bg
-I compiled usecode.uc using ucc.exe and renamed "usecode.uco" into "usecode"
-"usecode" is in the patch folder
-I started a new game
Well, there's Bob in the middle of the pub, dancing happily, but he doesn't say a word.
Trying the conversation tutorial with the doubleclick event doesn't work either.
-The usecode function number is the same as the NPC function number
-the usecode is the same as in example 2b3
-the usecode.uc is in the patch folder of bg
-I compiled usecode.uc using ucc.exe and renamed "usecode.uco" into "usecode"
-"usecode" is in the patch folder
-I started a new game
Well, there's Bob in the middle of the pub, dancing happily, but he doesn't say a word.
Trying the conversation tutorial with the doubleclick event doesn't work either.
Re: ES Guides tutorial question
Using latest snapshots of Exult and ExultStudio.
Re: ES Guides tutorial question
nevermind... I didn't have the right "patch" directory set in exult.cfg
This is fun... usecode rocks!
This is fun... usecode rocks!
Re: ES Guides tutorial question
A good way to learn usecode is to see what others have done. I recommend that after the tutorials, you check out Alun Bestor's Quests and Iteractions mod and my SI Fixes.
------
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]
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]
Re: ES Guides tutorial question
I just decompiled BG's usecode and ran Tawns Visual Basic tool over it, to make it more readable (nice work there, by the way). I'm hoping to find out what the intrinsics are and how they can be effectively used.
Or is there already an intrinsic list with descriptions somewhere?
Or is there already an intrinsic list with descriptions somewhere?
Re: ES Guides tutorial question
It is my tool actually, but nevermind Most of the documentation of the intrinsics are in the Exult source, but there was someone (Pertex IIRC) writting documentation for it; I think there is a homepage, but I can't find the URL anywhere.
------
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]
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]
Re: ES Guides tutorial question
And before I forget: there are some parts of the usecode (both BG's and SI's) which are horribly mangled by the tool. I haven't yet have time to figure out what is causing it... but I intend to fix it when I do. Usually, these places can be spotted easily, but I've run accross some usecode functions which had very subtle errors
------
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]
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]
Re: ES Guides tutorial question
> It is my tool actually, but nevermind
Oops, sorry! Anyways, nice work. Would you put the code to your tool online sometime? If I'm really bored once, I just might reimplement it in Java, to make it available to non-windows users, and perhaps perform some meaningful function-renaming while I'm at it.
Another thing I wanted to ask, what happens if you include an existing function in a patch-usecode? Is the old function overwritten or is the new function ignored?
Oops, sorry! Anyways, nice work. Would you put the code to your tool online sometime? If I'm really bored once, I just might reimplement it in Java, to make it available to non-windows users, and perhaps perform some meaningful function-renaming while I'm at it.
Another thing I wanted to ask, what happens if you include an existing function in a patch-usecode? Is the old function overwritten or is the new function ignored?
Re: ES Guides tutorial question
The old function is ignored, while the new one runs. You can still access the old function, though, if you need it; use "function_name.original();" for that.
------
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]
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]
-
- Site Admin
- Posts: 1310
- Joined: Thu May 14, 2020 1:34 pm
Re: ES Guides tutorial question
I have another question regarding the usecode tutorials and ucc:
I created a usecode egg that triggers when you approached a standing NPC. The NPC usecode is 0x401, so that's what I put in the egg. The usecode function itself contains the following code:
#include "ucdefs.h"
const int MONK = 1;
monk_dialogue 0x401 ()
{
var given = 0;
if(event == 0)
return;
if(event == 1){
item.say("The monk seems to ignore you");
item.hide();
return;
}
if(event == 3)
{
MONK.say("A cloaked individual stands still and silent, while a muffled voice comes from a cauldron. @Do you need help?@");
converse ([ "Bye", "Heal", "Uncurse","Donate"])
{
case "Bye":
say("@Keep safe.@");
break;
case "Heal" (remove):
say("@You have been healed!@");
case "Uncurse" (remove):
say("@You have been uncursed!@");
case "Donate" (remove):
given = given + 1;
say("@Thank you!@");
if(given == 5)
{
say("@You are blessed!@");
} else {
add("Donate");
}
}
MONK.hide();
}
}
If I replace "MONK" by "item", the function stops working. That is, if the function is called by the usecode egg, I have no access to the item variable. Is it me who does something wrong or am I missing something?
thx
Artaxerxes
I created a usecode egg that triggers when you approached a standing NPC. The NPC usecode is 0x401, so that's what I put in the egg. The usecode function itself contains the following code:
#include "ucdefs.h"
const int MONK = 1;
monk_dialogue 0x401 ()
{
var given = 0;
if(event == 0)
return;
if(event == 1){
item.say("The monk seems to ignore you");
item.hide();
return;
}
if(event == 3)
{
MONK.say("A cloaked individual stands still and silent, while a muffled voice comes from a cauldron. @Do you need help?@");
converse ([ "Bye", "Heal", "Uncurse","Donate"])
{
case "Bye":
say("@Keep safe.@");
break;
case "Heal" (remove):
say("@You have been healed!@");
case "Uncurse" (remove):
say("@You have been uncursed!@");
case "Donate" (remove):
given = given + 1;
say("@Thank you!@");
if(given == 5)
{
say("@You are blessed!@");
} else {
add("Donate");
}
}
MONK.hide();
}
}
If I replace "MONK" by "item", the function stops working. That is, if the function is called by the usecode egg, I have no access to the item variable. Is it me who does something wrong or am I missing something?
thx
Artaxerxes
Re: ES Guides tutorial question
If you define MONK = -1 instead it will work; the usecode number of NPCs must is negative. As a general rule, the NPC's number in usecode is the negative of what you see in Exult Studio (or in the Cheat Screen). The exception is the Avatar, whose usecode id is -356.
------
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]
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]
Re: ES Guides tutorial question
The behavor is correct isn't it? If it's called by the egg, then that's the item.
Re: ES Guides tutorial question
Yes, I forgot to say that. Actually, it seems that I have misunderstood Artaxerxes' question entirely When the egg calls an usecode function, the egg is the 'item'; and since the egg cannot be translated to an NPC, it can't say anything, which is why the monk would not say anything.
------
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]
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]
-
- Site Admin
- Posts: 1310
- Joined: Thu May 14, 2020 1:34 pm
Re: ES Guides tutorial question
now this makes sense. Thx
Artaxerxes
Artaxerxes