Programmatically set a scene from a template scene

squeeb

  • Posts: 1617
i want to set up a  template scene  that has text input fields that can be saved.. i already did this using attributes, but i want to create a scene from the template scene when  a button is pressed, with blank text fields for new inputs. every time the button is pressed it sets up a new scene...and from the main page where the create new scene button is id like to add a button/link to the newly created scenes..
does what im trying to do make sense?  hard to explain in text haha.. any ideas?

gplar

  • Posts: 1115
Don´t think you can create a new scene (Stencyl scene) on the fly, but you could use a fixed scene and change the contents to make it look "new". If you store attributes for the content in a list of lists (comma separated, one for each scene) it should be possible to maintain and store several scenes. 
List of lists are, however, a bit of a tongue in cheek exercise. :-)
From your main scene you could then create buttons dynamically for each entry in the "scenes" list.

Justin

  • *
  • Posts: 4716
Well to be honest, I don't really understand what you're doing exactly, but maybe this will help.

http://community.stencyl.com/index.php/topic,45603.0.html

If that doesn't work, there might be something similar that can do what you want. If you use merrak's "Fast" extension, you can read the scene xml data yourself and pull any information you want from it, or do what I did and load only specific parts of the scene that you want with the functions in Engine.hx.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

JeffreyDriver

  • Posts: 2262
i want to set up a  template scene  that has text input fields that can be saved.. i already did this using attributes, but i want to create a scene from the template scene when  a button is pressed, with blank text fields for new inputs. every time the button is pressed it sets up a new scene...and from the main page where the create new scene button is id like to add a button/link to the newly created scenes..
does what im trying to do make sense?  hard to explain in text haha.. any ideas?

I'm not sure if this will be useful, but when I want to copy lots of stuff between scenes I stick all my code in an actor, then just create that actor (hidden of course) on every scene. This also means that any changes are global.

squeeb

  • Posts: 1617
Don´t think you can create a new scene (Stencyl scene) on the fly, but you could use a fixed scene and change the contents to make it look "new". If you store attributes for the content in a list of lists (comma separated, one for each scene) it should be possible to maintain and store several scenes. 
List of lists are, however, a bit of a tongue in cheek exercise. :-)
From your main scene you could then create buttons dynamically for each entry in the "scenes" list.
are you saying to have ONE scene with all the user text inputs blank.. the user then inputs text...then save the attributes of the scene ( user text inputs) ..have a button be added to the main selection scene when there is a new "scene" to be added.. then when you press the individual dynamically created buttons it loads the specified attributes to the text fields?  this creates simulated scenes?
if not.. is this a feasible task? how would i code the save and load for different attributes?
any documentation or examples of lists of lists?

ceosol

  • *
  • Posts: 2279
A game I am working on generates the scenes on the fly. Since it is made up of 4 parts and 15 possible for each part, 4 enemies and 10 background, that means ~2 million possible levels. However, the game only has one Stencyl scene that repeats.

Have the text inputs go into a list and then cycle through the list to make the scene.

squeeb

  • Posts: 1617
thank you @ceosol ill give that a try!  whats better? should i use lists or maps? or does it matter?

ceosol

  • *
  • Posts: 2279
I did mine with lists. So say you have a 10x10 scene - make a list with 100 values.

repeat 100 times
   set tile row: (remainder (current loop count/10)) col: (floor(current loop count/10)) using tileID: (get (current loop count) from list)

Just make sure your tile ID numbers are what get inserted into the list. Otherwise you need to make if statements associating values in the list to tile IDs