x


Adding elements to a script

Ok, this is a tricky one, let's see if I can explain it. I have a script that makes a wall of cubes. There's variations in which cube the comp decides to print, based on probability and specification. Whew. Basically, I have a "background" cube that consist of most of the grid. Then, there's a rarity color, which prints the math pattern, then, there's also the specific variation, which is a series of values to manually draw a 3d rectangle of cubes within the whole array, of yet a third color.

Did I lose you yet? Ok, so here's the question. How can I address the script to allow me to make "elements" in the editor, where each element is a specific mod? (a list of values)

more ▼

asked Dec 18 '11 at 08:14 PM

psychentist gravatar image

psychentist
209 4 10 14

Yes, hard to follow. Are you reaching for an answer about how to create arrays of custom classes and dynamically add items to them?

What do you mean by list of values and what do you mean by "elements" in the editor?

It sounds like you want to have an array in your script that you can edit in the Inspector, but I'm not sure.

Dec 18 '11 at 08:28 PM jahroy
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Turns out I needed an array of custom classes. Thx for your input guys. Jahroy had the right answer.

more ▼

answered Dec 21 '11 at 08:08 PM

psychentist gravatar image

psychentist
209 4 10 14

(comments are locked)
10|3000 characters needed characters left

I need the code itself to be flexible to the number of variables. I mean elements like the elements in the input manager. You can create a new "element". Each element is an array describing the input and how to interpret it. but the number of arrays is variable. The problem im having is that the code itself must change to accomodate different numbers of element. I'm trying to avoid

If elements =  1, do this.
If elements = 2, do that
... Ad infinatum...

Is that any clearer?

I need a function that will allow mw to create a variable, who's name is stored in a varable. It needs to be something like

Create an element, containing variables, who's names are (the value of varaible 1), (the value of variable 2,)... And insert   The following code into it.

// insert code here. `
more ▼

answered Dec 19 '11 at 06:29 PM

psychentist gravatar image

psychentist
209 4 10 14

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x13

asked: Dec 18 '11 at 08:14 PM

Seen: 340 times

Last Updated: Dec 21 '11 at 08:45 PM