chemical library by Anonymous Coder17th Aug 2004 23:06
|
---|
Summary chemical substances in food like contaminants, residues of plant protection substances and residues of veterinary medicinal Description hi Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com Rem Project: chemical library Rem Created: 18/8/2004 12:51:05 πμ Rem ***** Main Source File ***** global proceed1$ global proceed2$ global path$ global filename$ global findfast_algorithm$ global found$ global lines global size path$=GET DIR$() filename$="chemical library.txt" findfast_algorithm$="off" found$="no" Filename_algorithm_concept$="findconcept.exe" Filename_thats_why$="thatswhy.exe" lines=0 cls if (path exist(path$)=1) print "Path exist.":print path$:proceed1$="fine" else print "Path does not exist." endif if (file exist(filename$)=1) print "File exist.":print filename$:proceed2$="fine" else print "File does not exist." endif if (proceed1$="fine" and proceed2$="fine") print "everything's ok" size=file size(filename$) print "File size: ",size/1000," Kbyte" print "" print "About to enter a menu for file searching." print "You're able to add a better chemical substance library." print "" print "Press any key." wait key access_file_menu() else print "error has occured." wait key endif end function access_file_menu() text_font_size_style_transparent("book",14,"bold","ON") cls print "Menu" print "1.Find chemical substance / not really functioning yet." print "2.Find fast algorithm.Must run once. FindFast Algorithm is ",findfast_algorithm$ print "3.Print intire file onto screen. Exit view with 'escape' key and any to drop down list" print "" print "4.Algorithm concept" print "5.Why this?" print "6.Quit" print "" input "Choose between 1-3 : ",choice if (choice=1)then:input "Please enter substance you want to find: ",substance$ : access_file(substance$) if (choice=2) print "" print "About to perform line algorithm search ability: " print "1.Please enter the line number of the file: " print "2.Please wait and let it to be computed and overwritten: " print "" input "Your choice 1-2 : ",algorithm if (algorithm=1) if (lines>0) access_file_readlines(lines,"no") else input "Lines: ",lines access_file_readlines(lines,"no") endif endif if (algorithm=2)then:access_file_readlines(lines,"yes") endif if (choice=3)then:access_file_show_all() if (choice=4)then:Algorithm_concept() if (choice=5)then:thats_why() if (choice=6)then:exit endfunction function access_file_show_all() Disable escapekey cls print "" open to read 1,filename$ do read string 1,first$ print first$ lines=lines+1 if (lines>35)then: wait key if (file end(1)=1)then:exit if (escapekey()=1) then:print "escaping loop...":wait key:exit if (Shiftkey()=1) then:exit loop close file 1 print "" print "Press any key to resume..." enable escapekey wait key access_file_menu() endfunction function access_file(string$) print "Searhing... ",string$ open to read 1,filename$ do read string 1,first$ `i'm unable to compare 'word' or 'string' with 'first$',really lines=lines+1 if (file end(1)=1)then:exit percentage_done(lines,found$) loop close file 1 print "Status 'found$': ",found$ print "" print "Press any key to resume..." wait key access_file_menu() endfunction function access_file_readlines(lines,overwritten$) `print string$ if (findfast_algorithm$="on") print "It's already activated and functioning properly,probably." if (overwritten$="yes") then: print "Overwriting anyway.":sleep 2000: goto jump ` input "Still want to proceed? (yes/no) (y/n) ",respond$ ` if (respond$="y" or respond$="yes") then: lines=0:goto jump else jump: if (lines=0) open to read 1,filename$ do read string 1,first$ `print first$ print "Line number: ",lines lines=lines+1 if (file end(1)=1)then:exit loop close file 1 else print lines endif if (lines>0) then: findfast_algorithm$="on" print "Now findfast algorithm is: ",findfast_algorithm$ endif print "" print "Press any key to resume..." wait key access_file_menu() endfunction function percentage_done(lines,found$) if (found$="no") x=(lines*100)/1054 if (lines>0) then:set cursor 0,130 :print x," %" else set cursor 0,130 :print "100 %" print "Found it! " endif endfunction function text_font_size_style_transparent(font$,text_size,style$,transparent$) if (font$="book") then: set text font "book" set text size text_size if (style$="bold")then: set text to bold if (transparent$="ON") then: set text transparent endfunction function Algorithm_concept() cls print "Upcoming article...free of charge" print ".........'Press' me.............." print " place_cursor =" print " alphabetical_characters_wanted_number *" print " number_file_lines) /" print " number_ofall_alphabetical_characters" print " -somelines" wait key access_file_menu() endfunction function thats_why() disable escapekey while (not escapekey()=1) `do cls text_font_size_style_transparent("book",70,"bold","ON") frames_per_second() set cursor (screen width()*(0.65/2)), (screen height()/2) print get time$() `then:exit fastsync endwhile enable escapekey access_file_menu() endfunction function frames_per_second() text 20,screen height()-40,desc$ fps$="DBPro Fps: "+str$(screen fps()) `text screen width()-20-text width(fps$),screen height()-40,fps$ text (screen width()*(0.45/2)),(screen height()*(3/4)),fps$ endfunction |