Jump to content

OTL sop paths and Expressions tip


Recommended Posts

The problem :

Give the user the ability to pick a sop from an otl to use as the basis of instancing.

Allow the user to also put expressions in the path

I was looking through the forum at various ways to solve this problem, and what came up most was the

evals(chsraw("../somenode..")) method.

now perhaps my implementation was wrong, but it seemed like I could not get this expression working if it was a straight string that pointed at a sop, but it worked if my otl level path was something like :

Worked :

"/obj/firehydrant_"+($PT%2+1)

Did Not Work :

/obj/firehydrant

I could get it working for either method but not both.

The Solution was to create a switch node and use the following expression in it :

if(opexist(chs("../regular_path/instancepath")), 1, 2)

I added an empty add node to it, as a trick to keep the switch from erroring out.

What the expression does is just look at the path and see if it can find the sop (is it a direct path) if it can't it assumes that the input is an expression and tries the 3rd input which evaluates the path with : evals(chsraw("../instanced_Geo"))

If I am doing this wrong, please let me know.

If this help then I am glad I shared it.

Cheers,

Ali

post-522-0-54320300-1364926957_thumb.jpg

post-522-0-45471500-1364926991_thumb.jpg

post-522-0-59668600-1364927161_thumb.jpg

post-522-0-75824200-1364927317_thumb.jpg

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...