/********** Automaticly generated header, don't edit ************************
 *
 * PROGRAM:       FPWait.rexx
 *
 * PURPOSE:       Animated Wait prompt for use in SYS.WELCOME or other places.
 *
 * AUTHOR:        Peter Klein. (PMK)
 *
 * DATE:          01 Oct 95                         
 *
 * TIME:          21:31:17                         
 *
 * VERSION:       0
 * REVISION:      2
 * SUBREVISION:   0
 *
 * CNET VERSION:  3.05c
 *
 * LOG:
 * 
 *  01 Oct 95 Added ability to disable some of the modes when using the Random
 *            Mode.  This is for all of you who don't like the Jump Mode :)
 *  12 Sep 95 First Version!.
 * 
 * INSTALLATION:
 *
 *  Add this to your SYSTEXT:SYS.WELCOME (or where ever you want it)
 *
 *     #0Pfiles:FPWait.rexx}
 *
 *
 * ARGUMENTS:
 * 
 *  FPWait.rexx can also be called with arguments. The syntax is:
 *
 *  FPWait.rexx <mode> [<text>]
 *
 *  Where <mode> is the mode of prompt. (see below)
 *        <text> is the text to show on prompt. (optional.)
 *
 *  The <mode> argument MUST be specified when using the <text> argument,
 *  and the <text> argument should be enclosed in "". as in this example:
 *
 *   #0Pfiles:FPWait.rexx 0 " This is a Pfile from Flux Point "}
 *
 *
 *  MODES:
 *
 *  0 = Random (Mode 1-10)
 *  1 = Background draw/delete.
 *  2 = Scroll text from right to left.
 *  3 = Scroll text from left to right.
 *  4 = Move text from side to side.
 *  5 = Move text up and down. (Jump)
 *  6 = Standard Twirly.
 *  7 = Cursor Twirly.
 *  8 = Pacman Twirly.
 *  9 = Clock Twirly.
 * 10 = Moving Cursor.
 * ==========================================================================
 *
 *   Another
 *        _____ __    __  __ __  __     ___   ____   __ __  __ ______
 *       / ___// /   / / / / \ \/ /    / _ \ / __ \ / //  \/ //_  __/
 *      / __/ / /__ / /_/ /  /   /    / ___// /_/ // // /\  /  / /
 *     /_/   /____/ \____/  /_/\_\   /_/    \____//_//_/ /_/  /_/    
 *
 *                          P R O D U C T I O N
 *
 *               Call +45 3526-2527     -    28k8 VFC/V34
 *
 *  FIDO 2:235/202   AMIGANET 39:141/139   CLINK 912:2000/4   WARP 138:1/102
 *
 ***************************************************************************/

/* ================= Start of Sysop definable variables. ================= */

norandom=''			/* Don't use these types in Random mode.	*/

/* ================== End of Sysop definable variables. ================== */

options results;signal on error;signal on syntax;signal on ioerr
if ~show('l','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then exit
if ARG()=2 then ;txt=ARG(2);else txt="  Hit Any Key to Continue  "
getuser 27;w=result;l=length(txt);z=(w-l)%2;getuser 28;te=result>1;getuser 1100460;an=result>0

sendstring 'n1'copies(' ',z)word('r1 z4cf',an+1)txt'r0z0<'l'}'
if te&an then do
	a=0;if ARG(1)~='' then a=ARG(1)
	do while a<1|a>10;a=random(0,11,time('s'));if find(norandom,a)>0 then a=0;end
	interpret('call MODE'a)
end;else getchar
exit

MODE1:;p=0;r=1
do forever;maygetchar;if result~='NOCHAR' then leave
	p=p+1;if p=1 then r=~r
	else if p=l+1 then do;sendstring '<'l'}';r=~r;p=1;end
	sendstring 'z'r*4||substr(txt,p,1);call delay(1)
end;transmit '<'p'}z4'txt'z0';return

MODE2:;call SCROLL(1);return
MODE3:;call SCROLL(0);return
SCROLL:;arg r;t=txt
do forever;maygetchar;if result~='NOCHAR' then leave
	t=right(t,(l-2)*r+1)left(t,(l-2)*~r+1)
	sendstring 'z4't'z0<'l'}';call delay(3)
end;transmit 'z4'txt'z0';return

MODE4:;sendstring '<'z'}';p=z;r=-1
do forever;maygetchar;if result~='NOCHAR' then leave
	p=p+r;if p=0|p=z*2-1 then r=-r;call delay(2)
	sendstring '[1'word('P . @',r+2)
end;transmit 'q1';return

MODE5:;sendstring '^1';r=1
do forever;maygetchar;if result~='NOCHAR' then leave
	 r=~r;sendstring '[1'word('M L',r+1);call delay(5)
end;transmit 'q1';return

MODE6:;call TWIRL('-/|\-',1);return
MODE7:;call TWIRL('Û',3);return
MODE8:;call TWIRL('->|<=',2);return
MODE9:;call TWIRL('¿ÙÀÚ',2);return
TWIRL:;arg c,d;f=1;p=1;r=1
do forever;maygetchar;if result~='NOCHAR' then leave
	sendstring 'z4'left(txt,p)'c3'substr(c,f,1)'cf'substr(txt,p+2)'z0<'l'}'
	call delay(d);f=f+1;if f>length(c) then do;f=1;p=p+r;if p=0|p=l-1 then r=-r;end
end;transmit 'z4'txt'z0';return

MODE10:;p=0;r=1
do forever;maygetchar;if result~='NOCHAR' then leave
	sendstring 'z4'left(txt,p)'r1'substr(txt,p+1,1)'r0'substr(txt,p+2)'z0<'l'}'
	call delay(3);p=p+r;if p=0|p=l-1 then r=-r
end;transmit 'z4'txt'z0';return

SYNTAX:;ERROR:;IOERR:;e0='Error in line: 'left(sigl,4)' File: ';e1='Error Code 'rc' <'errortext(rc)'>';e2=sourceline(sigl)
getuser 1311992;e0=e0||result;getuser 1311960;e0=e0||result;call log(e0);call log(e1);call log(e2);bufferflush;exit
LOG:;er=ARG(1);transmit er;do a=0 to length(er)%45;logentry substr(er,a*45+1,45);end;return
