Page 2 of 3

Re: Code Help

Posted: 02 Jul 2017, 19:50
by Barky
Not in pt, what do I do? Re-install it?

Re: Code Help

Posted: 02 Jul 2017, 19:52
by Lobby
Your code doesn't follow the syntax I suggested, which is crucial for multiple plugins within one file. There are basic rules in JSON you have to obey.

Radius -1 is not supported as it's a lot of effort to find a target building on the whole map. However you can use a big value (like 512) in case you want the whole map as target.

Most of your questions are answered somewhere in the documentation, don't expect people to be your search engine for free.

Re: Code Help

Posted: 02 Jul 2017, 20:05
by Barky
Ok,

I changed to

Code: Select all

[
{
car
}
]
[
{
building
}
]
[
{
road
{
[
And changed radius to 512, re downloaded it, still doesnt show up

Re: Code Help

Posted: 02 Jul 2017, 20:10
by Lobby
You haven't tried to put your code into https://jsonlint.com/ have you?

Re: Code Help

Posted: 02 Jul 2017, 20:14
by CommanderABab
Lobby wrote:
02 Jul 2017, 20:10
You haven't tried to put your code into https://jsonlint.com/ have you?
It's really helpful. It often pinpoints the (first) error at the line number in the code.

Re: Code Help

Posted: 02 Jul 2017, 20:16
by Barky
I did it and this came up but I dont know how to fix

Code: Select all

Error: Parse error on line 4:
...ar",	"frames": [		("bmp": "RallyCar.pn
---------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', ']', got 'undefined'
This is probaly obvious to you

Re: Code Help

Posted: 02 Jul 2017, 20:18
by Barky
Ok I didnt notice

This may not be new to you but it is to me, alright

Re: Code Help

Posted: 02 Jul 2017, 20:22
by CommanderABab
:space
1284.gif
1284.gif (23.51 KiB) Viewed 2379 times
:fire

Re: Code Help

Posted: 02 Jul 2017, 20:25
by Barky

Code: Select all

Error: Parse error on line 11:
...	}],	"v2": true}][{	"id": "$garage.r
--------------------^
Expecting 'EOF', '}', ',', ']', got '['
I dont understand why there is an error, the brackets are fine and I dont see anything rong with v2

Yes I know its probaly obvious or easy to understand but gimme a break :o

Re: Code Help

Posted: 02 Jul 2017, 20:30
by CommanderABab
Screenshot_20170702-135517.jpg
Expecting a comma, there between ][.

Re: Code Help

Posted: 02 Jul 2017, 20:31
by CommanderABab
V2 is just the start of the line.

Re: Code Help

Posted: 02 Jul 2017, 20:33
by Barky
But if I add comma all I get is

Code: Select all

Error: Parse error on line 11:
...	}],	"v2": true}], [{	"id": "$garage
--------------------^
Expecting 'EOF', got ','
It's confusing to me :(

Re: Code Help

Posted: 02 Jul 2017, 20:44
by Lobby
Lobby wrote:
02 Jul 2017, 17:59

Code: Select all

[
  {
    // Car
  },
  {
    // Building
  }
]
A JSON file can either contain a top level object {} or a top level array []. For plugins we use a top level array, therefore our base structure looks like

Code: Select all

[
...
]
Within this top level array we define objects separated by commas.

For this reason something like

Code: Select all

[
...
],
[
...
]
is not valid JSON syntax.

Re: Code Help

Posted: 02 Jul 2017, 20:51
by Barky
Thank you Lobby, I understand now!

Re: Code Help

Posted: 02 Jul 2017, 21:00
by Barky
Ok I am officially sick of this

JSONLint says it's valid
I see no problem

Wont work

Will I pm link or?

Re: Code Help

Posted: 02 Jul 2017, 21:03
by Barky

Code: Select all

[{
		"id": "Rallycar00",
		"type": "car",
		"frames": [{
			"bmp": "RallyCar.png",
			"w": 28,
			"h": 10,
			"count": 4
		}],
		"v2": true
	}, {
		"id": "$garage.rally.unique.id.dc00",
		"type": "sport",
		"author": "Barky",
		"text": "A small compund for your rally-kart, must be built next to track",
		"width": 1,
		"height": 1,
		"frames": [{
			"bmp": "RallyStation.png"
		}],
		"needs road": false,
		"price": 1000,
		"monthly price": 10,
		"car": "Rallycar00",
		"car radius": "512",
		"car count": "1"
	},
	{
		"id": "RallyTrack001",
		"type": "road",
		"flag user5": true,
		"flag normal": false,
		"author": "Barky",
		"text": "A track for your rallies!",
		"level": 1,
		"width": 1,
		"height": 1,
		"frames": [{
			"bmp": "RallyTrack.png",
			"w": 32,
			"h": 16,
			"count": 16
		}],
		"speed": 5.0,
		"price": 50,
		"monthly price": 5,
		"allow transfer": false,
		"connectable": false,
		"allow bus": false
	}
]
JSONLint says this is valid

Re: Code Help

Posted: 02 Jul 2017, 21:14
by Barky
Nope

Downloaded Zip
Unlocked Zip
Put it in plug in folder
Went in game
Nothing there

It doesnt crash or anything it doesnt show up in game or in "pt"
I will pm you a link

Re: Code Help

Posted: 02 Jul 2017, 21:16
by Barky
I sent you link in PM
See for yourself

Re: Code Help

Posted: 02 Jul 2017, 21:18
by Barky
facepalm

Thats how it saved automatically

Thanks :D

Re: Code Help

Posted: 02 Jul 2017, 21:30
by Barky
Well its finally in game, however it isnt spawning the kart

Am I missing something in code?
It should spawn then randomly go on the track