;==================================
; Script Name: Speech Recorder
; Author: Jebbit
; Version: 1.00
; Client Tested with:5.0.2
; EUO version tested with:1.5
; Shard OSI / FS: OSI/FS
; Revision Date:
; Public Release: May 19, 2006
; Purpose: Display conversations, View conversations, Save conversations
;==================================

gosub setup
gosub menu
 
 loop:
 wait 15
 if %jin < #jindex || #MENUBUTTON = up || #MENUBUTTON = down || #MENUBUTTON = save
 gosub main
 goto loop

sub setup
set %text 1
set %line _____________________________________________________________________________
 set %file event_macro.txt
 set %jin #jindex
 set %number List
 set %begin 0
 set %up 0
 set %count 0
 set #lpc 700
 set %show 0
 return
 
  sub menu
  display yesno Do you wish to auto save chat to file. If Yes it will save every line as chat appears. If you choose no a button will appear that will allow you to save as you choose
if #DISPRES = yes
set %save #true
 menu Font BGColor InactiveCaptionText
menu window transparent 90
menu Window Size 600 200
	menu font size 10
	Menu Font Color red
	menu button up 570 10 30 30 ^
menu button down 570 100 30 30 v
Menu Font Color black
Menu Text txt2 10 1 %line
Menu Text txt2 10 31 %line
Menu Text txt2 10 61 %line
Menu Text txt2 10 91 %line
Menu Text txt2 10 121 %line
Menu Font Color green
menu button returnn 500 170 100 30 Scanning Mode
Menu Text txt 155 150 Saving will take a long time, screen will flash
 return
 
sub main
if #MENUBUTTON = up || #MENUBUTTON = down
{
gosub rotate
set %d 1
}
Menu Font Color green
if %save <> #true
menu button save 230 170 100 30 Save To File
if %save = #true
menu button save 230 170 100 30 Auto Save On
Menu Font Color red
wait 10
if #MENUBUTTON = save || ( %save = #true && %up < %count + 1 )
	{
	set %up %up + 1
	set %wait %back
   gosub collect_info
   set #MENUBUTTON closed
  }
if #jindex > %jin || ( %d = 1 )
{
if %d = 1
goto menu
here:
Menu Text txt 100 170 Line Scaned %jin
Menu Text txt 400 170 Jindex #jindex
if %#jindex - %jin > 100
set %jin #jindex - 50
menu show 0 0
set %jin %jin + 1
scanjournal %jin
	if ( : in #journal && you_see notin #journal && world notin #journal && logged notin #journal && %trigger <> #journal && razor: notin #journal && warning: notin #journal && you_see notin #journal && obsu notin #journal && consecrus notin #journal && dispiro notin #journal && furis notin #journal && solum notin #journal && luminos notin #journal && prostra notin #journal && vomica notin #journal && viatas notin #journal && sanct notin #journal && uus notin #journal && ort notin #journal && des notin #journal && jux notin #journal && mani notin #journal && ylem notin #journal && rel notin #journal && wis notin #journal && lor notin #journal && flam notin #journal && nox notin #journal && por notin #journal && grav notin #journal && ort notin #journal && kal notin #journal && corp notin #journal ) || ( %d = 1 )
	{
	set %pars_this #journal
  set %count %count + 1
  gosub pars
  str len %d
  if #strres > 80
  {
  str left %d 80
  set %d #strres
  }
 set %number , %count %d
 set %numbe , %count %pars_this
 if %show <= %countz
 {
 if %show = n/a
 set %show %count
 set %show %show + 5
 goto menu
 }
 if %show > %count
 goto here
 menu:
 set %d 0
 menu delete txt1
	SET %BACK %count
	Menu Text txt1 10 0 %number . %back
 set %trigger %number . %back
	SET %BACK %count - 1
 if %text > 0
	Menu Text txt1 10 30 %number . %back
 SET %BACK %count - 2
 if %text > 1
 Menu Text txt1 10 60 %number . %back
 SET %BACK %count - 3
 scanjournal %BACK
 if %text > 2
	Menu Text txt1 10 90 %number . %back
 SET %BACK %count - 4
 if %text > 3
	Menu Text txt1 10 120 %number . %back
	menu show 0 0
}
}
return

sub rotate
set %step %count
Menu Font Color red
menu button done 440 170 160 30 Push to continue scanning
jump:
if #MENUBUTTON = waiting
goto jump
if #MENUBUTTON = done
{
menu delete done
goto bug
}
if #MENUBUTTON = up
{
set %pic +
if %step >= %count
set %step %count - 1
}
if #MENUBUTTON = down
{
set %pic -
if %step < 5
set %step %count + 1
}
if #MENUBUTTON = returnn
goto bug
if ( #MENUBUTTON = up || #MENUBUTTON = down ) && ( %step >= 0 && %step <= %count )
{
set #MENUBUTTON waiting
set %step %step %pic 1
	Menu Font Color red
 menu delete txt1
	SET %move %step
	if %count > 1
	Menu Text txt1 10 0 %number . %move
	SET %move %step - 1
	if %count > 2
	Menu Text txt1 10 30 %number . %move
 SET %move %step - 2
 if %count > 3
	Menu Text txt1 10 60 %number . %move
 SET %move %step - 3
 if %count > 4
	Menu Text txt1 10 90 %number . %move
 SET %move %step - 4
 if %count > 5
	Menu Text txt1 10 120 %number . %move
	menu show 0 0
	goto jump
	}
	if ( #MENUBUTTON = up || #MENUBUTTON = down )
	set #menubutton closed
	bug:
	if #MENUBUTTON <> done
	{
	goto jump
	}
	menu delete done
	Menu Font Color green
menu button returnn 500 170 100 30 Scanning Mode
	return
	
	sub collect_info
	set %hhh %begin
	while %hhh < %count
	{
	menu button saving 230 170 100 30 Saving files
	set %hhh %hhh + 1
	if %numbe . %hhh <> n/a
	execute CMD.EXE /c echo %numbe . %hhh >> %FILE
}
menu delete saving
if %save = #true
set %begin %count
	return
	
 sub pars
 set %d #spc
 set %name %pars_this
 set %test %pars_this , _
str count %test _
for %cnt 2 #strres
{
  set %tmp %cnt - 1
  str pos %test _ %tmp
  set %tmp #strres + 1
  str pos %test _ %cnt
  set %len #strres - %tmp
  str mid %test %tmp %len
  set %d %d , #spc , #strres

}
str POS %NAME : 1
SET %BACK_ONE #STRRES - 1
STR LEFT %pars_this %BACK_ONE
SET %D #STRRES , #SPC , - , %D
return
