Usecode: calling functions\sub routines

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

Usecode: calling functions\sub routines

Post by TMNM Dragon »

Not sure how to explain this, so I'll post some code first.

Func02BE 0x2BE ()
{
var getstuff;
var gotstuff;
gotstuff = Func09C2(getstuff);
}

... more Func here...

Func09C2 0x9C2 (var var00)
{
var partysize;
partysize = UI_get_array_size(UI_get_party_list());
return var00;
}

OK, this will say that Func09C2 is not declared.
If I add " extern Func09C2 0x9C2 (var var00); " to the top, i get Function already in use.
TMNM Dragon

Re: Usecode: calling functions\sub routines

Post by TMNM Dragon »

missed a line...

add:
var00 = partysize
before return var00;
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Usecode: calling functions\sub routines

Post by drcode »

Looks like a bug. I'll try to verify and fix it tonight.
wjp
Site Admin
Posts: 1708
Joined: Thu May 14, 2020 1:34 pm

Re: Usecode: calling functions\sub routines

Post by wjp »

More a missing feature. I don't think you can declare functions without defining them currently. Having to use 'extern' to declare functions that are actually defined in the same file sounds like an abuse of 'extern'.

A temporary workaround would be to move 0x9C2 to above the places where it's used.
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Usecode: calling functions\sub routines

Post by drcode »

Yes, it is sort of a feature. But it ought to work now with the next ucc version (just checked it into CVS).
Locked