Reading a .TXT file into a map -- format unclear in Stencylpedia

BMJ

  • Posts: 278
Please forgive me if I'm wrong, but The Stencylpedia article on maps doesn't seem to say what the proper format is for reading a TXT file into a map. (The list article, does, however). For maps, I tried:

Key=Value
DifferentKey=Value
MoreDifferentKey=Value
etc ...

... but no luck. What is the correct format? (I get an Array Index Out Of Bounds error, as shown below)

Java.lang.ArrayIndexOutOfBoundsException: 1
   at stencyl.sw.editors.behavior.MapEditor.actionPerformed(MapEditor.java:366)
   at stencyl.sw.actions.SAction.actionPerformed(SAction.java:120)
   at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
   at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
   at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
   at java.awt.Component.processMouseEvent(Unknown Source)
   at javax.swing.JComponent.processMouseEvent(Unknown Source)
   at java.awt.Component.processEvent(Unknown Source)
   at java.awt.Container.processEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Window.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$500(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue$4.run(Unknown Source)
   at java.awt.EventQueue$4.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)



Thanks. :)

mdotedot

  • Posts: 1569
Where did you find the format of reading into a TXT file from a List?
So far I know there is no block for it.

Please show us the blocks you use to try reading from a textfile.

My guess is that you need to split the line : http://gamedotdevelopment.blogspot.nl/2016/02/stencyl-reading-properties-from-text.html
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

letmethink

  • *
  • Posts: 2547
They are not using a block to do it, rather using it to populate the list in the first place from the attributes pane I believe when customising a behaviour.
~Letmethink

mdotedot

  • Posts: 1569
Oh .. Well then I let the developers pitch in. I don't have the source code of Stencyl.  :)
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

captaincomic

  • *
  • Posts: 6109
Fixed the error in 8993. It will print a warning in the logs if it can't parse a line. The format was key|value. I changed that to key=value, that's what I would have expected it to be as well.

BMJ

  • Posts: 278
Excellent, thank you Captaincomic for the fix (et all for the quick replies!) :)

EDIT: Yep. works perfectly now.

EDIT #2: Almost perfectly. (see below)

« Last Edit: February 07, 2016, 08:21:01 am by BMJ »

BMJ

  • Posts: 278
Actually -- it reads in correctly, but there still remains an issue with the delete (-) button. Sometimes, despite having selected a key/value in the attribute editor the 'delete' button will remain greyed out. (as shown in attached .png) If I keep clicking on different keys, eventually the delete button will become active and I can delete the key, if I want to.

captaincomic

  • *
  • Posts: 6109
Ok, I see, I can reproduce it when using the tab key to select something instead of the mouse. Or does it happen for you when clicking as well?