[Asked][1.10.08a] Plugin crash (code.json:1527)

Plugin specific problems will be solved here.

Moderator: Plugin Moderators

User avatar
TobyArch
Small-town resident
Reactions:
Posts: 33
Joined: 29 Sep 2021, 11:50
Location: Samutprakan/Thailand
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

[Asked][1.10.08a] Plugin crash (code.json:1527)

#1

Post by TobyArch »

Hi, I got the following error with a plugin (code.json:1527):

Code: Select all

In plugins/toby/code.json:

io.blueflower.stapel2d.util.json.JSONException: Names must be strings, but {"id":"$notify_test00","type":"notification","text":"Hi, I'm a test notification!","frames":[{"steal":"$anim_people_source09","frame":14}]} is of type io.blueflower.stapel2d.util.json.JSONObject at line 21, char 13. Excerpt: 
                "frames":[{"steal":"$anim_people_source09","frame":14}] 
            --ERROR->>>}

Full source: [
    {
        "id": "$pcw_803de05faed200",
        "type": "energy",
        "author": "Plugin creator website 3.0 & TobyArch",
        "width": 1,
        "height": 1,
        "frames": [
            {
                "bmp": "1x1 (1).png"
            }
        ],
        "smoke": [
      {"id": "$smoke02","x": 14,"y": -11}
        ],
            { 
                "id":"$notify_test00", 
                "type":"notification", 
                "text":"Hi, I'm a test notification!", 
                "frames":[{"steal":"$anim_people_source09","frame":14}] 
            }
        ],
        "title": "Generator tower",
        "text": "A 1×1 generator tower that act as power, water generator and waste incerator (be aware of pollution)",
        "price": 0,
        "power": 150000,
        "water": 250000,
        "influence waste disposal":140,
        "build time": 0,
        "influence noise": 3,
        "influence pollution": 5,
        "burnable": false,
        "need road": true,
        "destroyable": false,
        "removable": true,
        "pickable": true
    }
]
Device: SM-A325F (samsung)
OS version: 30

Thank you in advance.
User avatar
TobyArch
Small-town resident
Reactions:
Posts: 33
Joined: 29 Sep 2021, 11:50
Location: Samutprakan/Thailand
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: [Asked][1.10.08a] Plugin crash (code.json:1527)

#2

Post by TobyArch »

Reply right now
User avatar
Kulche
Pluche
Reactions:
Posts: 1141
Joined: 07 Jun 2017, 20:28
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: [Asked][1.10.08a] Plugin crash (code.json:1527)

#3

Post by Kulche »

I'm not sure what is the notification definition supposed to do?
This is not a properly formatted json - remove the notification part.
User avatar
Hadestia
Inhabitant of a Megalopolis
Reactions:
Posts: 727
Joined: 17 Jul 2017, 16:16
Location: Philippines
Plugins: Showcase Store
Contact:

Plugin Creator

Platform

Re: [Asked][1.10.08a] Plugin crash (code.json:1527)

#4

Post by Hadestia »

Notification frames✨
User avatar
CommanderABab
AB
Reactions:
Posts: 11080
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: [Asked][1.10.08a] Plugin crash (code.json:1527)

#5

Post by CommanderABab »

Code: Select all

[
  {
    "id":"$notify_test00",
    "type":"notification",
    "text":"Hi, I'm a test notification!",
    "frames":[{"steal":"$anim_people_source01","frame":14}]
  },
  {
    "id":"$notification_test_building00",
    "type":"decoration",
    "width":1,
    "height":1,
    "frames":[{"x":480,"y":0,"w":32,"h":16}],
    "on click fun":[
      {
        "actions":[{"type":"notify","id":"$notify_test00","z":1}]
      }
    ]
  }
]
Source: Lobby

This defines a notification and then displays it when the building is clicked using the action notify.
User avatar
CommanderABab
AB
Reactions:
Posts: 11080
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: [Asked][1.10.08a] Plugin crash (code.json:1527)

#6

Post by CommanderABab »

You can also ask a question in the notification which sets the global var with the name of the notification ID to 1, ( 0 otherwise) if the green check is clicked.

Code: Select all

{
    "id":"$notify_test00_",
    "type":"notification",
    "text":"Hi, I'm a test notification!",
    "frames":[{"steal":"$anim_people_source01","frame":14}],
    "question":true,
    "z":1,
    "ok fun":[{"actions":[{"type":"toast","id":"Ok"}]}],
    "cancel fun":[{"actions":[{"type":"toast","id":"Cancel"}]}]
  },
Source: Lobby

Note the question tag.
I believe the "z":1 statement provides the zoom to location feature.
Post Reply Previous topicNext topic

Return to “Problems”