YouDoNotKnowMyName Posted January 14, 2023 Author Share Posted January 14, 2023 How would the "SetElementEditValues()" function work? So how would I set the position and rotation and scale with that?The values aeContainer and aePath will tell the function which object reference to edit.But the string?It says "and sets its value based on the string representation asValue.". How would I tell that to "set PosX to 123.45 " or "set RotZ to 180" or "set scale to 1.5"?There is no further information about what kind of information is passed into that function with that string. Link to comment Share on other sites More sharing options...
DieFeM Posted January 14, 2023 Share Posted January 14, 2023 SetElementEditValues(ref, 'DATA\Position\X', '538.55'); ref being the IInterface object returned by Add. Link to comment Share on other sites More sharing options...
LarannKiar Posted January 14, 2023 Share Posted January 14, 2023 Here's a sample: Unit MyScript; Const iRotZ = 145; sValidSignatures = 'REFR, ACHR'; Function Process(e: IInterface): Integer; Begin If Pos(Signature(e), sValidSignatures) = 0 Then Exit; If GetIsDeleted(e) Then Exit; If Pos(Signature(e), sValidSignatures) = 1 Then SetElementEditValues(e, 'DATA\Rotation\Z', iRotZ); End; End. Link to comment Share on other sites More sharing options...
YouDoNotKnowMyName Posted January 15, 2023 Author Share Posted January 15, 2023 Cool!And how can I set the base object of the reference? Where are those 'DATA\ ... ' things documented? Link to comment Share on other sites More sharing options...
DieFeM Posted January 15, 2023 Share Posted January 15, 2023 Those things are nowhere documented, reading the code of other scripts, or deducing it. Link to comment Share on other sites More sharing options...
LarannKiar Posted January 15, 2023 Share Posted January 15, 2023 Cool!And how can I set the base object of the reference? Where are those 'DATA\ ... ' things documented? Might not be the most elegant solution but this should do it: Unit MyScript; Const iRotZ = 145; sValidSignatures = 'REFR, ACHR'; sBaseObject01 = 'PlayerHouse_Rug01 "Rug" [STAT:0004D1CD]'; sBaseObject02 = 'PlayerHouse_Rug02 "Rug" [STAT:0004D1CE]'; sBaseObject03 = 'PlayerHouse_KitchenCounter01 [STAT:00053253]'; Var sName: String; Function Process(e: IInterface): Integer; Begin If Pos(Signature(e), sValidSignatures) = 0 Then Exit; If GetIsDeleted(e) Then Exit; sName:= GetElementEditValues(e, 'NAME'); If SameText(sName, sBaseObject01) or SameText(sName, sBaseObject02) or SameText(sName, sBaseObject03) Then Begin AddMessage(' [X] Matching Record ==> [' + ShortName(e) + '] || For BaseName [' + sName + '].'); SetElementEditValues(e, 'DATA\Rotation\Z', iRotZ); End Else Begin AddMessage(' [ ] Non-matching Record ==> [' + ShortName(e) + '].'); End End; End. Commenting out the AddMessage lines speeds up the process. Link to comment Share on other sites More sharing options...
Recommended Posts