home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 167.lha / Player / CharGen.Rexx < prev    next >
OS/2 REXX Batch file  |  1988-04-28  |  6KB  |  176 lines

  1. /* Chargen for AREXX with automatic character entry in Player */
  2. /* For use with the Energion Campaign System and Player */
  3. /* Energion rules material Copyright 1988 Henry Neufeld but may be */
  4. /* Redistributed freely.  Macro by Henry Neufeld */
  5. /* Support via Wind Dragon Inn, (402) 291-8053 3/12/2400 */
  6.  
  7. /* Get command line arguments, if any */
  8. arg species species1 species2 .
  9.  
  10. /* Initialize variables for species profiles */
  11. races='HUMAN GERDLU ERTZLU KELARU KAL TLAZIL HALF RACE'
  12. Human='100 100 100 100 100 100 100 100'
  13. Gerdlu='120 100 100 125 115 100 110 105'
  14. Ertzlu='100 105 105 120 115 100 110 100'
  15. Kelaru='100 115 110 105 100 105 100 100'
  16. Kal='120 100 90 120 130 80 70 120'
  17. Tlazil='140 85 85 120 120 85 100 110'
  18. label='STAGCOENHEIQWIFOPOOL'
  19. call randu time(seconds)
  20. st=1;ag=2;co=3;en=4;he=5;iq=6;wi=7;fo=8;pool=9
  21.  
  22. /* Make sure Player is running before we get started */
  23. if ~show(l,'rexxsupport.library') then do
  24.   if ~addlib('rexxsupport.library',0,-30,0) then do
  25.     say 'ERROR: Can''t load rexxsupport.library'
  26.     exit 20
  27.   end
  28. end
  29. if ~showlist('P','PLAYER') then do
  30.   say 'Starting Player . . .'
  31.   'runwsh player'  /* Or try "shell command 'run directory:player'" if you don't have WShell */
  32. end
  33. address player
  34.  
  35. /* Choose Character Species */
  36. /* Get species choice if not passed through command line */
  37. do until left(upper(c),1)='Y'
  38.   do while ~checkinput(species)
  39.     call printrace
  40.     species=input('Species name? ')
  41.   end
  42.   /* Half species get an average of the two parent species */
  43.   if left(upper(species),4)='HALF' then do
  44.     do while ~checkinput(species1)
  45.       call printrace
  46.       species1=input('Select first species: ')
  47.     end
  48.     interpret 'parse var '||species1||' bstat1.1 bstat1.2 bstat1.3 bstat1.4 bstat1.5 bstat1.6 bstat1.7 bstat1.8'
  49.     do while ~checkinput(species2)
  50.       species2=input('Select second species: ')
  51.     end
  52.     interpret 'parse var '||species2||' bstat2.1 bstat2.2 bstat2.3 bstat2.4 bstat2.5 bstat2.6 bstat2.7 bstat2.8'
  53.     do i=1 to 8
  54.       racebase.i=((bstat1.i+bstat2.i)/2)%1
  55.     end
  56.     species='HALF '||species1||' '||'HALF '||species2
  57.   end; else do
  58.     /* Get the profile for a full blood species */
  59.     interpret 'parse var '||species||' racebase.1 racebase.2 racebase.3 racebase.4 racebase.5 racebase.6 racebase.7 racebase.8 .'
  60.   end
  61.   say 'HYou chose:'
  62.   say species
  63.   do i=1 to 8
  64.     say right(racebase.i,3)
  65.   end
  66.   /* Make sure the player hasn't changed his mind */
  67.   c=input('Is this the species combination you want? ')
  68.   if left(upper(c),1)~='Y' then do
  69.     species=''
  70.     species1=''
  71.     species2=''
  72.   end
  73. end
  74.  
  75. totalrange=0
  76. /* Note: From this point, this macro a close translation of CHARGEN.BAS */
  77. /* (originally published in the Energion Basic Rules manual, used by */
  78. /* permission) into AREXX */
  79. do i=st to fo
  80.   racerange=100;if racebase.i<100 then racerange=racebase.i
  81.   totalrange=totalrange+racerange
  82.   racemin.i=racebase.i-racerange+1;racemax.i=racebase.i+racerange
  83.   diesize=(racerange/3)%1
  84.   stat.i=(racebase.i-.3*racerange+random(1,diesize)+random(1,diesize)+random(1,diesize))%1
  85.   basestat.i=stat.i
  86. end
  87. stat.pool=(totalrange*.25+totalrange*.05*(random(1,100)/100))%1
  88. basestat.pool=0; racemin.pool=0; racemax.pool=32767
  89.  
  90. /* Adjust Stats, loop until 'break' */
  91. do forever
  92.   say 'H  Stat     Cur     Min Base  Max'
  93.   say '--------   ---     --- ----  ---'
  94.   do i=st to fo
  95.     say left(i,5) substr(label,i*2-1,2)||'  ' ''||right(stat.i,3) ''||right(racemin.i,7) ''||right(basestat.i,4) ''||right(racemax.i,4) ''
  96.   end
  97.   say 'E9   Pool  ' ''||left(stat.pool,4)||''
  98.   do until (src>0 & src<10)
  99.     src=input('Source stat (CHECK to look in Player; DONE when done)? ')
  100.     if src='DONE' then break
  101.     if src='CHECK' then do
  102.       call enterit
  103.       c=input('Hit return when done looking: ')
  104.       'set changed n'
  105.       'project unload'
  106.       src=99
  107.     end
  108.     if ~datatype(src,'N') then if index(label,src)=0 then src='99'
  109.     if datatype(src,'M') then src=(index(label,left(src,2))/2)%1+1
  110.   end
  111.   if src='DONE' then break
  112.   do until dest>0 & dest<10 & dest~=src
  113.     dest=input('Destination stat? ')
  114.     if datatype(dest,'M') then dest=(index(label,left(dest,2))/2)%1+1
  115.   end
  116.   do until pts>0
  117.     pts=input('Number of points to move? ')
  118.   end
  119.   l=2; if substr(label,src*2-1,2)='PO' then l=4
  120.   say 'Taking some' substr(label,src*2-1,l) 'and putting it on' substr(label,dest*2-1,2) 'E'
  121.   n=0
  122.   do i=1 to pts
  123.     n=n+1; if n//5=0 then say 'A@ .'
  124.     if (stat.src>racemin.src) & (stat.dest<racemax.dest) then do
  125.       x=1; if stat.src<=basestat.src then do; x=2; i=i+1; end
  126.       stat.src=stat.src-x
  127.       x=1; if stat.dest<basestat.dest then x=2
  128.       stat.dest=stat.dest+x
  129.     end; else i=pts
  130.   end
  131. end
  132.  
  133. /* Enter final version of stats into Player */
  134. call enterit  
  135.  
  136. /* Get out before these subroutines do something strange */
  137. say 'Done!'
  138. exit
  139.  
  140. /* Print list of race choices */
  141. printrace:
  142. say 'HHuman'
  143. say 'Gerdlu'
  144. say 'Ertzlu'
  145. say 'Kelaru'
  146. say 'Kal'
  147. say 'Tlazil'
  148. say 'Half race'
  149. return
  150.  
  151. /* Check validity of arguments and make them null if invalid */
  152. Checkinput:
  153. arg tocheck
  154. if index(races,tocheck)>0 then return 1
  155.                           else return 0
  156.  
  157. /* Enter stats into Player */
  158. enterit:
  159. say 'Now entering your stats into Player . . .'
  160. 'lock'
  161. 'project new'
  162. do i=st to fo
  163.   'set stat' substr(label,i*2-1,2) stat.i
  164. end
  165. 'redisplay'
  166. 'unlock'
  167. return
  168.  
  169. /* Set prompt string and get a response */
  170. input:
  171. parse arg prmt
  172. p='E'||prmt||''
  173. options prompt p
  174. pull r
  175. return r
  176.