Cars & Roads: Flags

Learn here how to create and use plugins.

Moderator: KoalaGuy

User avatar
KoalaGuy
TheoTown Veteran
Reactions:
Posts: 5832
Joined: Mon Mar 06, 2017 21:45
Location: Pitcairn Islands
Plugins: Show
Version: Beta
Phone: SamsungGalaxyJ5 2017

Cars & Roads: Flags

Post by KoalaGuy » Mon Jun 05, 2017 15:29

Cars & Roads: Flags
In this thread, I will explain how does "flag" function work.
What are "flags"?
Flags are a plugin fuction used for roads and cars that define which car can go on which road.
How do I use "flags"?
Flags define which car can go on which road. Example: Military vehicles can only drive on military road.
To use them in a plugin, you must set which flag does your road or car have.
Here's how a road with user flag may look:

Code: Select all

[
   {  
     "id":"$example.road.01", 
     "type":"road", 
     "author":"Dusko",
     "flag user0":true,
     "flag normal":false,
     "level":1,
     "width":1,
     "height":1,
     "frames":[{"bmp":"road.png","w":32,"h":16,"count":16}], 
     "speed":2.0
  }
]
Only cars with "flag user0" can drive on this road. Setting "flag normal" to false doesn't allow normal (cars, trucks) to drive on this road.
Possible flags are:
flag normal (true by default)
flag military
flag pedestrian
flag tram
flag airport
flag user0
flag user1
flag user2
flag user3
flag user4
flag user5
flag user6
flag user7
flag user8
flag user9
————————————————————————
NOTE: "flag user(0-9)" are the best to use in plugins. You may also state that your plugin uses flag user(number) to avoid problems with other plugins.

Have fun with your roads! :D
My plugins will always be free, :bx to :bd
TheoTown Translator (Serbian)
Once Best Plugin Creator
(My plugins)
Contributor
Once top poster
Most reactions
Made some graphics for TheoTown
Made some smilies

User avatar
Lobby
Developer
Reactions:
Posts: 2583
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Post by Lobby » Mon Jun 05, 2017 15:31

Great, thank you :)

User avatar
KoalaGuy
TheoTown Veteran
Reactions:
Posts: 5832
Joined: Mon Mar 06, 2017 21:45
Location: Pitcairn Islands
Plugins: Show
Version: Beta
Phone: SamsungGalaxyJ5 2017

Post by KoalaGuy » Mon Jun 05, 2017 15:32

No problem, Lobby :)
My plugins will always be free, :bx to :bd
TheoTown Translator (Serbian)
Once Best Plugin Creator
(My plugins)
Contributor
Once top poster
Most reactions
Made some graphics for TheoTown
Made some smilies

User avatar
Lobby
Developer
Reactions:
Posts: 2583
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: Cars & Roads: Flags

Post by Lobby » Mon Aug 07, 2017 10:39

With version 330 you have to ability to allow only passenger cars/truck on your own roads using flags.

If only passenger cars should be allowed add:

Code: Select all

"flag normal":false,
"flag pkw":true
To allow trucks only use:

Code: Select all

"flag normal":false,
"flag lkw":true
You have to set flag normal to false as it's enabled by default and includes booth, passenger cars and trucks.
roadflags.png
roadflags.png (43.87 KiB) Viewed 834 times
Ensure to set these flags properly for your own cars in case you use car plugins. The code is the same as for roads.
...Have a nice stay

User avatar
Josh
Graphic designer
Reactions:
Posts: 2150
Joined: Sat Mar 11, 2017 19:20
Location: First tell your location...
Plugins: Show
Version: Beta

Re: Cars & Roads: Flags

Post by Josh » Mon Aug 07, 2017 10:48

Is it possible in future to have bus flags?
Good job Lobby!
Proud TheoTown player sinds update 1.1.50

Creator of Aldorria, Covinton Empire, West Country, Sunnydale

Save nature, before it kills you🌲

User avatar
Lobby
Developer
Reactions:
Posts: 2583
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: Cars & Roads: Flags

Post by Lobby » Mon Aug 07, 2017 10:55

Of course :)
...Have a nice stay

User avatar
CommanderABab
Inhabitant of a Universe
Reactions:
Posts: 4763
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Cars & Roads: Flags

Post by CommanderABab » Fri Aug 11, 2017 2:44

1l
410 :bp 410Currently using beta 410. 410 What's new? Your plugin can change weather! :)
ImageTelegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
CommanderABab
Inhabitant of a Universe
Reactions:
Posts: 4763
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Cars & Roads: Flags

Post by CommanderABab » Fri Aug 11, 2017 2:44

Code: Select all

"flag normal":false,
"flag lkw":true
"flag normal":false,
"flag lkw":true
410 :bp 410Currently using beta 410. 410 What's new? Your plugin can change weather! :)
ImageTelegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
CommanderABab
Inhabitant of a Universe
Reactions:
Posts: 4763
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Cars & Roads: Flags

Post by CommanderABab » Fri Aug 11, 2017 2:48

So, what does the l in lkw stand for?
410 :bp 410Currently using beta 410. 410 What's new? Your plugin can change weather! :)
ImageTelegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
Lobby
Developer
Reactions:
Posts: 2583
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: Cars & Roads: Flags

Post by Lobby » Fri Aug 11, 2017 16:25

LKW stands for Lastkraftwagen

Last means heavy things.
...Have a nice stay

User avatar
CommanderABab
Inhabitant of a Universe
Reactions:
Posts: 4763
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Cars & Roads: Flags

Post by CommanderABab » Fri Aug 11, 2017 18:06

Thanks!
410 :bp 410Currently using beta 410. 410 What's new? Your plugin can change weather! :)
ImageTelegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
JustAnyone
Inhabitant of a Planet
Reactions:
Posts: 1435
Joined: Sun Jul 23, 2017 12:45
Location: Space Station 478B
Plugins: Show
Version: Beta
Phone: Xiaomi Redmi 3s

Re: Cars & Roads: Flags

Post by JustAnyone » Fri Sep 22, 2017 6:45

Is it possible to add custom Flags to the cars?
President of Domkisas
Founder and owner of DSA
Official TheoTown discord manager
I will reply if someone says ANYONE
Developer of Plugin Creator.

User avatar
CommanderABab
Inhabitant of a Universe
Reactions:
Posts: 4763
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Cars & Roads: Flags

Post by CommanderABab » Fri Sep 22, 2017 7:34

User2 through user9
410 :bp 410Currently using beta 410. 410 What's new? Your plugin can change weather! :)
ImageTelegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
JustAnyone
Inhabitant of a Planet
Reactions:
Posts: 1435
Joined: Sun Jul 23, 2017 12:45
Location: Space Station 478B
Plugins: Show
Version: Beta
Phone: Xiaomi Redmi 3s

Re: Cars & Roads: Flags

Post by JustAnyone » Fri Sep 22, 2017 15:11

How do I make that my Custom cars Use The road? Anything at car spawner or somethin'?
President of Domkisas
Founder and owner of DSA
Official TheoTown discord manager
I will reply if someone says ANYONE
Developer of Plugin Creator.

User avatar
Lobby
Developer
Reactions:
Posts: 2583
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: Cars & Roads: Flags

Post by Lobby » Fri Sep 22, 2017 21:43

Set a flag (e.g. user7) in both, your road and your car plugin.
...Have a nice stay

User avatar
danekbel
Former danek_danevich
Reactions:
Posts: 2406
Joined: Thu May 05, 2016 9:33
Location: Ukraine
Plugins: Show
Version: Beta
Phone: Meizu M5

Re: Cars & Roads: Flags

Post by danekbel » Sat Nov 18, 2017 12:12

What's the flag for buses?
I used

Code: Select all

flag bus:false;
, but buses are still driving on the road
some text.

User avatar
JustAnyone
Inhabitant of a Planet
Reactions:
Posts: 1435
Joined: Sun Jul 23, 2017 12:45
Location: Space Station 478B
Plugins: Show
Version: Beta
Phone: Xiaomi Redmi 3s

Re: Cars & Roads: Flags

Post by JustAnyone » Sat Nov 18, 2017 12:17

danekbel wrote:
Sat Nov 18, 2017 12:12
What's the flag for buses?
I used

Code: Select all

flag bus:false;
, but buses are still driving on the road
Passenger I think.
President of Domkisas
Founder and owner of DSA
Official TheoTown discord manager
I will reply if someone says ANYONE
Developer of Plugin Creator.

User avatar
CommanderABab
Inhabitant of a Universe
Reactions:
Posts: 4763
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Cars & Roads: Flags

Post by CommanderABab » Sat Nov 18, 2017 12:35

Need quotes around flag bus.
410 :bp 410Currently using beta 410. 410 What's new? Your plugin can change weather! :)
ImageTelegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
danekbel
Former danek_danevich
Reactions:
Posts: 2406
Joined: Thu May 05, 2016 9:33
Location: Ukraine
Plugins: Show
Version: Beta
Phone: Meizu M5

Re: Cars & Roads: Flags

Post by danekbel » Sat Nov 18, 2017 12:38

CommanderABab wrote:
Sat Nov 18, 2017 12:35
Need quotes around flag bus.
¿?
Can you show an example please
some text.

User avatar
CommanderABab
Inhabitant of a Universe
Reactions:
Posts: 4763
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Cars & Roads: Flags

Post by CommanderABab » Sat Nov 18, 2017 12:43

No. I don't know if a flag bus exists. But if it did you would need

Code: Select all

"flag bus":false
to exclude buses.
410 :bp 410Currently using beta 410. 410 What's new? Your plugin can change weather! :)
ImageTelegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

Online
User avatar
22Alpha
Inhabitant of a Megacity
Reactions:
Posts: 303
Joined: Sat Sep 23, 2017 14:29

Re: Cars & Roads: Flags

Post by 22Alpha » Sat Nov 18, 2017 13:08

CommanderABab wrote:
Sat Nov 18, 2017 12:43
No. I don't know if a flag bus exists. But if it did you would need

Code: Select all

"flag bus":false
to exclude buses.
I tried that one, and the code was accepted. But I haven't kept an eye whether it works.
...I'M BATMAN
:bb

User avatar
CommanderABab
Inhabitant of a Universe
Reactions:
Posts: 4763
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Cars & Roads: Flags

Post by CommanderABab » Sat Nov 18, 2017 13:30

Lots of things are just ignored if they don't exist.
410 :bp 410Currently using beta 410. 410 What's new? Your plugin can change weather! :)
ImageTelegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
Lobby
Developer
Reactions:
Posts: 2583
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: Cars & Roads: Flags

Post by Lobby » Wed Nov 29, 2017 20:19

Yes, "flag bus":true exists :)
...Have a nice stay

User avatar
Lobby
Developer
Reactions:
Posts: 2583
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

[390]Custom flags

Post by Lobby » Wed Dec 13, 2017 12:40

Version 390 will allow you to reference to your own flags by name. To allocate a flag that's called "lobby_newflag you may just write :json

Code: Select all

"allocate flag":["lobby_newflag"]  // "allocate flag":"lobby_newflag would work, too
To use it, write :json

Code: Select all

"flag lobby_newflag":true
You should add the definition above to every plugin which uses it (redefinition is therefore explicitly allowed). Just ensure that your flag name is some kind of unique.

⚠There's a limit of 20 custom flags in total.
...Have a nice stay

User avatar
Matison55557
Inhabitant of a Universe
Reactions:
Posts: 4228
Joined: Mon Jul 04, 2016 18:49
Plugins: Show
Version: Beta
Phone: Huawei P9 lite mini

Re: Cars & Roads: Flags

Post by Matison55557 » Wed Dec 13, 2017 12:43

Too bad about the limit, but finally custom flags!
410410
    graph.org/telegraph
🔸5️⃣5️⃣5️⃣5️⃣7️⃣🔸

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest