From: cs64wag@sdcc8.ucsd.edu (Jeremy Friesner)
Newsgroups: comp.sys.amiga.applications,comp.sys.amiga.programmer
Subject: Star Wars script for Final Copy
Date: 10 Jan 93 08:57:49 GMT
Followup-To: comp.sys.amiga.applications
Organization: University of California, San Diego


 
 
 
Hello all,
 
Here's a little Arexx script I wrote the other day when I was
really bored.  :-)  It uses the font sizing and obliquing features
of Final Copy II to attempt to produce a "Star Wars" 3-D titling
type effect on selected text.  Sometimes it looks right, sometimes
it doesn't, so feel free to tweak the program if you like.
 
 
Basically, the way to use it is this:  Define a style called
StarWars (note capitalization and lack of space) with the
justification
on "centered" and the type settings box not applied (i.e.
unchecked).  This isn't exactly necessary, but if you don't,
you'll have to center the text yourself.  I can't find any other
way to do it.  :(
 
 
Then select the text you want the effect applied to.  The script
will work best if you have a carriage return at the end of each
line, and not too many characters per line.
 
Then, from a shell, type "rx star.rexx" or whatever the filename
is.  Then enter the parameters you want, and wait.  You'll probably
have to play around with the parameters to get it to look "right".
 
 
 
Jeremy
 
 
(yes, I know with some work it can be run from the Final Copy
 menu, but it's late and I don't feel like bothering right now.
 So if you want it to do that, fix it yourself   ;)  )
 
(last minute note--vi has split some of the lines in the
 script into two, so if it doesn't work, try rejoining them
 back into one line.)
 
-----(begin Arexx script)-------------------------------------------

 
/* -----------------------------------------*/
/* Final Copy II Arexx Macro - STAR WARS FX */
/* Makes a neat "Star Wars" 3D effect on    */
/* selected text.                           */
/* -----------------------------------------*/
address "FINALC.1"
Options Results
 
say 'minimum text size?'
pull topsize
say 'maximum text size?'
pull bottomsize
 
/* ------------------------------ */
/* get the complete font pathname */
/* ------------------------------ */
status fontpath
fontpath = result
 
/* ------------------------------------- */
/* get only the font filename (w/o path) */
/* ------------------------------------- */
status fontname
fontname = result
 
/* ----------------------------------- */
/* find out how which text is selected */
/* ----------------------------------- */
status position
selectedpos = result
say 'selectedpos = 'selectedpos
startline = word(selectedpos,1)
endline = word(selectedpos,3)
startcol = word(selectedpos,2)
endcol = word(selectedpos,4)
 
if endline = '' then endline = startline
if endcol = '' then endcol = startcol
 
say 'startline = 'startline' endline = 'endline
say 'startcol  = 'startcol'  endcol  = 'endcol
 
'stylesheet StarWars'
 
 
/* make cursor move to top of selected area */
 
'shiftup'
'altup'
'cursor up'
 
correct = false
do until correct = true
	/* get cursor's current position */
	status position
	currentpos = result
	curline = word(currentpos,1)
	curcol = word(currentpos,2)
	/* move towards goal */
	if curline > startline then 'cursor up'
	if curline < startline then 'cursor down'
	if curcol > 0 then 'cursor left'
	status position
	currentpos = result
	curline = word(currentpos,1)
	curcol = word(currentpos,2)
	say 'new line = 'curline' new col ='curcol
	if ((curline = startline) & (curcol = 0)) then correct =
true
	end
 
 
/* default sizes */
 
numberoflines = endline - startline
if numberoflines=0 then numberoflines = 1
 
if bottomsize=topsize then interval = 0 else
       interval = (bottomsize - topsize) / numberoflines
 
say 'number of lines = 'numberoflines
say 'interval = 'interval
 
/* spread sizes evenly */
j=topsize
 
do i=1 to numberoflines 
	'cursor right'
	'cursor left'
	'altdown'
	'shiftdown'
	'cursor right'
	say 'fontsize for line 'i' is 'j
	k = j % 1
	'fontsize 'k
	'altup'
	'shiftup'
	j=j+interval
	end
 
 
/* back to the top for obliquing */
 
say 'do you want text obliquing?'
pull answer
a=upper(answer)
 
if ((a~='YES')&(a~='Y')) then break
 
say 'enter starting obliquing (-15 to 15)?'
pull leftobliquelimit
say 'enter ending obliquing (-15 to 15)?'
pull rightobliquelimit
 
'Shiftup'
'Altup'
 
correct = false
do until correct = true
	/* Get cursor's current position */
	Status Position
	CurrentPos = Result
	curline = WORD(Currentpos,1)
	curcol = WORD(Currentpos,2)
	/* move towards goal */
	if curline > startline then 'Cursor up'
	if curline < startline then 'Cursor down'
	if curcol > 0 then 'Cursor left'
	Status Position
	CurrentPos = Result
	curline = WORD(Currentpos,1)
	curcol = WORD(Currentpos,2)
	say 'new line = 'curline' new col ='curcol
	if ((curline = startline) & (curcol = 0)) then correct =
true
	end
 
 
 
/* obliquing */
 
do i = 1 to numberoflines
 
/* first find length of current line */
 
'cursor down'
'cursor left'
 
Status Position
CurrentPos = Result
numofchars = WORD(Currentpos,2)
say 'numofchars = 'numofchars
 
'cursor right'
'cursor up'
 
if numofchars>0 then interval = (rightobliquelimit -
leftobliquelimit) / numofchars
say 'interval = 'interval
 
obliquenum = rightobliquelimit   /*set oblique variable */
 
do j = 1 to numofchars 
	'ShiftDown'
	'cursor right'
	o=obliquenum % 1
	'Oblique 'o
	'ShiftUp'
	'cursor right'
	'cursor left'
	
	obliquenum = obliquenum - interval
	end
 
/* go to next line */
 
'cursor right'
end
 

Newsgroups: comp.sys.hp48