Check-boxes and arrays.

0 favourites
  • 1 posts
From the Asset Store
Over 2700 files with all the colour combinations from a 15 colours palette!
  • EDIT: I think I got it working on my own. But rather than leaving this to rot and remove any kind of usefullness, I shall explain how I got this working.

    Each checkbox has three variables. Type, Use, and Checked. Type is the group it is in, use is numbered 1-last counting up by ones, and checked is a Boolean to test if it has been checked or not.

    We have two arrays. One is full of the items we want to display or generate, called ITEMS, the second is a copy of the first one in terms of size, but holds Boolean values, called CANUSE.

    When we check the boxes we want and click "Generate", it will loop through the whole array of CANUSE, but check it's CurX and CurY values to the Type and Use of the checkboxes. If the Checkboxes Type and Use are equal to the array position it is at, then it sets its value to the boxes 'Checked' variable.

    Once the array is finished (checked by having a variable count up in the 'For Each Element' condition, then if the counter is equal to Width*Height of the array) it will run a While loop. This whole time, it randomizes a variable to how many checkboxes of that type there are. It uses this to randomly pick a value from the CANUSE array. When it finds a value that is equal to one, it will pull the equivalent from ITEMS and append it to the text, and stop the loop.

    Here is the event sheet:

    <img src="http://i48.tinypic.com/1673oi.png" border="0" />

    Also, the ==TYPE== and ==MATTER== thing is commented because they are for different groups.

    Whooo! Glad I got that sorted finally. I hope this can help someone having a similar issue!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)