DEADSOFTWARE

Clean module Mobs for reimplementation mobs
[cavecraft.git] / src / console.pas
1 unit console;
3 interface
4 const
5 version = 'BETA 9 DEV B12';
7 var
8 osadki:boolean;
9 bl_upd:integer;
10 s_get_drp:boolean;
11 particle_upd:boolean;
12 drw_back:boolean;
13 drw_sm:boolean;
14 s_max_fps:integer;
15 s_jpeg_quality:integer;
16 drawgui:boolean;
17 light_type:integer;
19 ifosad:boolean;
20 //s_particles:boolean; - module
22 load_sm:integer;
23 load_sky_siz:integer;
24 load_back_tex:boolean;
25 load_weather_tex:boolean;
26 load_particles_tex:boolean;
27 load_light_tex:boolean;
28 load_gui_tex:boolean;
30 menu_background:integer;
32 load_minimap_tex:boolean;
34 //load_key_tex:integer;
36 drw_stars:boolean;
38 cheats:boolean;
40 sd:string;
42 EOFstr, ENDstr:boolean;
43 //max_particles:integer; - module
45 procedure save_settings;
46 procedure load_settings;
47 procedure call_console;
48 procedure exec(s, search:string);
49 procedure addToLog(str:string);
51 implementation
52 uses keyboard,particles_store,vars,maps,items,canvas,mobs,worldgen,jsr75i,particles,func, player,sensor, drop, inv, furnace, items_store, video;
53 const
54 CON_LOG_SIZE=9;
55 PARSER_MAX_STR=15;
56 MAX_IMGREG=2;
57 var
58 logSTR: array [0..CON_LOG_SIZE] of string;
59 lastCommand:string;
61 parseStr:string;
63 stack: array [0..0] of integer;
64 stack_pointer:integer;
66 regimg:image;
68 procedure resetStack(size:integer);
69 begin
70 stack_pointer:=0;
71 size:=size+1;
72 bytecode
73 iload 0;
74 newarray 10;
75 putstatic field 'console', 'stack', '[I';
76 end;
77 end;
79 procedure pushStack(i:integer;);
80 begin
81 stack[stack_pointer]:=i;
82 stack_pointer:=stack_pointer+1;
83 end;
85 function popStack:integer;
86 begin
87 stack_pointer:=stack_pointer-1;
88 popStack:=stack[stack_pointer];
89 end;
91 procedure swapStack;
92 var
93 tmp:integer;
94 begin
95 tmp:=stack[stack_pointer-2];
96 stack[stack_pointer-2]:=stack[stack_pointer-1];
97 stack[stack_pointer-1]:=tmp;
98 end;
100 procedure dupStack;
101 begin
102 stack[stack_pointer]:=stack[stack_pointer-1];
103 stack_pointer:=stack_pointer+1;
104 end;
106 procedure resetTmpImg;
107 var
108 nullimg:image;
109 begin
110 regimg:=nullimg;
111 end;
113 procedure addToLog(str:string);
114 var
115 i:integer;
116 begin
117 debug('::'+str);
118 for i:=CON_LOG_SIZE-1 downto 0 do
119 logSTR[i+1]:=logSTR[i];
120 logSTR[0]:=str;
121 end;
123 procedure setTexture(img:image; name:string; i:integer);
124 begin
125 name:=UpCase(name);
126 if name='BLOCK' then
127 begin
128 tex[i]:=img;
129 tex8[i]:=resize_image(img, 8, 8);
130 end;
131 else
132 if name='ITEM' then
133 begin
134 item[i]:=img;
135 item8[i]:=resize_image(img, 8, 8);
136 end;
137 else
138 if name='VKEY' then
139 setVkeyImg(img, i);
140 else
141 addToLog('Error: unknown texture type "'+name+'"');
142 end;
144 procedure save_settings;
145 var
146 rs:recordstore;
147 t:integer;
148 begin
149 deleteRecordStore('S');
150 rs:=openRecordStore('S');
151 t:=addRecordStoreEntry(rs,version);
152 t:=addRecordStoreEntry(rs,''+light_type);
153 t:=addRecordStoreEntry(rs,''+ifosad);
154 t:=addRecordStoreEntry(rs,''+s_particles);
155 t:=addRecordStoreEntry(rs,''+drawgui);
156 t:=addRecordStoreEntry(rs,''+s_jpeg_quality);
157 t:=addRecordStoreEntry(rs,''+load_key_tex);
158 closeRecordStore(rs);
159 end;
161 function sett_ld_bool(s:string):boolean;
162 begin
163 if s='true' then sett_ld_bool:=true;
164 end;
166 procedure load_settings;
167 var
168 rs:recordstore;
169 begin
170 rs:=openRecordStore('S');
171 if readRecordStoreEntry(rs,1)<>version then
172 begin
173 debug(readRecordStoreEntry(rs,1));
174 closeRecordStore(rs);
175 exit;
176 end;
177 light_type:=stringtointeger(readRecordStoreEntry(rs,2));
178 ifosad:=sett_ld_bool(readRecordStoreEntry(rs,3));
179 s_particles:=sett_ld_bool(readRecordStoreEntry(rs,4));
180 drawgui:=sett_ld_bool(readRecordStoreEntry(rs,5));
181 s_jpeg_quality:=stringtointeger(readRecordStoreEntry(rs,6));
182 load_key_tex:=stringtointeger(readRecordStoreEntry(rs,7));
183 closeRecordStore(rs);
184 end;
186 function isEOS(c:integer):boolean;
187 var
188 ch:char;
189 begin
190 ch:=chr(c);
191 if (ch=#$0A) or (ch=#$0D) then
192 isEOS:=true;
193 end;
195 function isSpace(c:integer;):boolean;
196 var
197 ch:char;
198 begin
199 ch:=chr(c);
200 if ((ch=' ') or (ch=#$09) or (ch=#$0B) or isEOS(c)) then
201 isSpace:=true;
202 end;
204 function nextByte(res:resource):integer;
205 var
206 i:integer;
207 begin
208 i:=ReadByte(res);
209 if i=EOF then
210 EOFstr:=true;
211 if isEOS(i) then
212 ENDstr:=true;
214 nextByte:=i and $FF;
215 end;
217 function ReadString(res:resource):string;
218 var
219 b:integer;
220 tmpstr:string;
221 begin
222 ENDstr:=false;
223 repeat
224 b:=nextByte(res);
225 if EOFstr or ENDstr then
226 break;
228 tmpstr:=tmpstr+chr(b);
229 forever;
230 ReadString:=tmpstr;
231 end;
233 function nextChar:integer;
234 var
235 i:integer;
236 begin
237 ENDstr:=false;
238 if length(parseStr)>0 then
239 begin
240 i:=ord(getChar(parseStr, 0));
241 parseStr:=copy(parseStr, 1, length(parseStr));
242 if isEOS(i) then
243 ENDstr:=true;
244 end;
245 else
246 begin
247 parseStr:='';
248 ENDstr:=true;
249 end;
251 nextChar:=i;
252 end;
254 procedure clearSpaces;
255 var
256 i:integer;
257 begin
258 repeat
259 i:=nextChar;
260 if ENDstr then
261 exit;
263 {Symbol ';' is one line commentary}
264 if i=$3B then
265 begin
266 repeat
267 i:=nextChar;
268 if ENDstr then
269 exit;
270 forever;
271 end;
273 if isSpace(i)=false then
274 begin
275 //Go back
276 parseStr:=chr(i)+parseStr;
277 exit;
278 end;
279 forever;
280 end;
282 function nextWord:string;
283 var
284 str:string;
285 i:integer;
286 begin
287 ENDstr:=false;
288 clearSpaces;
289 repeat
290 i:=nextChar;
292 if ENDstr then
293 begin
294 nextWord:=str;
295 exit;
296 end;
298 if isSpace(i) then
299 begin
300 //Go back
301 parseStr:=chr(i)+parseStr;
302 nextWord:=str;
303 exit;
304 end;
305 else
306 str:=str+chr(i);
307 forever;
308 end;
310 function strToBool(str:string):boolean;
311 begin
312 str:=UpCase(str);
313 if str='TRUE' then
314 strToBool:=true;
315 else
316 if str='FALSE' then
317 strToBool:=true;
318 else
319 if StringToInteger(str)<>0 then
320 strToBool:=true;
321 else
322 strToBool:=false;
323 end;
325 //Перевод строки в целое число. base - система счисления
326 function Str2Dec(str:string; base:integer;):integer;
327 var
328 i, tmp, res:integer;
329 ch:char;
330 neg:boolean;
331 begin
332 str:=UpCase(str);
333 if GetChar(str, 0)='-' then
334 begin
335 neg:=true;
336 i:=i+1;
337 end;
339 for i:=i to length(str)-1 do
340 begin
341 ch:=GetChar(str, i);
342 if ((ch>='0') and (ch<='9')) then
343 tmp:=ord(ch)-$30;
344 else
345 if ((ch>='A') and (ch<=chr($36+base))) then
346 tmp:=ord(ch)-$37;
347 else
348 begin
349 addToLog('Error! I cant decode "'+str+'" -> "'+ch+'"');
350 Str2Dec:=0;
351 exit;
352 end;
354 res:=res*base+tmp;
355 end;
357 if neg then
358 Str2Dec:=-res;
359 else
360 Str2Dec:=res;
361 end;
363 function getVar(name:string):integer;
364 begin
365 name:=UpCase(name);
367 if name='SCREEN_W' then
368 getVar:=getWidth;
369 else
370 if name='SCREEN_H' then
371 getVar:=getHeight;
372 else
373 addToLog('Unknown variable "'+name+'"');
374 end;
376 procedure setVar(name:string; value:integer);
377 begin
378 name:=UpCase(name);
380 addToLog('I cant set variable "'+name+'"');
381 end;
383 function DecodeInt(str:string):integer;
384 var
385 head:char;
386 num:string;
387 begin
388 if str='' then
389 begin
390 addToLog('DecodeInt getted null string!');
391 DecodeInt:=0;
392 exit;
393 end;
395 str:=UpCase(str);
396 head:=getchar(str, 0);
397 num:=copy(str, 1, length(str));
399 if str='TRUE' then
400 DecodeInt:=1;
401 else
402 if str='FALSE' then
403 DecodeInt:=0;
404 else
405 if str='POP' then
406 DecodeInt:=popStack;
407 else
408 if head='$' then
409 DecodeInt:=getVar(num);
410 else
411 if (head='0') and (getchar(str, 1)='X') then
412 begin
413 DecodeInt:=Str2Dec(copy(str, 2, length(str)), 16);
414 end;
415 else
416 if (head='0') and (length(str)>1) then
417 begin
418 DecodeInt:=Str2Dec(num, 8);
419 end;
420 else
421 if head='B' then
422 begin
423 DecodeInt:=Str2Dec(num, 2);
424 end;
425 else
426 if ((head>='0') and (head<='9')) or (head='-') then
427 begin
428 DecodeInt:=Str2Dec(str, 10);
430 end;
431 else
432 addToLog('Error! I cant decode "'+str+'"');
433 end;
435 procedure exeCommand(str:string);
436 var
437 com, tmp, tmp2:string;
438 i:integer;
439 begin
440 parseStr:=str;
441 clearSpaces;
442 if parseStr='' then
443 exit;
445 com:=UpCase(nextWord);
447 if (cheats) or (gamemode=1) then
448 begin
449 if com='TIME' then
450 game_time:=decodeInt(nextWord);
451 else
452 if com='FLY' then
453 fly:=strToBool(nextWord);
454 else
455 if com='PL_HP' then
456 hp:=decodeInt(nextWord);
457 else
458 if com='PL_EP' then
459 hunger:=decodeInt(nextWord);
460 else
461 if com='GIVE' then
462 player.dropItem(decodeInt(nextWord), decodeInt(nextWord));
463 else
464 if com='PL_TP' then
465 begin
466 player.setX(decodeInt(nextWord));
467 player.setY(decodeInt(nextWord));
468 end;
469 else
470 if com='GAMEMODE' then
471 begin
472 gamemode:=decodeInt(nextWord);
473 fly:=false;
474 end;
475 else
476 if com='SPAWN' then
477 begin
478 player.setX(get_spawn_x*16+4);
479 player.setY(get_spawn_y*16);
480 end;
481 else
482 {if com='SPAWN_MOBS' then
483 s_spawn_mob:=strToBool(nextWord);
484 else}
485 {if com='SURVIVAL' then
486 begin
487 fly:=false;
488 gamemode:=0;
489 hp:=20;
490 hunger:=20;
491 for i:=0 to 35 do
492 begin
493 inv[i].item_i:=0;
494 inv[i].sum_i:=0;
495 end;
496 end;
497 else}
498 if com='CLEAR_INVENTORY' then
499 begin
500 inv.resetData;
501 end;
502 else
504 end;
506 if com='I_AM_CHEATER' then
507 begin
508 if nextWord=#$36+#$36+#$36 then
509 cheats:=not cheats;
510 else
511 cheats:=false;
512 end;
513 else
514 if com='HALT' then
515 halt;
516 else
517 if com='WEATHER' then
518 osadki:=strToBool(nextWord);
519 else
520 {if com='MEGASPAWN' then
521 megaspawn;
522 else}
523 if com='REF_DRP' then
524 ref_drp:=strToBool(nextWord);
525 else
526 if com='BL_UPD' then
527 bl_upd:=decodeInt(nextWord);
528 else
529 if com='GET_DRP' then
530 s_get_drp:=strToBool(nextWord);
531 else
532 {if com='AI_UPD' then
533 ai_upd:=strToBool(nextWord);
534 else}
535 if com='PRT_UPD' then
536 particle_upd:=strToBool(nextWord);
537 else
538 if com='MAX_FPS' then
539 s_max_fps:=decodeInt(nextWord); else
540 if com='DRW_BACK' then
541 drw_back:=strToBool(nextWord);
542 else
543 {if com='DRW_MOBS' then
544 drw_mobs:=strToBool(nextWord);
545 else}
546 if com='DRP_PHY' then
547 drp_phy:=strToBool(nextWord);
548 else
549 if com='DRW_SM' then
550 drw_sm:=strToBool(nextWord);
551 else
552 if com='JPEG_Q' then
553 begin
554 s_jpeg_quality:=decodeInt(nextWord);
555 if s_jpeg_quality>100 then
556 s_jpeg_quality:=100;
557 else if s_jpeg_quality<0 then
558 s_jpeg_quality:=0;
559 end;
560 else
561 if com='LOAD_SM' then
562 load_sm:=decodeInt(nextWord);
563 else
564 if com='S_WEATHER' then
565 ifosad:=strToBool(nextWord);
566 else
567 if com='S_HIDE_GUI' then
568 drawgui:=strToBool(nextWord);
569 else
570 if com='S_LIGHT' then
571 light_type:=decodeInt(nextWord);
572 else
573 if com='S_PARTICLES' then
574 s_particles:=strToBool(nextWord);
575 else
576 if com='LOAD_SKY' then
577 load_sky_siz:=decodeInt(nextWord);
578 else
579 {if com='LOAD_MOB_TEX' then
580 load_mob_tex:=strToBool(nextWord);
581 else}
582 if com='LOAD_BACK_TEX' then
583 load_back_tex:=strToBool(nextWord);
584 else
585 if com='LOAD_WEATHER_TEX' then
586 load_weather_tex:=strToBool(nextWord);
587 else
588 if com='LOAD_PARTICLES_TEX' then
589 load_particles_tex:=strToBool(nextWord);
590 else
591 if com='LOAD_LIGHT_TEX' then
592 load_light_tex:=strToBool(nextWord);
593 else
594 if com='LOAD_GUI_TEX' then
595 load_gui_tex:=strToBool(nextWord);
596 else
597 if com='MENU_BACKGROUND' then
598 menu_background:=decodeInt(nextWord);
599 else
600 if com='DRW_DRP' then
601 drw_drp:=strToBool(nextWord);
602 else
603 if com='DRW_STARS' then
604 drw_stars:=strToBool(nextWord);
605 else
606 if com='SV_SETT' then
607 save_settings;
608 else
609 if com='LD_SETT' then
610 load_settings;
611 else
612 if com='LOAD_MINIMAP_TEX' then
613 load_minimap_tex:=strToBool(nextWord);
614 else
615 if com='MAX_PARTICLES' then
616 begin
617 max_particles:=decodeInt(nextWord);
618 reset_particles(max_particles+1);
619 end;
620 else
621 if com='EXEC' then
622 begin
623 tmp:=nextWord;
624 exec(nextWord, tmp);
625 end;
626 else
627 if com='RESET_ITEMS' then
628 begin
629 resetItems(decodeInt(nextWord)+1);
630 //addToLog('Max items: '+decodeInt(parsed_str[1]));
631 end;
632 else
633 if com='SET_ITEM' then
634 begin
635 setItemData(decodeInt(nextWord),
636 decodeInt(nextWord),
637 decodeInt(nextWord),
638 decodeInt(nextWord),
639 decodeInt(nextWord),
640 decodeInt(nextWord));
641 end;
642 else
643 if com='RESET_BLOCKS' then
644 begin
645 resetBlocks(decodeInt(nextWord)+1);
646 //addToLog('Max blocks: '+decodeInt(parsed_str[1]));
647 end;
648 else
649 if com='SET_BLOCK' then
650 begin
651 setBlockData(decodeInt(nextWord),
652 decodeInt(nextWord),
653 decodeInt(nextWord),
654 decodeInt(nextWord),
655 decodeInt(nextWord),
656 decodeInt(nextWord),
657 decodeInt(nextWord),
658 decodeInt(nextWord),
659 decodeInt(nextWord));
660 end;
661 else
662 if com='RESET_TOOLS' then
663 begin
664 resetTools(decodeInt(nextWord)+1);
665 //addToLog('Max tools: '+decodeInt(parsed_str[1]));
666 end;
667 else
668 if com='SET_TOOL' then
669 begin
670 setToolData(decodeInt(nextWord),
671 decodeInt(nextWord),
672 decodeInt(nextWord),
673 decodeInt(nextWord),
674 decodeInt(nextWord));
675 end;
676 else
677 if com='RESET_FUELS' then
678 begin
679 furnace.setMaxFuel(decodeInt(nextWord));
680 //addToLog('Max fuel: '+decodeInt(parsed_str[1]));
681 end;
682 else
683 if com='SET_FUEL' then
684 begin
685 furnace.initFuel(decodeInt(nextWord),
686 decodeInt(nextWord),
687 decodeInt(nextWord));
688 end;
689 else
690 if com='RESET_RECIPES' then
691 begin
692 furnace.setMaxRecipes(decodeInt(nextWord));
693 //addToLog('Max recipes: '+decodeInt(parsed_str[1]));
694 end;
695 else
696 if com='SET_RECIPE' then
697 begin
698 furnace.initRecipe(decodeInt(nextWord),
699 decodeInt(nextWord),
700 decodeInt(nextWord));
701 end;
702 else
703 if com='RESET_CRAFTS' then
704 begin
705 resetCrafts(decodeInt(nextWord));
706 //addToLog('Max crafts: '+decodeInt(parsed_str[1]));
707 end;
708 else
709 if com='SET_CRAFT_IN' then
710 begin
711 setCraftIn(decodeInt(nextWord),
712 decodeInt(nextWord),
713 decodeInt(nextWord),
714 decodeInt(nextWord));
715 end;
716 else
717 if com='SET_CRAFT_OUT' then
718 begin
719 setCraftOUT(decodeInt(nextWord),
720 decodeInt(nextWord),
721 decodeInt(nextWord),
722 decodeInt(nextWord));
723 end;
724 else
725 if com='RESET_BLOCKS_TEX' then
726 begin
727 initBlockTex(decodeInt(nextWord));
728 end;
729 else
730 if com='RESET_ITEMS_TEX' then
731 begin
732 initItemTex(decodeInt(nextWord));
733 end;
734 else
735 if com='LOAD_TEX' then
736 begin
737 regimg:=ld_tex(nextWord, '/'+sd+'/cavecraft/texturepacks/'+tex_pack+'/', '');
738 end;
739 else
740 if com='RESET_TEX' then
741 resetTmpImg;
742 else
743 if com='SET_TEX' then
744 setTexture(regimg,
745 nextWord,
746 decodeInt(nextWord));
747 if com='SET_CANV_TEX' then
748 begin
749 tmp:=nextWord;
750 tmp2:=nextWord;
751 setTexture(rotate_image_from_image(regimg,
752 decodeInt(nextWord),
753 decodeInt(nextWord),
754 decodeInt(nextWord),
755 decodeInt(nextWord),
756 0),
757 tmp,
758 decodeInt(tmp2));
759 end;
760 else
761 if com='SET_MAX_ITEM_LIST' then
762 setMaxItemList(decodeInt(nextWord));
763 else
764 if com='SET_ITEM_LIST' then
765 setItemList(decodeInt(nextWord),
766 decodeInt(nextWord));
767 else
768 if com='BIND_KEY' then
769 begin
770 tmp:=nextWord;
771 for i:=0 to MAX_KEY_BIND do
772 keyboard.bindKey(decodeInt(tmp), i, decodeInt(nextWord));
773 end;
774 else
775 if com='STACK' then
776 resetStack(decodeInt(nextWord));
777 else
778 if com='PUSH' then
779 pushStack(decodeInt(nextWord));
780 else
781 if com='POP' then
782 i:=popStack;
783 else
784 if com='SWAP' then
785 swapStack;
786 else
787 if com='DUP' then
788 dupStack;
789 else
790 if com='ADD' then
791 pushStack(popStack+popStack);
792 else
793 if com='SUB' then
794 begin
795 i:=popStack;
796 pushStack(popStack-i);
797 end;
798 else
799 if com='MUL' then
800 pushStack(popStack*popStack);
801 else
802 if com='DIV' then
803 begin
804 i:=popStack;
805 pushStack(popStack/i);
806 end;
807 else
808 if com='MOD' then
809 begin
810 i:=popStack;
811 pushStack(popStack mod i);
812 end;
813 else
814 if com='SET' then
815 setVar(nextWord, decodeInt(nextWord));
816 else
817 if com='POPSET' then
818 setVar(nextWord, popStack);
819 else
820 if com='MAX_VKEYS' then
821 resetVirtualKeyboard(decodeInt(nextWord));
822 else
823 if com='SET_VKEY' then
824 bindVKey(decodeInt(nextWord),
825 decodeInt(nextWord),
826 decodeInt(nextWord),
827 decodeInt(nextWord));
828 else
829 if com='SET_RESOLUTION' then
830 initVideo(decodeInt(nextWord), decodeInt(nextWord), strToBool(nextWord));
831 else
832 //addToLog('Unknown command "'+com+'"');
833 end;
835 procedure call_console;
836 var
837 commandTxt:integer;
838 i, tmpid:integer;
839 exitCmd, exeCmd, Clicked:command;
840 str:string;
841 begin
843 setFont(FONT_FACE_SYSTEM,FONT_STYLE_PLAIN,FONT_SIZE_SMALL);
845 repeat
846 ClearForm;
848 exitCmd:=createCommand('Exit', CM_EXIT, 1);
849 exeCmd:=createCommand('Execute', CM_OK, 1);
850 addCommand(exitCmd);
851 addCommand(exeCmd);
853 commandTxt:=formAddTextField('Enter command:', ''+lastCommand, 32, TF_ANY);
855 for i:=0 to CON_LOG_SIZE do
856 tmpid:=formAddString(logSTR[i]+chr(10));
858 ShowForm;
859 Repaint;
861 repeat
862 Clicked:=getClickedCommand;
863 if Clicked=exitCmd then
864 begin
865 lastCommand:=formGetText(commandTxt);
866 showCanvas;
867 exit;
868 end;
869 else
870 if Clicked=exeCmd then
871 begin
872 str:=formGetText(commandTxt);
873 addToLog(str);
874 exeCommand(str);
875 lastCommand:='';
876 break;
877 end;
878 forever;
879 forever;
880 end;
882 procedure exec(s, search:string);
883 var
884 res:resource;
885 str:string;
886 tmpEOF : Boolean;
887 begin
888 search:=UpCase(search);
890 if search='LOCAL' then
891 begin
892 addToLog('Load file "'+s+'" at LOCAL!');
893 res:=OpenResource('/'+s);
894 end;
895 else
896 if search='SD' then
897 begin
898 if open_file('/'+sd+'/cavecraft/'+s)=1 then
899 begin
900 addToLog('Load file "'+s+'" at SD!');
901 res:=get_stream;
902 end;
903 end;
904 else
905 if search='AUTO' then
906 begin
907 addToLog('path "/'+sd+'/cavecraft/'+s+'"');
908 if file_exists('/'+sd+'/cavecraft/'+s)=1 then
909 begin
910 if open_file('/'+sd+'/cavecraft/'+s)=1 then
911 begin
912 addToLog('Load file "'+s+'" at SD(AUTO)!');
913 res:=get_stream;
914 end;
915 end;
916 else
917 begin
918 addToLog('Load file "'+s+'" at LOCAL(AUTO)!');
919 res:=OpenResource('/'+s);
920 end;
921 end;
922 else
923 begin
924 addToLog('Unknown load type "'+search+'", file "'+s+'" not executed!');
925 exit;
926 end;
928 if ResourceAvailable(res) then
929 repeat
930 str:=ReadString(res);
931 tmpEOF:=EOFstr;
932 //addToLog('Exec: "'+str+'"');
933 exeCommand(str);
934 EOFstr:=tmpEOF;
935 until EOFstr;
936 else
937 addToLog('Execute file "'+s+'" not found!');
939 EOFstr := false;
940 ENDstr := false;
941 CloseResource(res);
942 end;
944 initialization
946 end.