Jump to content

Recommended Posts

Posted

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.

Posted

SetElementEditValues(ref, 'DATA\Position\X', '538.55');

 

ref being the IInterface object returned by Add.

Posted

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.
Posted

Those things are nowhere documented, reading the code of other scripts, or deducing it.

Posted
  On 1/15/2023 at 10:31 AM, YouDoNotKnowMyName said:

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.

  • Recently Browsing   0 members

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