Page 1 of 3

Code Help

Posted: 02 Jul 2017, 17:34
by Barky

Code: Select all

[
    {
	 "id":"$garage.rally.unique.id.dc00",
	 "type":"decoration",
	 "author":"Barky",
	 "width":1,
	 "height":1,
	 "frames":[{"bmp":"RallyStation.png"}],
	 "needs road" false
	 "needs water" true
	 "price" 1000T
	 "monthly price" 10T
	 }
]
Now this is my first time, I've written this on Notepad++ and I'm pretty sure its incorrect, I will add more just wnt to check if this is right?

Re: Code Help

Posted: 02 Jul 2017, 17:45
by Josh
Did you forget the : at the end?

Re: Code Help

Posted: 02 Jul 2017, 17:50
by Barky
So other than that its ok?

Re: Code Help

Posted: 02 Jul 2017, 17:53
by Barky

Code: Select all

[
    {
	 "id":"$garage.rally.unique.id.dc00",
	 "type":"decoration",
	 "author":"Barky",
	 "width":1,
	 "height":1,
	 "frames":[{"bmp":"RallyStation.png"}],
	 "needs road":false,
	 "needs water":true,
	 "price":1000,
	 "monthly price":10,
	}
]
Better?

Re: Code Help

Posted: 02 Jul 2017, 17:55
by Barky
Ok and I want it to spawn cars, so I write the seperate code for car then add it here. But where do I put the json for car hen done?

Re: Code Help

Posted: 02 Jul 2017, 17:59
by Lobby
JSON is standardized, so you can check for example here whether it's valid JSON code.

TheoTown won't accept invalid JSON code, so it's useful to check the code first with such tools.

About your car, I recommend to define it within the same JSON file so you can ensure that it's defined first (which is necessary, otherwise you cannot reference to it). May look like

Code: Select all

[
  {
    // Car
  },
  {
    // Building
  }
]

Re: Code Help

Posted: 02 Jul 2017, 18:00
by CommanderABab

Code: Select all

[
    {
	 "id":"$garage.rally.unique.id.dc00",
	 "type":"decoration",
	 "author":"Barky",
	 "width":1,
	 "height":1,
	 "frames":[{"bmp":"RallyStation.png"}],
	 "needs road" :false,
	 //"needs water": true, //unless you want it on shoreline
	 "price" :1000,//very expensive decoration!
	 "monthly price" :10
	 }
]

Re: Code Help

Posted: 02 Jul 2017, 18:03
by Barky
Thanks Lobby

Commander it is supposed to spawn go karts which are expensive :P
Does needs water mean water as in pipes?

Re: Code Help

Posted: 02 Jul 2017, 18:05
by CommanderABab
No, "needs water" means at least one tile needs to be on water.

Re: Code Help

Posted: 02 Jul 2017, 18:09
by Barky

Code: Select all

[
    {
	"id":"Rallycar00",
	"type":"car",
	"frames":[
	("bmp":"RallyCar.png","w":,"h":,"count":}//what is height and width of go kart?//
	],
	"v2":true
	}
]






[
    {
	 "id":"$garage.rally.unique.id.dc00",
	 "type":"decoration",
	 "author":"Barky",
	 "width":1,
	 "height":1,
	 "frames":[{"bmp":"RallyStation.png"}],
	 "needs road":false,
	  "price":1000,
	 "monthly price":10
	}
]

Re: Code Help

Posted: 02 Jul 2017, 18:16
by Barky
And I know I need to add code for car to spawn, just checking that car code is ok and want to know heigh and width

Re: Code Help

Posted: 02 Jul 2017, 18:19
by Barky
It says in tutorial about heigh and width

Its just the standard go kart image except only 1 type (only red, no other colours)

Re: Code Help

Posted: 02 Jul 2017, 18:19
by Barky
RallyCar.png
RallyCar.png (407 Bytes) Viewed 3669 times

Re: Code Help

Posted: 02 Jul 2017, 18:24
by Barky

Code: Select all

[
    {
	"id":"Rallycar00",
	"type":"car",
	"frames":[
	("bmp":"RallyCar.png","w":,"h":,"count":}
	],
	"v2":true
	}
]


[
    {
	 "id":"$garage.rally.unique.id.dc00",
	 "type":"decoration",
	 "author":"Barky",
	 "width":1,
	 "height":1,
	 "frames":[{"bmp":"RallyStation.png"}],
	 "needs road":false,
	 "price":1000,
	 "monthly price":10
	 "car":"Rallycar00",
	 "car radius":"-1",
	 "car count":"1"
	}
]
If I put radius -1 will that make it go as far as it wants?
Whats the width and height of go karts?

Re: Code Help

Posted: 02 Jul 2017, 18:36
by Barky

Code: Select all

[
    {
	"id":"Rallycar00",
	"type":"car",
	"frames":[
	("bmp":"RallyCar.png","w":,"h":,"count":}
	],
	"v2":true
	}
]

[
    {
	"id":"RallyTrack001",
	"type":"road",
	"flag user5":true,
	"flag normal":false
	"author":"Barky",
	"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
	}
]

[
    {
	 "id":"$garage.rally.unique.id.dc00",
	 "type":"decoration",
	 "author":"Barky",
	 "width":1,
	 "height":1,
	 "frames":[{"bmp":"RallyStation.png"}],
	 "needs road":false,
	 "price":1000,
	 "monthly price":10
	 "car":"Rallycar00",
	 "car radius":"-1",
	 "car count":"1"
	}
]
Added the road code, somebody please answer my previous questions

Re: Code Help

Posted: 02 Jul 2017, 18:57
by CommanderABab
W and h depend on the image which looks like?. Count would be 4.

Re: Code Help

Posted: 02 Jul 2017, 19:35
by Barky
UI downloaded it but it isn't showing up in game
Also how do I add description and will my code make it only go on the rally track?

Re: Code Help

Posted: 02 Jul 2017, 19:40
by Barky
Yes I was jsut asking,

What about it not showing up in game?

Re: Code Help

Posted: 02 Jul 2017, 19:44
by Barky
Well I asked if that made it go as far as it wants and got no answer :?

And even then shouldnt road show up?

Re: Code Help

Posted: 02 Jul 2017, 19:48
by Barky

Code: Select all

[
    {
	"id":"Rallycar00",
	"type":"car",
	"frames":[
	("bmp":"RallyCar.png","w":28:,"h":10,"count":4}
	],
	"v2":true
	}
]

[
    {
	"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
	}
]

[
    {
	 "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":"1000",
	 "car count":"1"
	}
]
Ok,
Will this spawn a single rally car if the garage is built beside the track?
Will only the rally car use the track?
Will the rally car not go on any track?
Will the track be in road section and garage in sport?
Is everything correct?