Jump to content

FWDekker

Citizen
  • Posts

    2
  • Joined

  • Last visited

Contact Methods

Profile Information

  • Location
    The Netherlands

FWDekker's Achievements

Watcher

Watcher (1/12)

0

Reputation

  1. I know, I just had some problems with type conversion and decided to temporarily go for this hacky approach. In which case I think the documentation is wrong in saying that ElementExists "[r]eturns true if aeContainer [h]as a child element whose name is asName" (emphasis mine), since it returned true when I asked about the signature RNAM. Regardless, using ElementBySignature or ElementByPath seems to do what I want. Thanks!
  2. I'm trying to write a script that will export particular data from an NPC to a file for further processing. However, the program exhibits strange behaviour when I try to access some of the NPC's elements. Getting simple fields and printing them as strings works fine, but it goes wrong as soon as I try to get non-string elements. In particular, I have the following script: { Export list of records ------------------------ Hotkey: Ctrl+Alt+Shift+E } unit UserScript; const sRecordsToSkip = 'REFR,PGRD,PHZD,ACHR,NAVM,NAVI,LAND'; function Initialize: integer; begin // Do nothing end; function Process(e: IInterface): integer; var _aidt : IwbElement; _assigned : string; begin if Pos(Signature(e), sRecordsToSkip) <> 0 then begin Exit; end; if not ElementExists(e, 'AIDT') then begin Exit; end; _aidt := ElementByName(e, 'RNAM'); _assigned := Assigned(_aidt); AddMessage('Is assigned? ' + _assigned); end; function Finalize: integer; begin // Do nothing end; end.Whenever I run this script, the message "Is assigned? False" is printed. I do not understand how this is possible: I checked whether the element existed, but after getting it, it is Nil. What's going wrong here? Any help is appreciated.
×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Privacy Policy, and Terms of Use.