How to ask for external layouts in custom extension

I have an extension I’m trying to make that will allow the user (me, for a specific project) to randomly generate a bunch of objects on top of a room object, based on external layouts that the user will create. I also want the ability to build new structures (flat-roofed buildings with each floor taken from an external layout), sort of like in a city-building-sim.

Theoretically, this would be done by assigning the external layout as a parameter, but I’ve figured out that parameters cannot be external layouts. Another problem is that you can’t create objects from an external layout at the theoretical position of an extension object (the room object).

How can I do this?

You could use a string parameter and pass the layout name as text.

Click the use an expression button

And then use the parameter’s name

If you used an idenfier parameter

then it would create an autocomplete dropdown list for the function action that uses the layout names from other uses of the function.

Here you can see that it gave 2 choices because I have 2 other actions to my test function that used them.

1 Like

I’ve actually figured it out: A random number will be generated between a customizable maximum number and 0, I assume, and that random number will be saved as another property of the room object type.

I have a condition unique to that object-type: checkLDecor, which checks whether or not lDRan(dom value) is equal to a customizable value, which will be used to link different values to different external layouts. However, the problem is that I don’t know how to do the events for that condition to request the value that lDRan might be,

If you’re talking about creating a condition for an extension then I’m a bit fuzzy. I haven’t created one in awhile.

I know you can create a condition with 2 parameters and then compare them inside the function and set the return value to true if the comparison is true.

I know that you can also set a function to a condition and expression but my memory is failing me on how to use it.

I think I figured out the condition and expression.

Instead of returning true like a normal condition, you return a value like the parameter itself.

It doesn’t create a condition but more of an expression like sin() or trunc(). You pass the function a value as a parameter then it returns the result. The comparator on the scene condition compares that value to the value in the value box.

You can add code with the function that modified the supplied value and then return the modified value. You then use the comparator to compare that new value to something.

I used to be able to do this, with getargumentasnumber, and the string variant, but I get the idea they actually removed that, and didn’t update the wiki. Or explain what the new way to do it was.

But then, their wiki for this has always sucked, and I’ve never done this in particular.

The wiki does say that GetArgumentAsNumber is now unecessary, but I think they misunderstood what GetArgumentAsNumber did and just removed it and replaced something else, maybe because that note is after their explanation of how to compare values regularly, like you’ve always been able to do, rather than prompting the user to enter a value.

I’m not sure what you’re referring to. They simplified the parameters just like the variables. The parameters show in the autocomplete.

While you can use the compare conditions, there are more conditions under the Event functions.