home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / pyrxutil.zip / pig_hunt.cmd < prev    next >
OS/2 REXX Batch file  |  2001-10-19  |  2KB  |  74 lines

  1. /*PYRxUtil demo*/
  2. /* Pig hunter */
  3. /*  é ºáßáñÑ «ª¿ñáѼ ºá»π߬ pig.exe .
  4.   ìÑ ºáíπñ∞ »α« «απª¿Ñ = xf86sup.sys */
  5.  
  6. call RxFuncAdd 'PYRxInit','PYRxUtil','PYRxInit'
  7. call PYRxInit
  8. call PYRxGo 'p','#'
  9. ttl = 'Pig hunter'
  10. call PYRxGo 't','??',ttl,'hunter'
  11. do i=1 to hunter.0
  12.   do while word(hunter.i,1) \= result
  13.     call PYRxMsg ,10,1,,'Sheet !'||'0'x||"I'm late ."||'0'x,
  14.                    ||'Another hunter is here (PID=',
  15.                    ||word(hunter.i,2)||')',,,'Go out'
  16.     exit
  17.    end
  18.  end
  19. call PYRxGo 'p',ttl
  20. do forever
  21.   drop pig. ; pig.0 = 0
  22.   call PYRxGo 'p','?......?','*\PIG.EXE','pig'
  23.   state = (pig.0 = 0)||(bang = 'BANG')
  24.   select
  25.     when state = '11' then
  26.       if msg = 'MSG' then
  27.         msg = PYRxMsg('*',,1,,'Pig hunter (PID='result')'||'0'x,
  28.                              ||'No pigs out here'||'0'x||'Give me PIG.EXE')
  29.        else
  30.         if datatype(msg,'w') then
  31.           if \PYRxGo('p','@',result) | \PYRxGo('p','^',result) then
  32.             do
  33.               call PYRxMsg msg,'-'
  34.               msg = ''
  35.              end
  36.     when state = '01' then
  37.       do
  38.         if datatype(msg,'w') then
  39.           call PYRxMsg msg,'-'
  40.         msg = ''
  41.         do i=1 to pig.0
  42.           pid = word(pig.i,1)
  43.           msg = msg||'d'x||'PIG#'i' = 'pid'  (0x'||d2x(pid)||')'
  44.          end
  45.         bang = PYrxMsg(,,,,'Wow !'||'0'x||pig.0' PIGs here :',
  46.                                   ||msg,'!',,'Kill','+ defuse')
  47.         do i=1 to pig.0
  48.           parse var pig.i pid path
  49.           call PYRxGo 'P','!',pid
  50.           call PYRxKey 1000
  51.           call PYRxGo 'P','-',pid
  52.           if bang = 12 then
  53.             do
  54.               'unlock 'path
  55.               'ren 'path' *.dead'
  56.              end
  57.          end
  58.        end
  59.     when state = '10' then
  60.       do
  61.         call PYrxMsg ,,,,'Nice shoot !',,,'More pigs','Bye'
  62.         if result \= 11 then
  63.           exit
  64.          else
  65.           drop msg bang
  66.        end
  67.     otherwise
  68.       call PYrxMsg ,,,,'Too bad !'||'0'x||"Where's my Gun :((",'?',,'Bye'
  69.       exit
  70.    end
  71.   call PYRxKey 1000
  72.  end
  73. exit
  74.