home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / applicat / 9891 < prev    next >
Encoding:
Text File  |  1993-01-10  |  5.6 KB  |  240 lines

  1. Xref: sparky comp.sys.amiga.applications:9891 comp.sys.amiga.programmer:18439
  2. Path: sparky!uunet!think.com!ames!network.ucsd.edu!sdcc12!sdcc8!cs64wag
  3. From: cs64wag@sdcc8.ucsd.edu (Jeremy Friesner)
  4. Newsgroups: comp.sys.amiga.applications,comp.sys.amiga.programmer
  5. Subject: Star Wars script for Final Copy
  6. Message-ID: <43281@sdcc12.ucsd.edu>
  7. Date: 10 Jan 93 08:57:49 GMT
  8. Sender: news@sdcc12.ucsd.edu
  9. Followup-To: comp.sys.amiga.applications
  10. Organization: University of California, San Diego
  11. Lines: 226
  12. Nntp-Posting-Host: sdcc8.ucsd.edu
  13.  
  14.  
  15.  
  16.  
  17.  
  18. Hello all,
  19.  
  20. Here's a little Arexx script I wrote the other day when I was
  21. really bored.  :-)  It uses the font sizing and obliquing features
  22. of Final Copy II to attempt to produce a "Star Wars" 3-D titling
  23. type effect on selected text.  Sometimes it looks right, sometimes
  24. it doesn't, so feel free to tweak the program if you like.
  25.  
  26.  
  27. Basically, the way to use it is this:  Define a style called
  28. StarWars (note capitalization and lack of space) with the
  29. justification
  30. on "centered" and the type settings box not applied (i.e.
  31. unchecked).  This isn't exactly necessary, but if you don't,
  32. you'll have to center the text yourself.  I can't find any other
  33. way to do it.  :(
  34.  
  35.  
  36. Then select the text you want the effect applied to.  The script
  37. will work best if you have a carriage return at the end of each
  38. line, and not too many characters per line.
  39.  
  40. Then, from a shell, type "rx star.rexx" or whatever the filename
  41. is.  Then enter the parameters you want, and wait.  You'll probably
  42. have to play around with the parameters to get it to look "right".
  43.  
  44.  
  45.  
  46. Jeremy
  47.  
  48.  
  49. (yes, I know with some work it can be run from the Final Copy
  50.  menu, but it's late and I don't feel like bothering right now.
  51.  So if you want it to do that, fix it yourself   ;)  )
  52.  
  53. (last minute note--vi has split some of the lines in the
  54.  script into two, so if it doesn't work, try rejoining them
  55.  back into one line.)
  56.  
  57. -----(begin Arexx script)-------------------------------------------
  58.  
  59.  
  60. /* -----------------------------------------*/
  61. /* Final Copy II Arexx Macro - STAR WARS FX */
  62. /* Makes a neat "Star Wars" 3D effect on    */
  63. /* selected text.                           */
  64. /* -----------------------------------------*/
  65. address "FINALC.1"
  66. Options Results
  67.  
  68. say 'minimum text size?'
  69. pull topsize
  70. say 'maximum text size?'
  71. pull bottomsize
  72.  
  73. /* ------------------------------ */
  74. /* get the complete font pathname */
  75. /* ------------------------------ */
  76. status fontpath
  77. fontpath = result
  78.  
  79. /* ------------------------------------- */
  80. /* get only the font filename (w/o path) */
  81. /* ------------------------------------- */
  82. status fontname
  83. fontname = result
  84.  
  85. /* ----------------------------------- */
  86. /* find out how which text is selected */
  87. /* ----------------------------------- */
  88. status position
  89. selectedpos = result
  90. say 'selectedpos = 'selectedpos
  91. startline = word(selectedpos,1)
  92. endline = word(selectedpos,3)
  93. startcol = word(selectedpos,2)
  94. endcol = word(selectedpos,4)
  95.  
  96. if endline = '' then endline = startline
  97. if endcol = '' then endcol = startcol
  98.  
  99. say 'startline = 'startline' endline = 'endline
  100. say 'startcol  = 'startcol'  endcol  = 'endcol
  101.  
  102. 'stylesheet StarWars'
  103.  
  104.  
  105. /* make cursor move to top of selected area */
  106.  
  107. 'shiftup'
  108. 'altup'
  109. 'cursor up'
  110.  
  111. correct = false
  112. do until correct = true
  113.     /* get cursor's current position */
  114.     status position
  115.     currentpos = result
  116.     curline = word(currentpos,1)
  117.     curcol = word(currentpos,2)
  118.     /* move towards goal */
  119.     if curline > startline then 'cursor up'
  120.     if curline < startline then 'cursor down'
  121.     if curcol > 0 then 'cursor left'
  122.     status position
  123.     currentpos = result
  124.     curline = word(currentpos,1)
  125.     curcol = word(currentpos,2)
  126.     say 'new line = 'curline' new col ='curcol
  127.     if ((curline = startline) & (curcol = 0)) then correct =
  128. true
  129.     end
  130.  
  131.  
  132. /* default sizes */
  133.  
  134. numberoflines = endline - startline
  135. if numberoflines=0 then numberoflines = 1
  136.  
  137. if bottomsize=topsize then interval = 0 else
  138.        interval = (bottomsize - topsize) / numberoflines
  139.  
  140. say 'number of lines = 'numberoflines
  141. say 'interval = 'interval
  142.  
  143. /* spread sizes evenly */
  144. j=topsize
  145.  
  146. do i=1 to numberoflines 
  147.     'cursor right'
  148.     'cursor left'
  149.     'altdown'
  150.     'shiftdown'
  151.     'cursor right'
  152.     say 'fontsize for line 'i' is 'j
  153.     k = j % 1
  154.     'fontsize 'k
  155.     'altup'
  156.     'shiftup'
  157.     j=j+interval
  158.     end
  159.  
  160.  
  161. /* back to the top for obliquing */
  162.  
  163. say 'do you want text obliquing?'
  164. pull answer
  165. a=upper(answer)
  166.  
  167. if ((a~='YES')&(a~='Y')) then break
  168.  
  169. say 'enter starting obliquing (-15 to 15)?'
  170. pull leftobliquelimit
  171. say 'enter ending obliquing (-15 to 15)?'
  172. pull rightobliquelimit
  173.  
  174. 'Shiftup'
  175. 'Altup'
  176.  
  177. correct = false
  178. do until correct = true
  179.     /* Get cursor's current position */
  180.     Status Position
  181.     CurrentPos = Result
  182.     curline = WORD(Currentpos,1)
  183.     curcol = WORD(Currentpos,2)
  184.     /* move towards goal */
  185.     if curline > startline then 'Cursor up'
  186.     if curline < startline then 'Cursor down'
  187.     if curcol > 0 then 'Cursor left'
  188.     Status Position
  189.     CurrentPos = Result
  190.     curline = WORD(Currentpos,1)
  191.     curcol = WORD(Currentpos,2)
  192.     say 'new line = 'curline' new col ='curcol
  193.     if ((curline = startline) & (curcol = 0)) then correct =
  194. true
  195.     end
  196.  
  197.  
  198.  
  199. /* obliquing */
  200.  
  201. do i = 1 to numberoflines
  202.  
  203. /* first find length of current line */
  204.  
  205. 'cursor down'
  206. 'cursor left'
  207.  
  208. Status Position
  209. CurrentPos = Result
  210. numofchars = WORD(Currentpos,2)
  211. say 'numofchars = 'numofchars
  212.  
  213. 'cursor right'
  214. 'cursor up'
  215.  
  216. if numofchars>0 then interval = (rightobliquelimit -
  217. leftobliquelimit) / numofchars
  218. say 'interval = 'interval
  219.  
  220. obliquenum = rightobliquelimit   /*set oblique variable */
  221.  
  222. do j = 1 to numofchars 
  223.     'ShiftDown'
  224.     'cursor right'
  225.     o=obliquenum % 1
  226.     'Oblique 'o
  227.     'ShiftUp'
  228.     'cursor right'
  229.     'cursor left'
  230.     
  231.     obliquenum = obliquenum - interval
  232.     end
  233.  
  234. /* go to next line */
  235.  
  236. 'cursor right'
  237. end
  238.  
  239.  
  240.