# RSTranslator This file is responsible for conversions or internal RuneScape values to values that can be used by Simba and back. - - - (TRSTranslator)= ## type TRSTranslator ```pascal type TRSTranslator = record TileSize, TileArea, MaxHeight, Planes: UInt32; RSMap, Map: record ChunkSide: UInt32; Dimensions: TPoint; Scope: TBox; end; end; ``` This file is responsible for conversions or internal RuneScape values to values that can be used by Simba and back. - - - ## RSTranslator.Setup ```pascal procedure TRSTranslator.Setup(); ``` Internal method automatically called when a script runs. This sets up variables for that the `TRSTranslator` relies on. - - - ## RSTranslator.RSWidth ```pascal function TRSTranslator.RSWidth(): Int32; constref; ``` Returns the full width in "chunks" of the OldSchool RuneScape map. Example: ```pascal WriteLn RSTranslator.RSWidth(); ``` - - - ## RSTranslator.RSHeight ```pascal function TRSTranslator.RSHeight(): Int32; constref; ``` Returns the full height in "chunks" of the OldSchool RuneScape map. Example: ```pascal WriteLn RSTranslator.RSWidth(); ``` - - - ## RSTranslator.MapWidth ```pascal function TRSTranslator.MapWidth(): UInt32; constref; ``` Returns the full width in pixels of the OldSchool RuneScape map. Example: ```pascal WriteLn RSTranslator.MapWidth(); ``` - - - ## RSTranslator.MapHeight ```pascal function TRSTranslator.MapHeight(): Int32; constref; ``` Returns the full height in pixels of the OldSchool RuneScape map. Example: ```pascal WriteLn RSTranslator.MapHeight(); ``` - - - ## RSTranslator.RSArea ```pascal function TRSTranslator.RSArea(): UInt32; constref; ``` Returns the area of the OldSchool RuneScape map measured in chunks. Example: ```pascal WriteLn RSTranslator.RSArea(); ``` - - - ## RSTranslator.MapArea ```pascal function TRSTranslator.MapArea(): UInt32; constref; ``` Returns the area of the OldSchool RuneScape map measured in pixels. Example: ```pascal WriteLn RSTranslator.MapArea(); ``` - - - ## RSTranslator.RSCoordinate2Chunk ```pascal function TRSTranslator.RSCoordinate2Chunk(p: TPoint): TPoint; ``` Returns the chunk number or a RuneScape coordinate as a TPoint. Example: ```pascal WriteLn RSTranslator.RSCoordinate2Chunk(Point(2000, 2000)); ``` - - - ## RSTranslator.Global2Chunk ```pascal function TRSTranslator.Global2Chunk(p: TPoint): TPoint; function TRSTranslator.Global2Chunk(b: TBox): TBox; overload; ``` Converts a "Global" coordinate to a chunk number. Example: ```pascal WriteLn RSTranslator.Global2Chunk(Point(2000, 2000)); ``` - - - ## RSTranslator.Chunk2RSCoordinate ```pascal function TRSTranslator.Chunk2RSCoordinate(p: TPoint): TPoint; ``` Converts a "Chunk" number to the top left RS coordinate of that chunk. Example: ```pascal WriteLn RSTranslator.Chunk2RSCoordinate(Point(53, 50)); ``` - - - ## RSTranslator.Chunk2Coordinate ```pascal function TRSTranslator.Chunk2Coordinate(p: TPoint): TPoint; function TRSTranslator.Chunk2Coordinate(b: TBox): TBox; overload; ``` Converts a "Chunk" number to the top left "Global" coordinate of that chunk. Example: ```pascal WriteLn RSTranslator.Chunk2Coordinate(Point(53, 50)); ``` - - - ## RSTranslator.Coordinate2RSCoordinate ```pascal function TRSTranslator.Coordinate2RSCoordinate(p: TPoint): TPoint; ``` Converts a "Global" coordinate into a "RuneScape" coordinate. Example: ```pascal WriteLn RSTranslator.Coordinate2RSCoordinate(Point(4000, 35000)); ``` - - - ## RSTranslator.RSCoordinate2Coordinate ```pascal function TRSTranslator.RSCoordinate2Coordinate(p: TPoint): TPoint; ``` Converts a "RuneScape" coordinate into a "Global" coordinate. Example: ```pascal WriteLn RSTranslator.RSCoordinate2Coordinate(Point(2000, 2000)); ```