Ideen zu Ubasix

CHDK-Skripte, CHDK-Entwicklung, PC-Zusatzprogramme, Informationen für Tüftler

Ideen zu Ubasix

Beitragvon Caefix » 15.06.2018, 20:31

print ^{=) Hello world.^

Code: Alles auswählen
--[[
Bin bisher ohne hohes C zurechtgekommen, kann mir das mal jemand in Turbo-Pascal übersetzen?
Dann würde ich dieses Ubasic- Fahrrad erst mal so pflegen:


1. print
   ! alias = ?
     Das kennt man noch von früher & spart Platz bei langen Skripten.
   ! write "blah" -- nur Konsole
   ! log    "blah" -- nur Datei, wenn definiert.   
 
:roll:
Code: Alles auswählen
  2. let etwas ausführlicher parsen
   if () then let a=1:b=a:c=get_mode:d=d+1:... else rem endif&zigmsgezeter :)
      {let= "cut"+let_statement bis ':'=0 }
   

3. gosub "machmalbitte" a,b+c,1,1,..... 
   rem wäre der Hit!
   end
   :machmalbitte
    if $0<4 then print "Fertix!"
     for i=1 to $1
         write $2,$3
         play_sound $4
         next i
    shift 4
    if $1<>$$ then goto "machmalbitte"
   rem $0=paramcount-shifts
   rem $$(|?$-1)= letzter Wert

   {Dieses Konstrukt könnte man auch "call" nennen, eine Instanz genügt.}
   ! Dann wäre noch ein data a,b,... möglich, wie ein call ohne gosub.
   {data ='cut'+let_statement bis ','=0
         Generiert beides die glokalen Variablen $0-$9 +$$ }

4.  Max 8kb Text.bas?
   ! Platzsparend einlesen
     (cut nach rem)
     (ohne führende spaces
           { +? z.B. nach case- Treffer bräuchte nur vertikal nach zeile_chr[1]='e' gesucht werden.)
    ! Neues Label, etwa ":rem"
     Markiert definitiv die letzte Zeile, die eingelesen wird.
   ? Erste ernstgenommene Zeile @title ...
     ? Bereich darüber über Befehl "help" einblenden oder list wenn ohne @title
        ? Am Ende ein memavail generieren.
    
5.  @error als Parameter [xxx]
       {Für Skripte in Entwicklung}
       Wenn [xxx]>0 Listing ab Zeile xxx statt Skriptstart
     
    
6.  md_detect_motion( a, b, c, d, e, f, g, h[=x], i, j, k, l, m, n, o, p[,md_detect_motion_frame_color]
     ! {Schalten, wenn h=x}
    ? md_vals addieren bis >=f ,wenn x
   

7.  ! @range würde die Eingabe überprüfen.

     ! @values s der Gag überhaupt
       @default s 1
       rem würde nicht Gag gegen 1 tauschen.
   
8.   So, da spart eine Lua-Brücke den Weg zum PC sogar zum Umbenennen... 
:D
Code: Alles auswählen
      scriptiX.lua; = auch Bedienungsanleitung, für die Neugierigen & Feinheiten... Eigentlich der Gag überhaupt!
      Eine Art com.for.table-Zeilen-Tetris-Textadventure, wird einfacher als es aussieht;)

      Eine v. vielen Anwendungen:
          Das Skriptchen ersetzt '^' durch '"'! {goto ^#fun^, click ^up^...}
          die '"' bringt man nämlich mit Ubasic nicht in LOG_xxxx.TXT.
          Mit der '^' Alternative kann man tatsächlich unterwegs skriptende Skripte "loggen".
          diese sind u.U. sofort ausführbar, mindestens testbar.
      Eine andere:
          ... Skript testen, Fehlerzeile & ".XxX" etc. einstellen, Zeile schreiben, Skript testen ...


9. erledigt:

:) Da habe ich schon mal ein LOG_0042.bas vorbereitet. ]]--

@title Caefix_is_there_a_script_scripter
:begin
print_screen -42
print ":begin"
print "@title Deep Thought"
print "@chdk_version 1.4"
print "print ^{=) Hello world.^"
print "playsound 3"
print "end"
print_screen 0
end

~~~~~~----------^^^^^---------~~~~~~~ [ So, da ist schon mal ein Seil gespannt... :D ] ~~~~~~----------^^^^^---------~~~~~~~
Code: Alles auswählen
@title keylogiX.bas (vor skriptiX.lua)
@chdk_version 1.4
@param L LOG_~.TXT (+Neu|-Anh|0=gec)
@default L 42
@param M Modus
@default M 2
@param w Laufzeitbremse
@default w 0
@param U {}@
@default U 1
@subtitle zoom + 1/2 = Errormanegement
@param K [<^>v set menu (face)] + F
@values K none display help video print face
@param F F=##insert Methode
@values F Taste Loop md-foc M-md foc-md F-md-M f-w-md
@param H md_Typus
@values H slow fast
@param Q Helfer
@values Q NurTsu! Spidix! Zufix! WoTsu? Licht! Nerfix!
@param Y Zuschlatbare Fehler
@values Y Isnix Machnix

A=1
t=1000
a=get_av
c=get_capture_mode
e=get_ev
D=5+(Q=2)*random -2 5
E=Q*3
I=get_iso_mode
k=0
L=L+(L=0)*get_exp_count
M=(is_capture_mode_valid M)*M
N=0
O=get_zoom_steps
T=get_tv
w=w*(Q>2)
z=0


goto "#begin"

:##time
print "rem",get_time 5;"/";get_time 4;"/";get_time 3,"#",get_time 2;":";get_time 1;":";get_time 0
return

:##time2
rem !! Ubasic Voodoo !! max 40 !!
print "print F,-get_time 3,get_time 2,get_time","1,get_time 0"
print "playsound 5"
return



:#begin
 set_capture_mode M
 sleep t
 set_aflock 1
 print_screen L
 gosub "##time"
 gosub "##head"
do
 gosub "##keys"
until O
goto "restore"
:#end


:##keys
set_lcd_display 1
playsound 2
do
 k=0
 wait_click 1
 if is_pressed "shoot_half" then k=29
 if is_pressed "face" then k=1
 if is_pressed "up" then k=2
 if is_pressed "video" then k=3
 if is_pressed "left" then k=4
 if is_pressed "set" then k=5
 if is_pressed "right" then k=6
 if is_pressed "display" then k=7
 if is_pressed "down" then k=8
 if is_pressed "menu" then k=9
 if is_pressed "help" then k=11
 if is_pressed "print" then k=16
 if is_pressed "zoom_in" then k=22
 if is_pressed "zoom_out" then k=24
 if k*(A=1) then gosub "##log"
until E>2
return

:##log
playsound 4
if (K*k=5)+(Q=1) then return
k=k+Q*t
select k
  case 1; click "face"
  case 2; click "up"
  case 4; click "left"
  case 5; click "set"
  case 6; click "right"
  case 8; click "down"
  case 9; click "menu"
  case 29; E=E+1
  case 22,24; gosub "##zoom"
  case_else gosub "##fun"
end_select
sleep 99
select k
  case 1; print "  click ^face^"
  case 2; print "  click ^up^"
  case 4; print "  click ^left^"
  case 5; print "  click ^set^"
  case 6; print "  click ^right^"
  case 8; print "  click ^down^"
  case 9; print "  click ^menu^"
  case 29; gosub "##baustelle"
end_select
print "   sleep 99"
return

:##baustelle
 playsound 6-E
 gosub "##pause"
 if (get_mode=1)+(E=2) then print "   gosub ^##pause^"
 print "   playsound",6-E
 if E=1 then return
 if E=3 then gosub "##todo"
 if E=3 then return
A=0
gosub "##keys"
A=1
select k
  case 1; print "rem ^face^"
  case 2; print "rem ^up^"
  case 4; print "rem ^left^"
  case 5; print "rem ^set^"
  case 6; print "rem ^right^"
  case 8; print "rem ^down^"
  case 9; print "rem ^menu^"
end_select
select k
  case 1; Q=3
  case 2; print "*?"
  case 5; print "*="
  case 4; print "*-"
  case 6; print "*+"
  case 8; print "*!"
  case 9; print "*^:)"
  case 29; gosub "##todo"
end_select
:)
return

:##zoom
E=(get_mode=1)
if (k-E)=24 then print "rem Error ^---^"
while E
 if k=22 then click "zoom_in" else click "zoom_out"
 sleep 99
 if k=22 then print "click ^zoom_in^" else print "click ^zoom_out^"
 print "  sleep 100+",k
 playsound 4
 E=0
wend
return


:##fun
playsound Q
 while Q=2
    F=random 0 6
    H=random 0 1
    Q=random 1 3
    wend
 while Q=4
    gosub "##foc"
   Q=get_tv96>768
    md_detect_motion 5-Q,5+Q,Q,4*Q*t,t,99,3,Q,Q+1,2,2,1,3,Q,Q,Q
   Q=4*(Q=0)
    wend
 for Q=Q-(Q=5) to Q-1 do
  print "print ^rem -- EYn VV^ldschvveYn!^"
  next Q
 rem    vid;  disp;   prn;    help;    face
 if Q+((k=K)+(k*K=7)+(k/K=4)+(k*K=22)+(k*K=5)+K=0) then return
:##insert
 if (Y=1)-(Q=1) then break
 if F<7 then gosub "##loop"
 if F=9 then rem :)
 z=z+1
return


:##todo
gosub "##pause"
return


:##_md
rem !! Ubasic Voodoo !!
if Q=3 then H=t
if H=t then print "h=(get_tv96>768)|is_pressed ^right^"
select H
   case 1; print "md_detect_motion a,b,1,w*t,9,f,3,h,i,","j,k,j+(a%2=0)-(a=2),k+(b%2=0)-(b=2)",",n,3,9"
   case t; print "md_detect_motion a,b,1,w*t,e,f,3,h,i,","j,k,j-h,j,k,k+h,h,3,9"
 case_else print "md_detect_motion a,b,1,w*t,t,f,3,h,i,","j,k,j+(a%2=0)-(a=2),k+(b%2=0)-(b=2)",",n,2,99"
end_select
print "  release ^shoot_full^"
return

:##loop
print " "
print "do"
print " Y=get_free_disk_space"
 if F%2=1 then print " wait_click w*t"
 print "if is_pressed ^menu^ then exit_alt"
 if (F=2)+(F=3) then gosub "##_md"
 gosub "##foc"
 if (F=4)+(F=5) then gosub "##_md"
 if F%2=0 then print " wait_click w*t"
 if Q=5 then gosub "##pause"
 if F=6 then gosub "##_md"
 gosub "##sht"

 if F=x then rem gosub "##baustelle" ??:)
print "until get_mode=1"
print " "
return


:##head
print "@title Keylogix",L,-100*Y-10*F-Q
print "@chdk_version 1.4"
print "rem",U;"@ PS";get_propset;"  PID:";get_platform_id
print "@param a Dim md_feld #"
print "@range a -11 11"
print "@default a",D
print "@param e CompInterv *10 (ms)"
print "@range e 1 999"
print "@default e 3"
print "@param f Reizschwe!!e"
print "@range f -128 255"
print "@default f 5"
print "@param w wait (s) | [.]"
print "@default w 30"
print "@param U {0}@"
print "@default U ",U
print " "
print "t=";t
print "C=get_capture_mode"
print "A=get_av"
print "E=get_ev"
print "F=get_exp_count"
print "I=get_iso_mode"
print "X=w<=0"
print "Q=";-100*Y-10*F-Q
print "T=get_tv"
print "e=e*10"
print "f=f&255"
print "i=(a>4)+2*(a<-2)"
print "a=a-2*a*(a<0)"
print "b=a"
print "j=(a+1)/2"
print "k=(b+1)/2"
print "n=X|";F%2
print "w=w-2*w*(w<0)"
print "rem",get_prop 0,"IS";get_IS_mode,"ND";get_nd_present,"(";get_zoom;")<";O
print "if get_platform_id=";get_platform_id,"then set_capture_mode",M,"else end"
print "playsound 2+",F%2
print "print_screen -t"
gosub "##time2"
print " "

:###include
:)>
 print "goto ^#begin^"
 gosub "#foc"
 gosub "#sht"
 gosub "##sd"
 gosub "#pause"
 z=1
 print "*#*"
 print ":#begin"
 print "*=*"
 print " "
:)<
return


:##tail
print " "
print ":restore"
print " print_screen 0"
print " set_aflock 0"
print " set_av A"
print " set_capture_mode C"
print " set_ev E"
print " set_iso_mode I"
print " set_tv T"
print "end"
print " "
print ":end"
gosub "##time"
return


:##foc
 set_aflock 0
 press "shoot_half"
 do
  sleep 99
 until get_shooting
 set_aflock 1
 release "shoot_half"
if Q<>4 then print "gosub ^##foc^"
if Q+z then return
:#foc
print " "
print ":##foc"
print " set_aflock 0"
print " press ^shoot_half^"
print " do"
print "  sleep 99"
print " until get_shooting"
print " set_aflock 1"
print " release ^shoot_half^"
print "print F,get_zoom,-get_focus,h-t"
print "return"
return

:##sht
print "gosub ^##sht^"
if z then return
:#sht
print " "
print ":##sht"
print "for y=1 to (h*n>0)+";"(h=0)*is_pressed ^menu^"
print " if h=0 then shoot"
print " gosub ^##sd^"
print " next y"
print "return"
return


:##sd
print " "
print ":##sd"
print "h=0"
print "playsound 1"
print "do"
print " h=h+3"
print "until Y>get_free_disk_space*(h<=t)"
print "print -F,S-h,get_focus,U"
print " F=F+1"
gosub "##time2"
print "return"
return

:##pause
playsound 4
console_redraw
do
 sleep 42
until not is_pressed "shoot_half"
if w+(Q=5) then print "   gosub ^##pause^" else wait_click t*(w+Q)
if z then return
:#pause
print " "
print ":##pause"
print "playsound 4"
print "console_redraw"
print "do"
print " h=h+42"
print " sleep 42"
print " if (h>t) and get_shooting then"
print "  shoot"
print "  gosub ^##sd^"
print " endif"
print "until (is_pressed ^shoot_half^=0)+(h>t)"
print "return"
print " "
return

:restore
print "*@*"
playsound 2+F%2
print "playsound n*3"
print "wait_click 0"
print "gosub ^##foc^"
if z=1 then gosub "##loop"
gosub "##tail"
print_screen 0
print U;"> @title keylogiX",L,-100*Y-10*F-Q
sleep t
set_aflock 0
set_av a
set_capture_mode c
set_ev e
set_iso_mode I
set_tv T
E=0
end

:rem @
rem @
rem mittelfristig selbsterklärend
rem Das Potential() ist unergründlich.
rem Ein Skript zu jedem Bild?
rem MaaachsMöööööglix!!     --  EYn ^VV^ldschvveYn!^
begin()

~~~~~~----------^^^^^---------~~~~~~~ [ Scriptographieren auf Knopfdruck, da können wir uns auf die Fotos skriptender Katzen etc. freuen. ] ~~~~~~~----------^^^^^---------~~~~~~

99. ? Reguläre Ausdrücke {können wir Goethix überlassen} :)

Herzl. Grüße, Caefix!

P.S. Weniger Clicks zum Textviewer wäre nett.
Zuletzt geändert von Caefix am 14.07.2018, 18:25, insgesamt 14-mal geändert.
Caefix
CHDK-Einsteiger
CHDK-Einsteiger
 
Beiträge: 8
Registriert: 15.06.2018, 20:14
Kamera(s): Einige!

Re: Ideen zu Ubasix

Beitragvon msl » 18.06.2018, 22:46

uBASIC für CHDK ist schon minimalistisch gehalten und wird keine weiteren Veränderungen oder Ergänzungen erhalten. Das Thema ist abgeschlossen. Dafür gibt es Lua.

Den Textviewer kann man schnell erreichen, wenn man das Benutzermenü entsprechend einrichtet.

Gruß msl
■ "Hey you, don't tell me there's no hope at all. Together we stand, divided we fall."CHDK inside FAQCHDK-Neuigkeiten auf Twitter
Benutzeravatar
msl
Super-Mod
Super-Mod
 
Beiträge: 4540
Bilder: 271
Registriert: 22.02.2008, 12:47
Wohnort: Leipzig
Kamera(s): A720 1.00c
SX220 1.01a

Re: Ideen zu Ubasix

Beitragvon Caefix » 20.06.2018, 19:58

_______________________________[ "~~~^^~~~~~~~~~~~~~~~... Projektmonitor {=) Hier geht´s !noch! weiter \:D/ ...~~~~~~~~~~~~~~~^^~~~" ]______________________________
_______________________________[ "~~~^^~~~~~~~~~~~~~~~... im Notepad++ (language LUA) wird´s bunt \:D/ ...~~~~~~~~~~~~~~~^^~~~" ]_____________________________

Code: Alles auswählen
--[[
      \./
AH-Lua !
      
Herzlichen Dank für´s Mitdenken!
{Und das wollte ich mir für den Winter aufheben?}

--   {  ...  vorläufiger Traum schlafloser Nächte ... @title !Lunixe.lua-- ...  }   ~~==xxxxxxxxx< 29192 >XXXXXXXXX]]--
---  (LUA-Voodoo??, for..io.lines frißt Speicher... )
--[[
@title scriptiX.Lua
@chdk_version 1.4
--- (D,E,2,9,1,-2,F,0,0,0,C,A,Z,G,1,88
  --(D,E,H,T,P, L,F,R,I,J,C,A,Z,G,W,U)
@param D Startordner
@values D SCRIPTS LOGS BOOKS HELP (.scX)
@param E Endung
@values E .Lua .bAs >>.tXt .baK .tmp .lOg .scX .XxX
@param H Helfix
@values H --- HELP/ LOGS/ SCRIPTS/ BOOKS/ german ???
@param T Trix & Errorix
@values T ??? dofile loadfil loadstr ---
@param P bearbiten  +ab|0>_|-letzte
@default P 1
@param L edit Zeile  xxx>_ (!-=^^=!)
@default L 2
@param F finde Zeile
@values F --- fun() for while until then else ---><: #^^%q%q
@param R --- /rem Zeilen?
@values R KEEP -cut- >Parse
@param I *?* Insertix
@values I nein JA
@subtitle :...,....1....,....2....,....3....,....4....,....5
@param J Layoutix?
@values J nein JA
@param C Kürzen            (!-=RO=-!)
@default C 0
@param A Ab Zeile  (|0=noNr)
@default A 1
@param Z Bis Zeile (|0=crLf|-letzte)
@default Z 9999
@param G LOG_~.TXT (|0=gec|+Neu|-Anh)
@default G -999
@param W Laufzeitbremse
@default W 4
@param U {}@
@default U 1
--]]
 
 
 
function help(...)
repeat
 local str=...
 local lin=...
 local x=0
 local k=0
 local l=t
for ee,lin in pairs(_G) do x=x+1;
    if G<11 then golog(ee,lin) end
    print(x,-collectgarbage("count"),ee,lin); wait(0) end
 collectgarbage()
 x=0
 if ...=="" then str="L" end
 if ...==nil then str="X" end
 hfile="A/CHDK/HELP/"..str
 if #str==1 then hfile=getstr("ß",str) end
 for lin in io.lines(hfile) do x=x+1
   if string.find(lin,find_str)~=nil then k=0; l=t end
   local ii=1
   while lin~="" do
     if k==8 then ii=0 end
     for i=1,ii do str=lin; print(-x,str)
       if k~=8 then k=0 end
       l=l+1+#str/44
       while l>11 and k==0 do l=1; k=getkey(4)
         if k==2 then l=t
            str=edlin(str); Go=golog(str)
          if string.sub(str,1,4)=="    " then k=0 end end
         if k>22 or k==6 then l=t end
         while k==29 do k=0
            if ti>t then prompt(0,str) elseif ti>333 then prompt(42,str) end
            Go=golog(str) end
      end end --ii
   lin="" end -- wh lin
 end --io
 k=getkey(5) --,collectgarbage("count"),err)
 collectgarbage()
until k~=5
return x
end
 
function golog(...)
 local l=get_exp_count()
 if G~=0 then l=G end
 print_screen(l)
 set_console_autoredraw(-1)
 print(...)
 set_console_autoredraw(1)
 if G>0 then Glog=stf("A/CHDK/LOGS/LOG_%04d.TXT",G); G=-G end
 print_screen(0)
return l
end
 
function img_info(x,...)
local str=get_image_dir().."/IMG_"
 for i=1,x do print(...); print(os.time()) end
 str=printf("%s%04d.JPG",str,get_exp_count())
k=5
return str
end
 
function klix(x,...)
repeat
  repeat local k=0
    set_aelock(0)
    set_aflock(0)
    press("shoot_half")
    repeat sleep(42)
      iii=get_free_disk_space()
    until get_shooting() and not is_pressed("shoot_half")
    set_aflock(1)
    set_aelock(1)
    press("shoot_full")
    play_sound(1)
    release("shoot_full")
    repeat sleep(t); k=k+1
      kkk=get_free_disk_space()
      play_sound(4)
    until iii>kkk or k==7
    release("shoot_half")
  until not is_pressed("shoot_half")
  repeat k=getkey(x*t+5)
     if k==8 or x==1 then img_info(x,...); x=0 end
     if k==5 then exitalt(5,"*<alt>"); k=getkey(5) end
 until k~=5
until k~=29
return k
end
 
function exitalt(x,...)
 play_sound(x);
 k=getkey(t);
 exit_alt();
 repeat sleep(444) until get_alt_mode();
 k=getkey(t);
 k=getkey(5,...);
 pau=t
return k
end
 
function wait(w)
 local t=get_tick_count()
 repeat wait_click(w*100+1)
 until not is_pressed "right"
 t=(get_tick_count()-t)/100
 if t>1 and t<22 then W=t end
 if is_pressed "down" then sleep(99)
    if W>0 then W=W-1 end end
return t
end
 
function printf(...)
  local str=string.format(...)
  print(str)
return  str
end
 
function stf(...)
  local str=...
  str=assert(string.format(...),rem..str)
return str
end
 
function split(sep,...)
  local str=...
  local x=string.find(str,sep)
  if x==nil then sep="" else
     sep=string.sub(str,x+#sep,t); str=string.sub(str,1,x-1) end
return str,sep
end
 
--- ::...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
 
function begin(...)
local E=0
if ...~=nil then print(...) end
   log42 = file_browser("A/CHDK/"..dd)
   basfile=log42
   if U==0 then E=1; rem="--- " else
   for zeile in io.lines(log42) do X=X+1
       if zeile>"" and string.sub(zeile,1,2)=="--" then
          bug=-1-bug; rem="--- " end
       for ee in string.gmatch(zeile,"\34") do E=E+1 end
       bug=bug or E%2
       if bug>0 and L>=0 then L=-X
          if P<X then P=X+1 end end end
--- -
       print(X,collectgarbage("count"))-- so zum Zuschauen wie der Speicher schwindet.
--- -       if X%42==0 then collectgarbage() end --!! genau hier u.U. sehr wichtig.
   end --forX
   if E>0 then
      if L==0 then L=2 end
      if L>0 then L=-L end end
   if bug>0 then play_sound(6) end
   collectgarbage()
 
   if RW then
      for x=1,rw do
          if eXt==".scX" then os.mkdir(mdX) end
          if eXt==".XxX" then ubasic="xyx00xyx" else ubasic="fertiX"
--- -        ubasic=" |\\fertiX" -- die Striche können weg, sonst getstr...
          ubasic=textbox(stf("%d rw %s",collectgarbage("count"),dd..pc..eXt),os.date(),ubasic,9)
           end end
      if ubasic=="" then ubasic="!!IXIXIX" end
      if ubasic==nil then basfile=erriX else basfile=mdX..ubasic..eXt end
      if string.sub(ubasic,1,1)==" " then ch4=string.sub(ubasic,2,1)
         basfile=file_browser("A/CHDK/"..dd) end
      if log42==basfile then print("*<  >>--->"..mdX.."tempX"..eXt.." >")
         basfile=mdX.."tempX"..eXt end
      if log42==basfile then RW=false end end
   if RW then ee="rw"; rw=1 else ee="RO"; rw=0 end
 
   if F>0 then local Fnd={"function (x,...)",
      "for =*+-,,???remd_---","while (<=~=>)","until (<=~=>)",
      "if (<=*+-~=>) and or then","=elseif <=~=>gosubto##",
      "--- 88><:","*:##==^^\34\34\\\\","???"}
      find_str=textbox(basfile,pc..ee..lineal,Fnd[F],t)
      find_str,rep_str=split("><",find_str)
      if find_str=="" then find_str=" " end end
   FI=#find_str>1
   sec=get_tick_count()
   printf(rem.."<>> %d %s %d",X,basfile,-bug*t)
   if A>X then A=X end
   if P<0 then P=X+P end
   if P>X then P=X+1 end
   if Z<0 then A=X-Z; Z=X end
   if Z>X then Z=X end
   remV=rem.."<"
   rC=string.sub(rem,1,1)
   basline=lineal
   --basline=ubasic
end
 
function nubas(camera_name)
txt=io.open(log42,"r")
if RW and not TF then bas=io.open(basfile,wa)
   RV=P==P; writeln(rem.."< scriptiX für "..camera_name.." >")
   RV=P==P; writeln(rem.."< "..os.date().." >") end
end
 
function head(...)
if ...~=nil then print(...) end
local bi=get_buildinfo()
nubas(bi.platform)
if RW then RV=P==P;
   writeln(printf("%s  %d%s ",remV,U,"@ -- "..pc..ubasic..eXt.." >"))
   else printf("%s %s ",remV,string.upper(bi.platform).." >") end
end
 
 
function readln(...)
if Z-C*rw>Li then
   if A<Z then x=1
      while x<A do x=x+1; ee=txt:read()
         if string.find(ee,"*]",1,1)~=nil then A=0 end
         if tpx~=nil then tpx:write(ee,crLf) end end
      Li=Li+x-1 end
 
   zeile=txt:read()
   Li=Li+1
   if RW and (if_x==t) and (L==Li or L==-Li) then zeile=edlin(zeile) end
   if zeile=="" then zeile="  " end
   if if_x<t then cb1=string.sub(zeile,1,1)
      if cb1=="*" and not RV then zeile=ins_block(zeile) end
      if cb1==rC and string.sub(zeile,1,4)==rem and #zeile>4
        then zeile=rem_block(zeile) end end
   size_r=size_r+#zeile
end
if P<Li then P=Li end
return zeile
end
 
function play_string(x,...)
local str=...
   lenz=string.len(...)
   E=0
   for i=1,bug*lenz do
       if string.sub(...,i,i)=="\34" then E=E+1 end end
   while E+bug==0 do E=2
      if (L>=0) and (string.find(...,"^",1,1)~=nil) then str=""
        for i=1,lenz do ee=string.sub(...,i,i)
           if ee=="^" then E=E+1; ee="\34" end
             str=str..ee
             end end end
   Err=E%2
   for E=1,Err do Error=Error+t
       str=str.."\34"
       writeln(printf("%s %d %s %d",rem.."< "..pc,Li," EYn ^VV^ildsch^vv^eYn!  >",Lo))
      play_sound(2)
       wait_click(W*t)
       if RW and x~=0 then str=edlin(str) end end
return str
end
 
function newline(x,...)
local str=...
   if (bug==0) and (L>=0) and (string.find(...,"^")~=nil)
      then str=play_string(x,...) end
   if TO then print(str)
      elseif (Li==Lo) then print(Li,pc.." ",str..";")
      else printf("%d%s %d",Li,pc..str..";",Lo) end
      --else printf("%d%s %d",Li,pc..str..";",collectgarbage("count")) end
   ti=wait(W)
   if ti>t then II=II end
return str
end

function writeln(...)
local str=...
if str~=nil then
   if FI and k~=t and (string.find(...,find_str)~=nil) then
      if rep_str=="" then k=getkey(9)
         if RW and (k~=8) then str=edlin(str); pau=t end end
      if #rep_str==1 then local i=tonumber(rep_str)
         if i~=nil and repZ>-1 then repZ=i else repeat
            if rep_str=="@" and repZ>-1 then
               zeile,str=split(seP,str); writeln(zeile) end
            if rep_str=="{" then str=split(seP,str) end
            if rep_str=="}" then zeile,str=split(seP,str) end
            if rep_str=="/" then str=mdX..str end
            if rep_str=="-" then str=string.sub(str,6,t) end
            if rep_str==":" then str=string.sub(find_str,1,5)..str end
            if rep_str==">" then str=string.upper(str) end
            if rep_str=="<" then str=string.lower(str) end
            if rep_str=="!" then golog(str) end
            until o==o end end
      if #rep_str>1 then
         if string.sub(rep_str,1,4)==rem or
            string.sub(rep_str,-1,1)==";" then str=rep_str..str
         elseif string.sub(rep_str,1,1)==";" then str=str..rep_str
         else if repZ>-1 then str=string.gsub(...,find_str,rep_str)
         end end end end
   for i=1,rw do
      if R~=1 and (str=="") or str==("**") then
         str=printf("%s%d %d",rem..":-)",Li,Lo) end
      if io.type(bas)~="file" then TF=P==P; play_sound(6)
         bas=io.open(erriX,"w") end
         --tfil=io.tmpfile() end
         --bas=io.open(basfile,"a") end
      if RV or string.sub(str,1,5)~=remV then
         if rep_str=="." then repZ=0 end
         if repZ<0 then repZ=-repZ end
         for x=1,repZ do Lo=Lo+1; bas:write(str..crLf)
             size_w=size_w+string.len(str) end
         RV=1<1; repZ=1 end
    end --for
end end
 
 
function tail(x)
 play_sound(1-bug)
 for i=1,rw do k=getkey(2222)
     if k>19 then arX=newline(1,arX); writeln(rem..arX) end
     if TF then --bas=io.open(basfile,"a")
        --for zeile in io.lines(tfil) do writeln(zeile); collectgarbage() end
        end
---
end end
 
function done()
if RW and eXt==".XxX" then RW=1<1
   txt:close()
   bas:close()   
   os.remove(log42)
   os.rename(basfile,log42)
   basfile=log42
   RR=1<1 end
 print(X,-Li,Lo,-size_r,size_w,-Error)
 print(U,basfile," in s",(sec-get_tick_count())/t)
 k=getkey(5)
 for x=13,0,-1 do
     set_console_layout(0,0,x*3,x)
     console_redraw()
     sleep(88) end
end
 
 
--- ::...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
function prompt(x,...)
 local str=...
 local z=0
 if str==nil then str="" end
 if x<0 then x=getkey(-x,...) end
 while x==t do x=0; local fil=str
    if io.type(fil)=="nil" then x=1 else
    for str in io.lines(fil) do z=z+1
        if str>"" then cb1=string.sub(str,1,1)
           if cb1=="*" then str=ins_block(str) end
           if cb1==rC  and string.sub(str,1,4)==rem and #str>4
              then str=rem_block(str) end end
        x=dostr(-z,str)
        collectgarbage() end--for
    if x==0 then II=II else x=0; str="  "  end end
    end --wh
 ---
 while x==42 do x=0;
    str=textbox(stf("%d:%s",-z,basline),...,str,t)
    end--wh
 if x>0 then
    str=textbox(stf("%d:%s",-z,basline),...,
   '--- < pc=">"; acT=0; repZ=1; --=*+-\\\\""; =*+-; --'..str,t)
    end
 if str~=nil and string.sub(str,1,2)~="  " then dostr(-z,str) end
 if repZ>1 then str=basline.." " end
 ---
return str,z
end
 
function dostr(z,...)
local str=...
local i=#str
local as=0
k=0
print(str); wait_click(t)
--- -  if string.sub(str,1,2)=="A/" then as,str=pcall(run(2,str)) else
  as=assert(loadstring(str,str))()
--- -  end
  if as==0==0 then i=-i
     else k=getkey(5,stf("%d:",z),str); ch4="E" end
return i,k
end
 
 
function edlin(...)
local str=...
repeat
  repeat ch4="üx"
     repeat if str=="" then str=... end
        if str==" " then str=" A S" end     
        str=textbox(stf("%d:%s",Lo,basline),...,str,t)
        if str==nil then str=" " end
     until #str>2
     while string.sub(str,1,3)==" A " do
        ch4=string.sub(str,4,4)
        str=string.sub(str,4,t)
        if str=="" or string.sub(str,1,2)=="AT" then str=" " end
        if str~=" " and ch4~=nil then str=check(ch4,str) end
     end --- while
  until str~=" "
 
  k=0
  ce=string.sub(str,-1,1)
  if ce==" " and if_x<t*t then k=t
     str=string.sub(str,-1,1)
     if #str>2 then RV=P==P; writeln(str) else k=0 end end
  if string.sub(str,1,4)=="    " then Go=golog(str) end
  if ce==")" and string.sub(str,1,1)=="(" then arX=str end
until k==0
if str~=... and if_x<t*t and (L==Li or L==-Li) then
   if L>0 then L=L+1 end
   if L<0 then L=L-1 end end
return str
end
 
function check(chr,...)
local str=...
ch4=chr
 if chr=="(" then arx=str end
 if string.find("/|\\_>GPRV",ch4)~=nil then str=string.sub(str,2,t) end ---<<~=!!
 if chr=="V" then remV=str end
 if chr==">" then find_str=str; FI=str~="" end
 if chr=="_" then rep_str=str end
 if chr=="G" then golog(str); str=rem..chr..str end
 if chr=="P" then prompt(1,str); str=rem..chr..str end
--- - if chr=="R" then run(5,str); getkey(2,str) end
 if string.find("RV(",chr)~=nil then str=rem.."<"..str end
 
 while string.find("/|\\ABCDEF)HILMOSTXZ",ch4,1,1)~=nil do ch4="K" ---<<~=!!
       str=getstr(chr,str) end --
 if ch4=="E" then str=rem.." ??? Error --- ^ "..str end
 if str=="" then str=rem end
 
 while ch4=="K" do k=getkey(0,"<v>"..str)
    while k<t and string.find(str,".")~=nil do play_sound(3)
       if k==8 or k>20 then ee=fcopy(k,str) --letzte Zeile
              if ee~="--" then k=getkey(0,ee); ch4="XX" end
              end
       while k==29 do
--- -          run(6,str)
          k=getkey(0,"<V>"..str)
          if k==4 then str=textbox(stf("%d:%s",Lo,basline),ee..lineal,str,t)
             k=getkey(0) end end
       if k==9 then basline=str; pau=t end
       if k==6 then end
       if k==5 then str=" A "..str end
       if k==4 then str=rem..str end
       if k==2 then Go=golog(str) end
    if k<22 then k=t end end end
 if ch4~="XX" then ch4="XX" else ch4="K" end
return str
end
 
 
function fcopy(K,...)
 local str=...
 local lin=...
 local x=0
 for str in io.lines(...) do x=x+1
     if str~="" and #str>5 then lin=str
        if string.sub(str,1,5)=="--- (" or string.sub(str,1,5)==rem.."("
           then lin=string.sub(str,6,t); arX=lin end end
     if K==8 then if pc=="> " then print(x,".",str) else print(str) end end
     if K==22 then golog(str) end
     if K==24 then str=newline(0,str); writeln(str) end
     collectgarbage() end -- for
 if K==8 then getkey(1,lin.." -- ",arX) end
return lin
end
 
 -- Wird aktiviert, wenn Scriptix mit R ---/ == >Parse sich selbst filtert.
 -- Dann kann man Lua-Scripte wie dieses, deren Parameterblock gegen nil abgesichert ist,
 -- in den Ablauf einbinden - soweit der Speicher reicht.
--- -
--[[
function run(k,exe,...)
local str=...
local d,e,h,tt,p,l,f,r,i,j,c,a,z,g,w,u,y=
      D,E,H,T, P,L,F,R,I,J,C,A,Z,G,W,U,Y
local Rem,pC,bf,l42,li,lo,sr,sw,rW,go,tO,ii,x=
      rem,pc,basfile,log42,Li,Lo,size_r,size_w,rw,Go,TO,II,X
 txt:close(); if RW then bas:close() end
 J,A,C,Z,rC=0 --=ACZ...=nil
 
 if str~=nil then arX=... end
 if arX=="" then arX="D,E,2,9,1,-2,F,0,0,0,C,A,Z,G,22,222" end
 if string.find(exe," ")~=nil then exe,arX=split(" ",exe) end
 if arX~="()" then arX=textbox(basline..lineal,exe,arX,t); k=2 end
 if arX==nil then arX="" end
 collectgarbage()
 print_screen (-44)
 
   print(rem..os.date(),-k)
   if string.sub(arX,1,2)=="  " then arX="" end
   if k==0 then k,ti=getkey(2,"-+-") end
   if ti>555 then exe=sX end
   print(rem,k,-Li,-Lo,exe,arX,collectgarbage("count"))
   if k==9 then prompt(t,exe..arX) end
   if k<8 then local gsub,err=loadfile(exe)
      if not gsub then error(err,2); getkey(6,exe) end
      if k>4 then gsub() end
      if k==2 then assert(gsub)(arX) end
      if k==4 then assert(gsub)(D,8,2,9,1,-2,F,0,0,0,0,0,0) end
   end
 
   if arX==nil then arX="" end
   if str==nil then str=exe end
   if k<t then newline(0,rem.."? "..str.." ("..arX..")") end
   if k==t then writeln(rem.."? "..str.." ("..arX..")") end
   print(os.date(),-k)
   getkey(1,ix,err,Li,Lo,lineal)
 
 print_screen (0)
 collectgarbage()
 pc,basfile,log42,Li,Lo,size_r,size_w,rw,Go,TO,II,X,rem=
 pC,bf,l42,li,lo,sr,sw,rW,go,tO,ii,x,Rem
 D,E,H,T, P,L,F,R,I,J,C,A,Z,G,W,U,Y,t=
 d,e,h,tt,p,l,f,r,i,j,c,a,z,g,w,u,y,1000
 RW=rw==1; pau=t
 remV=rem.."<"; rC=string.sub(rem,1,1)
 for x=0,14 do
     set_console_layout(0,0,x*3,x)
     console_redraw()
     sleep(77) end
 set_console_layout(0,0,45,14)
 if Li>0 then
    for x=1,rw do bas=io.open(basfile,"a") end
    txt=io.open(log42); for x=1,Li do txt:read() end end
end
---*]]
 
function ch_block(get1,ch2,st3,...)
if ...~=nil then RV=P==P; writeln(rem.."<",...,">") end
local str=...
  if ch2=="." then
     ch2=string.sub(st3,1,1); acT=tonumber(ch2) or 0
     return str end
  if ch2=="-" then
     ch2=string.sub(st3,1,1); k=tonumber(ch2) or 0
     if k>0 then
        if acT==k then st3=string.sub(st3,2,t) else st3=str end end
     while st3=="" do Z=Z;
       repeat st3=readln() until string.sub(st3,1,5)~=remV
           st3="--- :"..st3 end
     return st3 end --- ---- -z=--- -z

  if ch2==">" then find_str=st3
     if string.find(st3,"><")~=nil then
       find_str,st3=split("><",st3); ch2="_" end
      FI=find_str~="" end
  if ch2=="_" then
     if string.find(st3,"}{")~=nil then
       st3,ch2=split("}{",st3) end
     if st3=="+"  then st3=os.date() end
     if st3=="§"  then st3=img_info(0,"") end
     if st3=="-+" then st3="\42" end
     if st3=="-/" then st3="\\" end
     if st3==".." then st3="\13\10" end
     rep_str=st3
     if ch2~="_" then return ch2 end end
  if ch2=="!" then k=getkey(2,st3)
                   II=II end
  if ch2=="]" then pc=st3 end
  if ch2=="&" then dostr(Li,st3) end
  if ch2=="%" then dostr(Li,"ee=string.format("..st3..")")
                   str=ee end
  if ch2==":" then if st3=="" then st3=lineal end
              str=rem.."-"..rem.."-"..rem..":"..st3 end
  if ch2=="^" then str=textbox(basline,...,zeile,t) end
  if ch2=="+" then str=basline; repZ=tonumber(st3); get1=1<1
              if repZ==nil then repZ=1
              return rem..os.date() end
              if repZ==0 then golog(str) end
              if repZ<0 then II=II end end
   
  if get1 then str=getstr(ch2,st3) end ---("/|\\ABCDEF)HILMOSTXZ")~=nil
  if str==nil then str=erriX end
  if ch2=="["  then A=Z-1;
     if string.find(str,".",4,1)~=nil then tpx=io.open(st3,"w") end
     readln(str)
     if tpx~=nil then txp:close(); tpx=nil; tpX=st3 end
     end --cut[&save] -> *]]--
--- -  if ch2=="{" then run(2,st3,arX) end
  if ch2=="}" then str=prompt(t,st3) end
return str
end
 
function ins_block(...)
local str=...
local st3=string.sub(str,3,t)
local get1=#str==3
ch2=string.sub(...,2,2)
zeile=rem.."< --- *"..zeile.." >"
for i=1,II do print(zeile)
 if string.find("/|\\+-_.:^>!%&{}[]",ch2,1,1)~=nil then
    str=ch_block(get1,ch2,st3,...) end
 
 if ch2=="(" then arX=st3 end
 if ch2==">" or ch2=="_" then str=... end
 if ch2=="*" then writeln(rem,"*? (]wwwwww>  +|-|=)?") end
 if ch2=="!" then k=getkey(3)
                   II=II end
 if ch2=="?" then str=edlin(rem..str.."???:##(<=~=>)end") end
 if ch2=="<" then RV=P==P; if st3~=nil then remV=st3 end
    repeat readln(); print(zeile) until Li==Z or string.sub(zeile,1,2)~="*<"
    k=getkey(2); str=zeile end
 
 ---[[  Reserviert f. keylogiX.bas :###include *#* Blox --- (!DIY!) ]]---
 if ch2=="\35" then II=II end
 if ch2=="=" then II=II end
 if ch2=="@" then II=II end
 
 end --for II
if str==... then str=zeile end
return str
end
 
function rem_block(...)
local str=...
local st3=string.sub(str,6,t)
local get1=#str==6
ch5=string.sub(str,5,5)
 -- if ch5=="<"  then Vorget(str) end -- temp. rem|Halt(find)
for i=2,R do --- rems auswerten?
   if string.find("/|\\+-_.:^>!%&{}[]",ch5,1,1)~=nil
      then str=ch_block(get1,ch5,st3,...) end
   if ch5=="?" then str=edlin(...) end
   if ch5=="(" then arX=st3 end
   if ch5==">" or ch5=="_" then repZ=-1
      if str~="" and str~=... then str=rem..ch5..str end end
   if ch5=="§" then klix(1,st3) end
   if ch5=="*" then str="\42"..st3 end
   if ch5=="@" then Z=0 end
   if ch5=="!" then k=getkey(2,st3)
                    II=II end
   while string.sub(str,4,6)==" A " do ch4="Do"
      str=string.sub(str,7,t)
      str=check(ch4,str) end
 end --for R
if R==1 then str=rem.."<>" end
return str
end
 
 
function getstr(chr,...)
local k=1
local str=...
  if str==""  then str="S" end
  if str=="(" then str=rem..os.date() end
  if str=="C" then str="A/CHDK/" end
  if str=="A" then str="A/" end
  if str=="E" then str=rem.."< ??? Error --- ^ >"..basline; ch4="er" end
  if str=="F" then str='--- ? function xyz(x,y,z,...)\\n--- /S\\nend\\n--- ? for u=1,11 do xyz(u,x,-z*(y+x),...) end; return yx end' end
  if str=="I" then str=tpX; if str==nil then str="X" end end
  if str=="X" then str=mdX end
  if str==")" then str=arX end
  if str=="O" then str=erriX end
  if str=="B" then str="A/CHDK/BOOKS/" end
  if str=="H" then str="A/CHDK/HELP/" end
  if str=="L" then str="A/CHDK/LOGS/" end
  if str=="S" then str="A/CHDK/SCRIPTS/" end
  if str=="T" then str="A/CHDK/SCRIPTS/TEST/" end
  if str=="Z" then str=sX end
  if str=="M" then str="M=md_detect_motion(a,b,1,d,e,f,g,h, i,j,k,l,m, n,o,p)" end
 
  if string.sub(str,#str,1)=="\n" then str=string.sub(str,1,-2) end
  if string.sub(str,1,2)=="A/" then k=0
     while string.find(str,".",4,1)==nil do str=file_browser(str) end
     if str==nil then str=... end
     if string.find("/|\\",chr,1,1)~=nil then writeln(rem..str)
        if str==nil then str=...; ch4="E"; k=1 end
        for x=k,0 do
--- -            if chr=="\92" then  run(2,str) end
            if chr=="/" then fcopy(24,str) end
            if chr=="|" then prompt(t,str) end end--forX
        str=rem..str.." -- end "..ch4 end
        end
  for x=1,k do if #str>1 then str=textbox(basline,zeile,str,t) end end
if #str==1 then ch4="E" end
--getkey(5,chr..ch4)
return str
end
 
 
function getkey(x,...)
local k=0
local t=1000
console_redraw()
if ...~=nil then print("*<",...,">") end
if x==nil then x=42 end
if x<10 then sleep(33)
   repeat wait_click(9) until is_key "no_key"
   if x<8 then play_sound(x) end
   wait_click(t*t)
   if x~=8 then sleep(123) end end
if x>t then wait_click(x); k=x%100 end
 local ti=get_tick_count()
 
 while is_pressed "face" do k=1 end
 while is_pressed "up" do k=2 end
 while is_pressed "video" do k=3 end
 while is_pressed "left" do k=4 end
 while is_pressed "set" do k=5 end
 while is_pressed "right" do k=6 end
 while is_pressed "display" do k=7 end
 while is_pressed "down" do k=8 end
 while is_pressed "menu" do k=9 end
 while is_pressed "help" do k=11 end
 while is_pressed "playback" do k=13 end
 while is_pressed "print" do k=16 end
 while is_pressed "zoom_in" do k=22 end
 while is_pressed "zoom_out" do k=24 end
 while is_pressed "shoot_half" do k=29 end
 
 ti=get_tick_count()-ti
 while x==t do x=0
   k=get_orientation_sensor()
   if Go==nil then Go=k/90+99 end
   if k==0 then G=Go else play_sound(1+k/90) end
   if k==90 then G=G-1 end
   if k==270 then G=G+1 end end
return k,ti
end
 
 
function menu(...)
local k,ti=getkey(2)
 if ti>t*t then II=II end
--- - if ti>t then ti=pcall(run(2,basline)) end
--- - if k==24 then run(6,sX) end
 --("D,8,2,9,1,-2,F,0,0,0,C,A,Z,G,11,111") end
--- - if k==22 then run(2,sX) end
--- - if k==7 then run(T,sX) end
 if k==29 then klix(0,...) end
 if k==2 then basline=edlin(" A AT"..basline); k=9 end
 if k==4 then basline=rem..":-) ".. basline end
 if k==5 and ti>333 then exitalt(5,"*<alt>"); k=9 end
 if k==6 and ti>333 then help("") end
 if k==8 then W=0; WP=1<1 end
 if k==9 then k=getkey(t) end
 if k==13 then click "playback" end
console_redraw()
sleep(99)
return k,ti
end
 
--- :...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
 
local function scriptix(...)
--(D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y)
 
function restore()
 if RR then txt:close() end
 if RR and RW then bas:close() end
 set_console_layout(0,0,25,5)
 set_console_autoredraw(1)
 print(U,"skriptiX:",Li,Lo,-Error)
 k=getkey(2004,collectgarbage("count"),err)
 collectgarbage()
end

dir={"SCRIPTS/","LOGS/","BOOKS/","HELP/","LOGS/logiX/"}
 dd=dir[D+1]; dir=nil
--- ".XxX" gewählte Zeilen editieren; Datei direkt modifizieren.
ext={".Lua",".bAs",".tXt",".baK",".Tmp",".lOg",".scX",".XxX",".xXx"}
 eXt=ext[E+1]; ext=nil
Hf={"---","H","L","S","B","german.HLP"}
 hfil=Hf[H+1]
mdX="A/CHDK/SCRIPTS/"
if eXt==".lOg" then mdX="A/CHDK/LOGS/" end
if eXt==".scX" then mdX="A/CHDK/LOGS/logiX/" end
sX="A/CHDK/SCRIPTS/scriptiX.Lua"
wa="w"; if eXt==".tXt" then wa="a" end
arX=...
ch4="2"
ee=""
log42=""
basfile=""
ubasic=""
Glog=""
find_str="@title"
rep_str=""
seP=" "
crLf="\n"
rem="rem "; remV="rem <"
 
t=1000
acT=U/t
bug=0
E=0
Err=0
Error=0
II=0
if_x=t*t
Go=0
k=0
Li=0
Lo=0
rw=1
repZ=1
size_r=0
size_w=0
sec=0
x=0
X=0
RR=1<2
RW=C>=0
TF=2<1
TO=A==0
WP=W<0
 
if WP then W=-W end
if I>0 then II=1 end
if J==0 then A=1; C=0; Z=t*t end
if P==0 then P=t*t end
if A==0 then A=1 end
if A<0 then A=-A end
if Z==0 then Z=t*t; crLf="\13\n" end
if eXt==".XxX" and L>0 then L=-L end
 
if type(Y)=="number" then Y=Y+1 end
if type(Y)=="string" then getkey(6,pc,Y) end
if pc==nil then pc="> " end
if arX==nil then arX="(...)" end
if eXt==nil then eXt=".erX" end
if erriX==nil then erriX=mdX.."erroriX.tmp" end
if pau==nil then pau=t end
if lineal==nil then lineal=":...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,...." end
basline=lineal
if Y~=nil then II=II end
 
 
 for x=0,14 do
     set_console_layout(0,0,x*3,x)
     print(lineal)
     console_redraw()
     sleep(88) end
set_console_layout(0,0,45,14)
if H>0 then help(hfil) end

--begin txt2bas --
  begin(...)
  collectgarbage()
  play_sound(rw)
  head()
  if string.find("/|\\",ch4,1,1)~=nil then getstr(ch4,log42)
     --if ch4=="/" then P=0; Z=-t end
     end     
 
  if_x=t
  for x=A,P-1 do readln(zeile); writeln(zeile) end
  if P>X then P=P*P end
  if_x=1
  for x=P,Z do
         repeat readln(zeile) until rep_str~="#" or zeile~=basline or Li==Z
         if RW and (L==Li or L==-Li) then zeile=edlin(zeile); pau=t end
         basline=newline(1,zeile)
         if WP and x%12==0 or is_pressed "menu" or (pau>333) then
            k,pau=menu(basline) end
         writeln(basline)
         collectgarbage() --!!
--- -         if pau>t then run(6,sX," D,4,8,9,1,-2,F,1,1,0,0,0,0,G,1,333")
--- -            k=getkey(2222,not IX,Lo,err) end
end --=next x
 
tail()
done()
ee=os.date()
restore()
return ee
end--txt2bas
-- end --scriptix(...)
 ---

collectgarbage()

if t==nil then repeat IX,err=pcall(scriptix())
              -- if not IX then error(err,1) end
               k=getkey(2002,not IX,err)
               until k<21
else T=t
if OOO==nil then local D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y=... end
UUU=U
print("D=",D," type:",type(D))
print("E=",E,"H",H)
print("T",T,"P",P,"L",L,"F",F,"R",R,"I",I,"J",J,"C",C,"A",A,"Z",Z,"G",G,"W",W,"U",U)
lineal=":...;....1....;....2....;....3....;....4....;....5....;....6....;....7....;...."
t=1000
local pc="|"
if io.type(D)~="nil" then repeat
   rC="-"; rem="--- "
--- -   if E==nil then repeat
      prompt(t,D)
      k=getkey(z,str); if k<20 then XXX=t end
--- -      until o==o else run(...); XXX=1 end
   until o==o end

 if E==nil then D=nil end
 if D==nil then D=0 end    --- 0=/LOGS/
 if E==nil then E=2 end    --- 2=>>.tXt; =anhängen
 if H==nil then H=2 end    --- Helfix
 if T==nil then T=0 end    --- Testschalter
 if P==nil then P=0 end    --- 0=>t*t; nur Suche&edit
 if L==nil then L=-2 end   --- edit in_Zeile Nr.
 if F==nil then F=1 end    --- edit out_Textsuche
 if R==nil then R=2 end    --- 2=rems auswerten
 if I==nil then I=1 end    --- *? Zeilen -"-
 if J==nil then J=0 end    --- Vorsicht!
 if C==nil then C=0 end    --- -= ReadOnly
 if A==nil then A=0 end    --- 0=Ohne Zeilenummern
 if Z==nil then Z=t*t end  --- =|0=crLf|-letzte
 if G==nil then G=0 end    --- 0=LOG_get_exp_count().TXT
 if W==nil then W=4 end    ---
 if U==nil then U=get_exp_count() end
 
if XXX==nil then
if UUU==nil then
print("D",D,"E",E,"H",H,"T",T,"P",P,"L",L,"F",F,"R",R,"I",I)
print("J",J,"C",C,"A",A,"Z",Z,"G",G,"W",W,"U",U,"Y",Y,":",type(Y)) end
wait_click(t*t)
               repeat IX,Y=xpcall(scriptix(),scriptix())
               k=getkey(4002,not IX,err)
               until k<21 end
end
 
--[[
--- >blah
--- blahbla blah --- 88
--- _fasel
--- ---- ---- +
--- ---- +
--- +
--- blahbla blah --- 88
--- +3
--- _faels ;
--- ----_; false
--- blahbla blah ---88
--- % "---Li%d, Lo%d, Mem%d %s",Li,Lo,collectgarbage("count"),lineal
  --,D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y
    (D,E,H,T,P, L,F,R,I,J,C,A,Z,G,W,U)
--]]--
--- (D,E,2,9,1,-2,F,0,0,0,C,A,Z,G,1,111
--[[
-- ... Runtimeminimierung vorerst maximiert ...


P.S. {^myTodo^}
 ? Bisserl rechnen {X=Y*is_valid_verregnetes_Wochenende+Z*is_involved_Bitschmied+?)
 -- Um diese Boolevardlogik herumzuprogrammieren, ist schon adelig;{ Sowas von Nervig;]
 ? Welcher Winter?
]]--

_______________________________[ "~~~^^~~~~~~~~~~~~~~~... :-({|= CHDK mit Kommandozeilenfeelinx \:D/ ...~~~~~~~~~~~~~~~^^~~~" ]______________________________

______________________________ [ "~~~^^~~~~... :-({|= Wohin damit?? Baustein/Intro zum Platzieren des md_Blocks \:D/ ...~~~~^^~~~" ] ______________________________
Code: Alles auswählen
--[[
@title platziX.Lua
@chdk_version 1.4
@subtitle Im UniVersum fehlt a Byte!
@subtitle Wo ist das? Sag was!
@subtitle Ist es noch weit?
@subtitle Jede Sekunde Lebenszeit
@subtitle ist eine Leihgabe der Ewigkeit.
]]--

function look(x)
    set_aelock(0); set_aflock(0)
    press("shoot_half")
    repeat sleep(42) until get_shooting()
    set_aflock(1); set_aelock(1)
    release("shoot_half")
    if x>0 then --   ubasic:
 --   print get_min_stack_dist;"mm",get_near_limit,-get_focus,-get_far_limit
    print(get_exp_count(),-get_focus(),"-av",get_av96()/32,"-tv",get_tv96()/32) end
    x=get_free_disk_space()
sleep(999)
return x   
end
   

function place(...)
local a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,X=...
if a==nil then a=3 end
if b==nil then b=3 end
c=1
if d==nil then d=60000 end
if e==nil then e=20 end
if f==nil then f=3 end
if g==nil then g=2 else g=g-1 end
h=0
if i==nil then i=1 end
if j==nil then j=(a+1)/2 end
if k==nil then k=(b+1)/2 end
if l==nil then l=j end
if m==nil then m=k end
if n==nil then n=0 end
if o==nil then o=3 end
if p==nil then p=16 end
if X==nil then X=0 end
local ab=a+b

repeat
   local a2=0; if a==2 then a2=1 end
   local b2=0; if b==2 then b2=1 end
   if j>a then j=a end
   if k>b then k=b end
   l=j+1-a%2-a2; m=k+1-b%2-b2; g=g%3+1
   local T=get_tick_count()
   h=md_detect_motion(a,b,1,200,e,f,g,h,i%3,j,k,l,m,0,o,9)
   if (h>0) or (ab~=a+b) and (X<2) and (f<99) then
      print(e,-f,"(",a,"*",b,")",h,T-get_tick_count())
      ab=a+b
      while is_pressed("shoot_half") do
         sleep(42); II=II end
      else console_redraw() end
   wait_click(9)
   if is_key("zoom_in")  then a=a%12+1 end
   if is_key("zoom_out") then b=b%12+1 end
   if is_key("left")  and j>1 then j=j-1 end
   if is_key("right") and j<a then j=j+1 end
   if is_key("up")   and k>1 then k=k-1 end
   if is_key("down") and k<b then k=k+1 end
   if is_key("set") then i=(i+1)%3 end
--   if is_pressed("menu") then look(1) end -- oder Alt-Modus für Einstellungen verlassen.
   if is_key("menu") then
 --     a=(a+1)/2; b=(b+1)/2 end --oder
       if a>1 then a=a-1 end
       if b>1 then b=b-1 end end
repeat sleep(222) until get_alt_mode()
until (h==0) and (is_key("shoot_half") or (X>0)) --!
g=3; if i==2 then g=1 end
--sleep(999)
return a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p
end

--- :...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
--- :Anwendungsbeispiel
 
function restore()
   set_aelock(0); set_aflock(0)
   print(Z,-collectgarbage("count"),-get_vbatt())
end

if t~=nil then local
      a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,I,Z=... end
    
      a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p=
place(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,0)
local t=1000
if I==nil then I=1 end
if Z==nil then Z=t end

collectgarbage()
print(collectgarbage("count"))

sd1=look(1)
repeat local T=get_tick_count()
   h=md_detect_motion(a,b,1, d, e,f,g,h,i,j,k,l,m,n,o, p)
while h>0 and get_alt_mode() do
   if n==0 then -- Auslöseverzögerung mit Bewegungsfilter
      repeat local hh=md_detect_motion(place(7,7,1,90,30,1,2,0,0,1,1,7,7,0,2,16,1)) until hh==0
      sd1=look(1)
      shoot(); sleep(t) end --- < Ixus300HS (lowlight):....> Kamerafehler E26,shutdown
     --  S90 & G7 seltsam
   if n==9 then sleep(tv96_to_usec(get_tv96())/t)
      release("shoot_full") end
   if get_tv96()<1 then sleep(tv96_to_usec(get_tv96())/t) end--Zeit f. Darkframe, rettet E26 ??
h=-1 end --wh else
while h==-1 and get_alt_mode() do Z=Z-1
   repeat h=h+1
      sd2=get_free_disk_space()
      play_sound(4); sleep(t)
   until (sd1>sd2) or (h==6)
   if h==6 then playsound(6); sleep(t) else sd1=look(1) end
sd1=look(1) end--wh
repeat sleep(t) until get_alt_mode() and ((get_tick_count()-T)/t>I)
while is_pressed("menu") do sleep(42); II=II end
until (Z<=0) or (get_vbatt()<3333) or (get_tv96()<0)

restore()

--[[ ubasic Version via gosub "##place"
:##place
do
T=get_tick_count+20
md_detect_motion a,b,c,200,e,f,random 1 3,h,i,j,k,j+(a%2=0)-(a=2),k+(b%2=0)-(b=2),0,o,9
if h*(z=0)*(f<99) then print get_capture_mode,f,"(";a;"*";b;") ",h,T-get_tick_count
j=(j-is_pressed "left"+is_pressed "right"-(j>a))|(j<2)
k=(k-is_pressed "up"+is_pressed "down"-(k>b))|(k<2)
a=((a+is_pressed "zoom_in")%13)|(a<2)
b=((b+is_pressed "zoom_out")%13)|(b<2)
i=(i+is_pressed "set")%3
if is_pressed "menu" then gosub "##look"
until is_key "shoot_half"
if i=2 then g=1 else g=3
l=j+(a%2=0)-(a=2)
m=k+(b%2=0)-(b=2)
sleep 999
return
]]--

--- +


Code: Alles auswählen
--[[
@title nd_test.Lua
@subtitle :...,....1....,....2....,....3....,....4....,....5
@param N ND AUS ein
@values N AUS ein
]]--

for i=1,9 do
    set_nd_filter(1+i%2)
    click("shoot_half")
    print (i,-get_av96(),-get_tv96())
wait_click(999)
sleep(999) end
set_nd_filter(2-(N or 0)%2)
sleep(2018)

Caefix
CHDK-Einsteiger
CHDK-Einsteiger
 
Beiträge: 8
Registriert: 15.06.2018, 20:14
Kamera(s): Einige!


Zurück zu Code-Ecke

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 8 Gäste

cron