PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Tools/PathMaker.simba

http://github.com/Drags111/Reflection_Dev
Unknown | 206 lines | 190 code | 16 blank | 0 comment | 0 complexity | b3f06055e62550a25eddde31ad9f50ca MD5 | raw file
  1{
  2  The Reflection Include Path Maker - v0.1 ALPHA
  3                          -by Drags111
  4  This is a simple and easy to use Path Maker that
  5  will record the tiles you choose and print them
  6  out when you are done. Just run this script,
  7  login to your character, and start recording! It's
  8  that easy. Please let me know if you find any
  9  errors!
 10}
 11program PathMaker;
 12{$DEFINE SMART}
 13{$i srl\srl.scar}
 14{$i Reflection\Reflection.simba}
 15
 16const
 17
 18{---SMART Setup Constants---}
 19  WORLD = 35;
 20  MEMBERS = false;
 21  SIGNED = true;
 22{---------------------------}
 23
 24var
 25  pathMakerForm : TForm;
 26  TabControl1 : TPageControl;
 27  Label1 : TLabel;
 28  TileList : TListBox;
 29  DeleteButton, PrintButton: TButton;
 30  RecordButton : TButton;
 31  PathTab, PrintTab: TTabSheet;
 32  MyTile: TTile;
 33  TileCount: integer;
 34
 35procedure CreatePath(List: TListBox);
 36var
 37  Temp: string;
 38  i, t: integer;
 39begin
 40  Writeln('Creating path....');
 41  writeln('function LoadPath : TTileArray;');
 42  Writeln('begin');
 43  writeln('  SetLength(Result, '+ToStr(TileCount)+');');
 44  writeln('  Result := [');
 45  for i := 1 to TileCount-1 do
 46  begin
 47    Temp := Temp + List.Items[i-1]+', ';
 48    if((i mod 3) = 0)then
 49    begin
 50      Writeln('    '+Temp);
 51      Temp := '';
 52    end;
 53  end;
 54  Temp := Temp +List.Items[TileCount-1];
 55  writeln('    '+Temp);
 56  writeln('  ];');
 57  writeln('end;');
 58end;
 59
 60procedure OnClick(Sender : TObject);
 61var
 62  MyTile: TTile;
 63  ToAdd: String;
 64begin
 65  SmartSetupEx(Smart_Server, Smart_Members, Smart_Signed, Smart_SuperDetail);
 66  case sender of
 67    RecordButton: begin
 68          MyTile := R_GetMyPos;
 69          ToAdd := 'Point('+ToStr(MyTile.x)+', '+ToStr(MyTile.y)+')';
 70          TileList.Items.Append(ToAdd);
 71          Inc(TileCount);
 72        end;
 73    DeleteButton: begin
 74          TileList.Items.Delete(TileList.ItemIndex);
 75          Dec(TileCount);
 76        end;
 77    PrintButton:begin
 78          CreatePath(TileList);
 79    end;
 80  end;
 81end;
 82
 83procedure OpenForm;
 84begin
 85  pathMakerForm := CreateForm;
 86  with pathMakerForm do
 87  begin
 88    Left := 423;
 89    Top := 185;
 90    Width := 381;
 91    Height := 342;
 92    BorderIcons := [biSystemMenu, biMinimize];
 93    Caption := 'Reflection Path Maker';
 94    Color := clBtnFace;
 95    Font.Color := clWindowText;
 96    Font.Height := -11;
 97    Font.Name := 'MS Sans Serif';
 98    PixelsPerInch := 96;
 99    BorderStyle := bsSingle;
100  end;
101
102  TabControl1 := TPageControl.Create(pathMakerForm);
103  with TabControl1 do
104  begin
105    Parent := pathMakerForm;
106    Left := 24;
107    Top := 16;
108    Width := 333;
109    Height := 305;
110  end;
111
112  PathTab := TTabSheet.Create(pathMakerForm);
113  with PathTab do
114  begin
115    PageControl := TabControl1;
116    Caption := 'Path Maker';
117  end;
118  {PathTab}
119    Label1 := TLabel.Create(TabControl1);
120    with Label1 do
121    begin
122      Parent := PathTab;
123      Left := 16;
124      Top := 12;
125      Width := 50;
126      Height := 18;
127      Caption := '[Tiles]';
128      Font.Color := clMaroon;
129      Font.Height := -15;
130      Font.Name := 'Tahoma';
131      Font.Style := [fsBold];
132      ParentFont := False;
133    end;
134
135    TileList := TListBox.Create(TabControl1);
136    with TileList do
137    begin
138      Parent := PathTab;
139      Left := 16;
140      Top := 36;
141      Width := 293;
142      Height := 201;
143      Font.Color := clBlack;
144      Font.Height := -15;
145      Font.Name := 'Tahoma';
146      Font.Style := [];
147      ItemHeight := 18;
148      ParentFont := False;
149      TabOrder := 0;
150    end;
151
152    DeleteButton := TButton.Create(TabControl1);
153    with DeleteButton do
154    begin
155      Parent := PathTab;
156      Left := 220;
157      Top := 244;
158      Width := 91;
159      Height := 25;
160      OnClick := @OnClick;
161      Caption := 'Delete Selected';
162      TabOrder := 1;
163    end;
164
165    RecordButton := TButton.Create(TabControl1);
166    with RecordButton do
167    begin
168      Parent := PathTab;
169      Left := 140;
170      Top := 244;
171      Width := 75;
172      Height := 25;
173      Caption := 'Record!';
174      OnClick := @OnClick;
175      TabOrder := 2;
176    end;
177
178    PrintButton := TButton.Create(TabControl1);
179    with PrintButton do
180    begin
181      Parent := PathTab;
182      Left := 60;
183      Top := 244;
184      Width := 75;
185      Height := 25;
186      Caption := 'Print!';
187      OnClick := @OnClick;
188      TabOrder := 2;
189    end;
190
191  pathMakerForm.ShowModal;
192  pathMakerForm.Free;
193end;
194
195var
196  v : TVariantArray;
197
198begin
199  Smart_Members := MEMBERS;
200  Smart_Server := WORLD;
201  Smart_Signed := SIGNED;
202
203  SetupReflection;
204  Writeln(R_GetMyPos);
205  ThreadSafeCall('OpenForm',v);
206end.