Jump to content

xEdit scripting, how to read/write/remove linked lists?


Recommended Posts

Posted

No syntax I've tried has worked.

    seev(e, 'Linked References', ''); // Dialog "Linked References" can not be edited
    seev(e, 'Linked References', null); // FRUITLESS

I can't even read them.

    // nope    geev(e, 'XLKR\0\Keyword');    geev(e, 'Linked References\XLKR #0\Ref');

I need to be able to check for the presence of Linked References, as well as be able to add them and, crucially, remove them from within my xEdit script.

Posted

If 'e' is a reference type record (REFR, ACHR, etc) record, then

 

Check that Linked References element exists

if ElementExists(e, 'Linked References') then

Getting existing Linked References element

linkedrefs := ElementByPath(e, 'Linked References')

Adding Linked References container to the REFR record, note that it will create a new empty entry inside by default

linkedrefs := Add(e, 'Linked References', True);

Adding a new linked reference entry to the existing container

lref := ElementAssign(linkedrefs, HighInteger, nil, False);

Getting entry by index from linked references container

lref := ElementByIndex(linkedrefs, 5); // index starts from 0

Changing values of particular linked reference

SetElementEditValues(lref, 'Keyword/Ref', 'MinFlareGunStart [KYWD:00157CB8]');
SetElementEditValues(lref, 'Ref', 'PrewarRadioTransmitterREF [REFR:000BA504]');
// or simply
SetElementEditValues(lref, 'Keyword/Ref', '00157CB8');
Posted

Thanks a lot, that really helps.

 

One thing I don't see is how to just delete the linked references altogether. Is there a delete function, do I set something to a null value, or..?

Posted
  On 12/5/2015 at 9:49 PM, varx said:

Thanks a lot, that really helps.

 

One thing I don't see is how to just delete the linked references altogether. Is there a delete function, do I set something to a null value, or..?

RemoveElement(e, 'Linked References');
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...