Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed Dec 12, 2018 1:22 pm

All times are UTC




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat Feb 18, 2012 2:53 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4538
Location: /home/sweden
TileLabels is a library that let you put signs in a scenario and then access the location of those tiles by their name. This library removes all the signs and keep them in memory for you so that players won't see them.

The library supports (and encourages) a prefix for these special signs. Signs that doesn't contain this prefix will be untouched.

For more information see the README.txt or download the library. Version 7 of the Beginner Tutorial will use this library, but there is also a simple example in the readme.

Download
Use in-game download or the bananas website

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Sat Jun 28, 2014 12:40 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Jan 18, 2014 6:10 pm
Posts: 1083
Hello,
I need advice, as game script beginner, how to change example from readme.txt, to iterate among many labels.
I want to read all labels and create list or array of tile id and parameters derived from label string.

_________________
My experimental openTTD server: 149.156.194.203:3979 non-standard client, now testing: JGRPP http://tiny.pl/ggnch
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, preindustrial houses, wired, ECS industry extension.
Addicted to freeciv longturn.


Top
   
PostPosted: Sun Jun 29, 2014 8:53 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4538
Location: /home/sweden
There is no such public function in this library. All it got is really the GetTile method that get the tile from a label string.

If you are adventures, you could neglect that you shouldn't deal with internal parts of an library and read the tile_table member yourself. However, it would be better to take a step back and ask yourself what questions do you like to ask to the list of all tiles and add a public method to this library for those questions. You cannot upload changes to the library, only I can, but you can submit me a patch or tell me what the questions are and hope that I have time to add that.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Mon Jun 30, 2014 12:20 pm 
Offline
Engineer
Engineer
User avatar

Joined: Mon Jun 30, 2014 11:56 am
Posts: 1
Code:
foreach( sign_name, tile_index in this.tile_labels.tile_table )
{
  //  sign_name type is string
  // tile_index type is TileIndex

  print( "name " + sign_name + "   tile " + tile_index )

}


Sign names must be unique,
function TileLabels::ReadFromMap line
local pre_part = sign_content.slice(0, this.prefix.len());

produces "Your script made an error: slice out of range"
if prefix is longer than shortest sign on map


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.