Node.Exist...?

Technical questions, etc..
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Node.Exist...?

Post by trueBlue »

Question: How come this does not work?

Code: Select all

function Execute(params)
{
var Yes = System.Question("Would you like to install the customized Material Editor?")
if (Yes)
{
WindowsManager.CloseWindow("/Project/Windows Manager Space/MyLibraryFrame")
if (Node.Exists("/Material Editor/Material Editor/Vray Material Editor"))
Node.Delete("/Material Editor")
Node.Copy(System.ThisOwner() + "/ME_V/Material Editor", "/")
RsFileIO.SaveObject(System.GetMainDir() + '\\Scripts\\preobjects\\MaterialEditor.RsObj', System.ThisOwner() + "/ME_V/Material Editor")
MeshModifiers.OpenMaterialEditor()
System.Alert("The D3D Material Editor and Vray Material Editor have been installed.")
if (!Node.Exists("/Material Editor/Material Editor/Vray Material Editor"))
Node.Delete("/Material Editor")
Node.Copy(System.ThisOwner() + "/Material Editor", "/")
RsFileIO.SaveObject(System.GetMainDir() + '\\Scripts\\preobjects\\MaterialEditor.RsObj', System.ThisOwner() + "/Material Editor")
MeshModifiers.OpenMaterialEditor()
System.Alert("The Material Editor has been installed.")
}
}
Even though the Vray Material Editor does not exist the script still runs.
I've tried brackets inbetween the commands and also if else statements.
stan
Master Chief Petty Officer
Posts: 584
Joined: 21 May 2009, 17:20

Re: Node.Exist...?

Post by stan »

if(!Node.exist(...)) return
or something other that the same code for both.
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Node.Exist...?

Post by trueBlue »

I think I did not set up the Question script correctly.

Code: Select all

function Execute(params)
{

var Yes = System.Question("Test")
if (Yes)
{
//Insert code here

System.Alert("Yes")

//End code here
}
else
{
System.Alert("No")
}


}
Shell1850
Chief Petty Officer
Posts: 135
Joined: 21 May 2009, 21:44

Re: Node.Exist...?

Post by Shell1850 »

I was confused in your first program because I saw some redundancy in your program . I did not understand what you were doing. Your second post was very educational.

I know a few of us are interested in understand TS jscript. When you learn something new, could you create a challenge program script. Something that teaches a simple concept.
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Node.Exist...?

Post by trueBlue »

Shell1850 wrote:I was confused in your first program because I saw some redundancy in your program . I did not understand what you were doing. Your second post was very educational.

I know a few of us are interested in understand TS jscript. When you learn something new, could you create a challenge program script. Something that teaches a simple concept.
First program?
Redundancy?
Challenge program script?

Could you please explain the above 3 questions?
IE:What Program?

Thanks in advance!

Return to “TechForum”