;###################################
;# Text 3D©  Versione 2.0  by JenKrn                           
;# NON MODIFICATE QUESTO SCRIPT                           
;# Creato ad Aprile 2001 - Nuova Versione                 
;# Se avete problemi scrivetemi a jenkrn@tiscalinet.it
;# Buon divertimento !!
;# by JenKrn
;###################################

alias Txt3dsetup {
  if $version < 5.8 { echo -a 4Attenzione!! la versione $version è incompatibile :( usa la v. 5.8 o sup. | halt }
  dialog -m txt3dsetup txt3dsetup
}

dialog txt3dsetup {
  title Text 3D v. II - Setup - by JenKrn
  size -1 -1 1 1
  button  <== Chiudi ==>, 1, 200 380 120 25, ok
  icon 2, -1 -1 330 420, $mircdirText3dii\txt1.jpg
  ;------------------------------- Tipo ------------------------------
  icon 33,  10 89 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  icon 34,  10 119 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  icon 35,  10 149 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  icon 36,  10 179 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  icon 37,  10 209 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  icon 38,  10 239 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  icon 39,  10 269 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  icon 40,  10 299 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  icon 41,  10 329 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  icon 42,  10 359 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 3, 13 93 13 13, push, group 
  radio , 4, 13 123 13 13,push
  radio , 5, 13 153 13 13,push
  radio , 6, 13 183 13 13,push
  radio , 7, 13 213 13 13,push
  radio , 8, 13 243 13 13,push
  radio , 9, 13 273 13 13,push
  radio , 10, 13 303 13 13,push
  radio , 11, 13 333 13 13,push
  radio , 12, 13 363 13 13,push
  ; -------------------- Topic --------------------------
  check , 13, 13 399 13 13, push
  icon 43,  10 395 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  ; -------------------- Stile ----------------------------
  radio , 14, 213 115 13 13,push,group
  icon 44,  210 111 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 15, 251 115 13 13,push
  icon 45,  248 111 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 16, 291 115 13 13,push
  icon 46,  288 111 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  ;
  ;--------------------- Colori ------------------------
  radio , 17, 211 202 13 13,push,group
  icon 47,  208 198 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 18, 239 202 13 13,push
  icon 48,  235 198 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 19, 267 202 13 13,push
  icon 49,  264 198 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 20, 295 202 13 13,push
  icon 50,  292 198 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 21, 211 250 13 13,push
  icon 51,  208 246 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 22, 239 250 13 13,push
  icon 52,  236 246 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 23, 268 250 13 13,push
  icon 53,  265 246 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 24, 295 250 13 13,push
  icon 54,  292 246 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 25, 211 298 13 13,push
  icon 55,  208 294 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 26, 239 298 13 13,push
  icon 56,  236 294 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 27, 267 298 13 13,push
  icon 57,  264 294 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 28, 295 298 13 13,push
  icon 58,  292 294 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 29, 211 346 13 13,push
  icon 59,  208 342 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 30, 239 346 13 13,push
  icon 60,  236 342 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 31, 267 346 13 13,push
  icon 61,  264 342 19 19, $mircdir\Text3dii\quadro.bmp, noborder
  radio , 32, 295 346 13 13,push
  icon 62,  292 342 19 19, $mircdir\Text3dii\quadro.bmp, noborder
}

on *:dialog:Txt3dsetup:init:0: {
  did -h $dname 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62
  /splay $mircdir\Text3DII\Apertura.wav
  %movie = 0 | .timer340 -m 0 1 Apridlg
  did -u $dname 13
  if (%Col1 == $null) || (%Col2 == $null) || (Col3 == $null) { set %Col1 8 | set %Col2 7 | set %Col3 0 | set %id3.T 33 | set %id3.C 47 } 
  if (%Sim1 == $null)  { set %Sim1 ( | set %Sim2 ) | set %TxtTopic off | set %id3.S 44 }
  if (%Col1 ==   8) && (%Col2 ==   7) { did -c $dname   3 | set %id3.T 33 }
  if (%Col1 == 11) && (%Col2 == 10) { did -c $dname   4 | set %id3.T 34 }
  if (%Col1 ==   0) && (%Col2 == 14) { did -c $dname   5 | set %id3.T 35 }
  if (%Col1 ==   0) && (%Col2 == 15) { did -c $dname   6 | set %id3.T 36 }
  if (%Col1 == 13) && (%Col2 ==   6) { did -c $dname   7 | set %id3.T 37 }
  if (%Col1 == 12) && (%Col2 ==   2) { did -c $dname   8 | set %id3.T 38 }
  if (%Col1 == 11) && (%Col2 == 12) { did -c $dname   9 | set %id3.T 39 }
  if (%Col1 ==   7) && (%Col2 ==   5) { did -c $dname 10 | set %id3.T 40 }
  if (%Col1 ==   9) && (%Col2 ==   3) { did -c $dname 11 | set %id3.T 41 }
  if (%Col1 ==   9) && (%Col2 == 10) { did -c $dname 12 | set %id3.T 42 }
  if %Sim1 ==  ( { did -c $dname 14 | set %id3.S 44 }
  if %Sim1 ==  [ { did -c $dname 15 | set %id3.S 45 }
  if %Sim1 == $chr(123) { did -c $dname 16 | set %id3.S 46 }
  if %Col3 ==   0 { did -c $dname 17 | set %id3.C 47 }
  if %Col3 ==   1 { did -c $dname 18 | set %id3.C 48 }
  if %Col3 ==   2 { did -c $dname 19 | set %id3.C 49 }
  if %Col3 ==   3 { did -c $dname 20 | set %id3.C 50 }
  if %Col3 ==   4 { did -c $dname 21 | set %id3.C 51 }
  if %Col3 ==   5 { did -c $dname 22 | set %id3.C 52 }
  if %Col3 ==   6 { did -c $dname 23 | set %id3.C 53 }
  if %Col3 ==   7 { did -c $dname 24 | set %id3.C 54 }
  if %Col3 ==   8 { did -c $dname 25 | set %id3.C 55 }
  if %Col3 ==   9 { did -c $dname 26 | set %id3.C 56 }
  if %Col3 == 10 { did -c $dname 27 | set %id3.C 57 }
  if %Col3 == 11 { did -c $dname 28 | set %id3.C 58 }
  if %Col3 == 12 { did -c $dname 29 | set %id3.C 59 }
  if %Col3 == 13 { did -c $dname 30 | set %id3.C 60 }
  if %Col3 == 14 { did -c $dname 31 | set %id3.C 61 }
  if %Col3 == 15 { did -c $dname 32 | set %id3.C 62 }
  if ($did($calc(%id3.T - 30)).state == 1) { did -v $dname %id3.T }
  if ($did($calc(%id3.S - 30)).state == 1) { did -v $dname %id3.S }
  if ($did($calc(%id3.C - 30)).state == 1) { did -v $dname %id3.C }
}
;---------------------- Tipo -----------------------------------
on *:dialog:txt3dsetup:sclick:3,4,5,6,7,8,9,10,11,12: {
  if $did ==   3 { set %id 33 | %id2.T = %id | %id1.T = %id3.T | %id3.T = %id2.T | set %Col1   8 | set %Col2    7 | Clikka }
  if $did ==   4 { set %id 34 | %id2.T = %id | %id1.T = %id3.T | %id3.T = %id2.T | set %Col1 11 | set %Col2  10 | Clikka }
  if $did ==   5 { set %id 35 | %id2.T = %id | %id1.T = %id3.T | %id3.T = %id2.T | set %Col1   0 | set %Col2  14 | Clikka } 
  if $did ==   6 { set %id 36 | %id2.T = %id | %id1.T = %id3.T | %id3.T = %id2.T | set %Col1   0 | set %Col2  15 | Clikka } 
  if $did ==   7 { set %id 37 | %id2.T = %id | %id1.T = %id3.T | %id3.T = %id2.T | set %Col1 13 | set %Col2    6 | Clikka } 
  if $did ==   8 { set %id 38 | %id2.T = %id | %id1.T = %id3.T | %id3.T = %id2.T | set %Col1 12 | set %Col2    2 | Clikka } 
  if $did ==   9 { set %id 39 | %id2.T = %id | %id1.T = %id3.T | %id3.T = %id2.T | set %Col1 11 | set %Col2  12 | Clikka } 
  if $did == 10 { set %id 40 | %id2.T = %id | %id1.T = %id3.T | %id3.T = %id2.T | set %Col1   7 | set %Col2    5 | Clikka } 
  if $did == 11 { set %id 41 | %id2.T = %id | %id1.T = %id3.T | %id3.T = %id2.T | set %Col1   9 | set %Col2    3 | Clikka } 
  if $did == 12 { set %id 42 | %id2.T = %id | %id1.T = %id3.T | %id3.T = %id2.T | set %Col1   9 | set %Col2  10 | Clikka } 
  if ($did($calc(%id1.T - 30)).state == 0) { if %id1.T != $null { did -h $dname %id1.T } }
  if ($did($calc(%id - 30)).state == 1) { did -v $dname %id }
}
;---------------------- Topic --------------------------------
on *:dialog:txt3dsetup:sclick:13: {
  if $did(13).state == 1 { did -v $dname 43 | set %TxtTopic on | Clikka }
  if $did(13).state == 0 { did -h $dname 43 | set %TxtTopic off | Clikka }
}
;---------------------- Stile ----------------------------------
on *:dialog:txt3dsetup:sclick:14,15,16: {
  if $did ==  14 { set %id 44 | %id2.S = %id | %id1.S = %id3.S | %id3.S = %id2.S | set %Sim1 ( | set %Sim2 ) | Clikka }
  if $did ==  15 { set %id 45 | %id2.S = %id | %id1.S = %id3.S | %id3.S = %id2.S | set %Sim1 [ | set %Sim2 ] | Clikka } 
  if $did ==  16 { set %id 46 | %id2.S = %id | %id1.S = %id3.S | %id3.S = %id2.S | set %Sim1 $chr(123) | set %Sim2 $chr(125) | Clikka } 
  if ($did($calc(%id1.S - 30)).state == 0) { if %id1.S != $null { did -h $dname %id1.S } }
  if ($did($calc(%id - 30)).state == 1) { did -v $dname %id }
}
;---------------------- Colori ---------------------------------
on *:dialog:txt3dsetup:sclick:17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32: {
  if $did == 17 { set %id 47 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3   0 | Clikka }
  if $did == 18 { set %id 48 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3   1 | Clikka } 
  if $did == 19 { set %id 49 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3   2 | Clikka } 
  if $did == 20 { set %id 50 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3   3 | Clikka } 
  if $did == 21 { set %id 51 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3   4 | Clikka } 
  if $did == 22 { set %id 52 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3   5 | Clikka } 
  if $did == 23 { set %id 53 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3   6 | Clikka } 
  if $did == 24 { set %id 54 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3   7 | Clikka } 
  if $did == 25 { set %id 55 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3   8 | Clikka } 
  if $did == 26 { set %id 56 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3   9 | Clikka } 
  if $did == 27 { set %id 57 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3 10 | Clikka } 
  if $did == 28 { set %id 58 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3 11 | Clikka } 
  if $did == 29 { set %id 59 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3 12 | Clikka } 
  if $did == 30 { set %id 60 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3 13 | Clikka } 
  if $did == 31 { set %id 61 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3 14 | Clikka } 
  if $did == 32 { set %id 62 | %id2.C = %id | %id1.C = %id3.C | %id3.C = %id2.C | set %Col3 15 | Clikka } 
  if ($did($calc(%id1.C - 30)).state == 0) { if %id1.C != $null { did -h $dname %id1.C } }
  if ($did($calc(%id - 30)).state == 1) { did -v $dname %id }
}
;---------------------------- Termina ------------------------
on *:dialog:txt3dsetup:sclick:1: {
  set %mytext.txt Esempio | provaTxt | /splay $mircdir\Text3dii\Uscita.wav
}

alias Apridlg {
  if (($dialog(Txt3dsetup) == $null) || (%movie > 180)) { .timer340 off | unset %p* %movie | return }
  :1 | %px = $calc(($window(-1).w / 2) - 180) | %py = $calc(($window(-1).h / 2) - 180) | %pw = 330 | %ph = $calc(%movie * 5/2.14)
  dialog -s Txt3dsetup %px %py %pw %ph | inc %movie 30
}

on 1 :INPUT:#:{
  set %mytext.txt $1-
  if $pos(%mytext.txt,§) == $null { goto termina }
  set %inizio $calc($pos(%mytext.txt,§) + 1)
  if ($pos(%mytext.txt,§) == $null) { set %fine $len(%mytext.txt) }
  else { set %fine $calc($pos($mid(%mytext.txt,%inizio,$len(%mytext.txt)-%inizio),§) - 1) }
  if %fine == -1 { set %fine $len(%mytext.txt) }
  set %Text.3d $mid(%mytext.txt,%inizio,%fine)
  set %conta 1
  set %mytext  $chr(32)
  :next
  if ($mid(%Text.3d,%conta,1) == $null) { goto fine }
  if ($mid(%Text.3d,%conta,1) == $chr(32)) { set %Text.3d.space 1,14 %Sim1 15 %Sim2 }
  else { set %Text.3d.space  $+ %Col1 $+ , $+ %Col2 %sim1  $+ %Col3 $mid(%Text.3d,%conta,1) 1 %sim2  }
  set %mytext  $remove(%mytext,$chr(32)) $remove(%Text.3d.space,$chr(32))
  inc %conta 1
  goto next
  :fine
  %mytext = $remove(%mytext,$chr(32))
  %mytext = $remove($replace(%mytext.txt,%Text.3d,%mytext),§)
  if %TxtTopic == off { say %mytext  | set %TxtTopic off }
  if %TxtTopic == on { topic # %mytext | set %TxtTopic off }
  unset %mytext %mytext.txt %Text.3d.space %conta %Text.3d %inizio %fine | halt
  :termina
}

alias ProvaTxt {
  set %conta 1
  set %mytext  $chr(32)
  :next
  if ($mid(%mytext.txt,%conta,1) == $null) { goto fine }
  if ($mid(%mytext.txt,%conta,1) == $chr(32)) { set %mytext.space 1,14 %Sim1 15 %Sim2 }
  else { set %mytext.space  $+ %Col1 $+ , $+ %Col2 %Sim1  $+ %Col3 $mid(%mytext.txt,%conta,1) 1 %Sim2  }
  set %mytext $Remove(%mytext,$chr(32)) $remove(%mytext.space,$chr(32))
  inc %conta 1
  goto next
  :fine
  %mytext = $remove(%mytext,$chr(32))
  if %TxtTopic == off { echo -a 4 Ora scriverai così: %mytext }
  if %TxtTopic == on { echo -a 4Topic 3D attivato - ora scriverai così: %mytext }
  unset %mytext %mytext.txt %mytext.space %conta
}

alias Clikka { 
  /splay $mircdir\Text3DII\Clikka.wav
}

menu channel {
  -
  Text 3D II setup:Txt3dsetup
  -
}
