Page 1 of 1

hooking GetWorldHeight

Posted: Wed Sep 27, 2006 4:07 am
by Bytehawk
Since GetWorldHeight is giving back the highest, not the lowest z coordinate you can stand at, as it should, I wanted to hook GetWorldHeight and calculate the correct coordinate using GetStandingLayers (x, y)[1].z

This is what I tried:

Code: Select all

--- syshook.cfg ---------
SystemHookScript worldHeight.ecl
{
  GetWorldHeight gwh
}

--- worldHeight.src ---------
program worldHeight()
  return 1;
endprogram

exported function gwh(x, y, realm:= _DEFAULT_REALM)
  return GetStandingLayers (x, y, MAPDATA_FLAG_ALL, realm)[1].z;
endfunction
But this gives only a "Unknown SystemHook GetWorldHeight"

I know, I could replace any ocurrance of "GetWorldHeight" in all scripts with "GetStandingLayers (x, y)[1].z" but if anyone could help me with creating that hook or telling me, what I - again - made wrong so that GetWorldHeight isn't working, I'd prefer that :)

Thanks in advance.

PS: Where can I find out, for what functions SytemHooks exist?

Posted: Wed Sep 27, 2006 9:16 am
by Marilla
Unless something happened of which I am not aware, there is no such system hook.

The valid system hooks can be found in the documentation. Specifically, in the config file reference under the syshook.cfg entry. The valid entries for 096 are: CheckSkill, OpenSpellbook, GetBookPage, CombatAdvancement, ParryAdvancement, Attack, Pushthrough, SpeechMul. 095 is the same, but without SpeechMul.

Posted: Wed Sep 27, 2006 9:59 am
by innominabile
But you can't simply use your own function instead GetWorldHeight ?

Posted: Thu Sep 28, 2006 3:00 am
by Austin
Theres no hook for that function..
As noted by Marilla, the poldoc website has a list of what can be hooked.

http://poldoc.fem.tu-ilmenau.de/

Easiest way to get the first standing position would be to use the function

GetStandingHeight( x, y, startz, realm := _DEFAULT_REALM )

and read its .z member.

Posted: Thu Sep 28, 2006 3:58 am
by Bytehawk
So I didn't screw it up and GetWorldHeight is in fact not working the way it used to? Phew... *looks relieved* I almost didn't dare to ask anything more here, after my last few ridiculous posts :)

Thanks for you answers, I'll give GetStandingHeight a chance.

edit:
Uhm.. when I'm standing under... kind of a balcony, GetStandingHeight gives back an error: "Can't stand there"
*sigh* Okay, gonna use GetStandingLayers()[1].z

Posted: Sat Nov 25, 2006 1:38 pm
by Shinigami
Bytehawk wrote:So I didn't screw it up and GetWorldHeight is in fact not working the way it used to?
depends on how you read the documentation. the external documentatione (you can find on website) is not complete in this point. internal documentation (in source code) says, it's the lowest standing height on top of map and all statics. and this is how it works internally...

Shinigami