More region blocks.

DJEmergency

  • Posts: 170
When creating more than 1 region during runtime there is no way to differentiate/detect which region you want to test for. You can't add a region to a list, because you get an error. Also there doesn't exist a block to call it when you need to. So my solution would be to have two more blocks.

- Name last created region to [text]  (This allows you to name the region you just created)
- Region has name [text] (This allows you to call the region by name for detecting collision or for other uses.)

Justin

  • *
  • Posts: 4358

For Live Support: Join our discord server and ping me @justin.
I'm most often available between 8am and midnight Japan time. (GMT+9)

Justin

  • *
  • Posts: 4358
You shouldn't get an error when adding a region to a list, either. Post the error.

For Live Support: Join our discord server and ping me @justin.
I'm most often available between 8am and midnight Japan time. (GMT+9)

DJEmergency

  • Posts: 170
You shouldn't get an error when adding a region to a list, either. Post the error.

wait.. I made a mistake in the video

DJEmergency

  • Posts: 170
Here is the video with the error: https://www.dropbox.com/s/lo6oly6we3dci2f/Region%20stuff.mp4?dl=0

The main reason why a block for "region by name {text}" would benefit is so I can create unlimited regions without the limitation of creating attributes for each region.

Justin

  • *
  • Posts: 4358
Then use a map.

For Live Support: Join our discord server and ping me @justin.
I'm most often available between 8am and midnight Japan time. (GMT+9)

Justin

  • *
  • Posts: 4358
For the error:

Have you used the "set list to [create new list]" block before trying to add things to it?

And why are you trying to convert the region to text before adding it to the list?

(That's what it looks like anyway, it's hard to tell with the low quality video)

For Live Support: Join our discord server and ping me @justin.
I'm most often available between 8am and midnight Japan time. (GMT+9)

DJEmergency

  • Posts: 170
Then use a map.

Map spews this error:

Code: [Select]
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at scripts::Design_0_0_UltimateMenuSystem/init()[Source/scripts/Design_0_0_UltimateMenuSystem.hx:145]
at com.stencyl.behavior::Behavior/initScript()[/Applications/Stencyl-full/plaf/haxe/lib/stencyl/1,00/com/stencyl/behavior/Behavior.hx:97]
at com.stencyl.behavior::BehaviorManager/initScripts()[/Applications/Stencyl-full/plaf/haxe/lib/stencyl/1,00/com/stencyl/behavior/BehaviorManager.hx:105]
at com.stencyl::Engine$/initBehaviors()[/Applications/Stencyl-full/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:1096]
at com.stencyl::Engine/loadScene()[/Applications/Stencyl-full/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:967]
at com.stencyl::Engine/begin()[/Applications/Stencyl-full/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:788]
at com.stencyl::Engine()[/Applications/Stencyl-full/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:522]
at Universal/init()[/Applications/Stencyl-full/plaf/haxe/lib/stencyl/1,00/Universal.hx:88]
at Universal/onAdded()[/Applications/Stencyl-full/plaf/haxe/lib/stencyl/1,00/Universal.hx:67]
at flash.display::DisplayObjectContainer/addChild()
at Universal$/main()[/Applications/Stencyl-full/plaf/haxe/lib/stencyl/1,00/Universal.hx:586]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at Function/<anonymous>()
at ApplicationMain$/start()[Export/flash/haxe/ApplicationMain.hx:341]
at ApplicationMain$/init()[Export/flash/haxe/ApplicationMain.hx:259]
at lime.app::Event_Void_Void/dispatch()[/Applications/Stencyl-full/plaf/haxe/lib/lime/lime/lime/app/Event.hx:145]
at lime.app::Preloader/start()[/Applications/Stencyl-full/plaf/haxe/lib/lime/lime/lime/app/Preloader.hx:242]
at openfl.display::Preloader/display_onComplete()[/Applications/Stencyl-full/plaf/haxe/lib/openfl/openfl/openfl/display/Preloader.hx:129]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at scripts::StencylPreloader/onLoaded()[Source/scripts/StencylPreloader.hx:314]
at openfl.display::Preloader/start()[/Applications/Stencyl-full/plaf/haxe/lib/openfl/openfl/openfl/display/Preloader.hx:93]
at lime.app::Preloader/current_onEnter()[/Applications/Stencyl-full/plaf/haxe/lib/lime/lime/lime/app/Preloader.hx:310]

For the error:

Have you used the "set list to [create new list]" block before trying to add things to it?

And why are you trying to convert the region to text before adding it to the list?

(That's what it looks like anyway, it's hard to tell with the low quality video)

1. I can't find a "set list to [create new list]" block in the palette.
2. When using lists I need to use the "as text" block or I will get errors when exporting to other platforms.

« Last Edit: April 14, 2016, 05:27:53 pm by DJEmergency »

Justin

  • *
  • Posts: 4358
For the map error: Same thing. Use the create new map block.

http://www.stencyl.com/help/view/lists/ (see How to Create Lists: method 2)
http://www.stencyl.com/help/view/maps/ (see How to Create Maps: method 2)

You can use the search bar above the palette to search for the "create new list" and "create new map" blocks.

Quote
2. When I don't have it set as text I get errors when exporting it to other platforms while using lists and maps.
2. What errors are those?

For Live Support: Join our discord server and ping me @justin.
I'm most often available between 8am and midnight Japan time. (GMT+9)

DJEmergency

  • Posts: 170
For the map error: Same thing. Use the create new map block.

http://www.stencyl.com/help/view/lists/ (see How to Create Lists: method 2)
http://www.stencyl.com/help/view/maps/ (see How to Create Maps: method 2)

You can use the search bar above the palette to search for the "create new list" and "create new map" blocks.

Quote
2. When I don't have it set as text I get errors when exporting it to other platforms while using lists and maps.
2. What errors are those?

If I use a create list block inside a loop wouldn't that create a new list/map for every loop index?

Also I don't remember the errors but someone told me to use "as text" block, because there's an issue detecting actors in lists/maps on other platforms outside of flash and it worked.

DJEmergency

  • Posts: 170
Never mind. create new list worked if I put it at the top, but now how would I detect collision between the regions?

Justin

  • *
  • Posts: 4358
There are blocks for getting a regions x/y/width/height.

I don't know why you would want to detect collision between two regions though. Use sensor actors or something.

For Live Support: Join our discord server and ping me @justin.
I'm most often available between 8am and midnight Japan time. (GMT+9)

DJEmergency

  • Posts: 170
There are blocks for getting a regions x/y/width/height.

I don't know why you would want to detect collision between two regions though. Use sensor actors or something.

I'm working on a menu system behavior that works for all platforms. Touch, keyboards, and gamepads so I can reuse the code easily. With text (it depends on what is inputed) the region size will adjust accordingly. When I touch or mouse over a region I want to detect what region it is and compare it to the item number within a list so I can change the selection.

Example: Compare mouse over region to item within the list -> Set number attribute to item number and change font to selected item.