Ideen zu Ubasix

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

Ideen zu Ubasix

Beitragvon Caefix » 15.06.2018, 19:31

print ^{=) Hello world.^

Code: Alles auswählen
--[[
1..7 Wg. CHDKpokalypse obsolet

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-HowTodorial, wird einfacher als es aussieht;)
      Beliebig interaktiver, speicherfreundlicher  Zeileneditor & Filterroutinen, Head, Tail, Cut, Find & Replace inclusive.

      Eine v. vielen Anwendungen:
          Das Skriptchen (damit waren die Versionen<10kb gemeint)  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 ...
      ...
      ... Werkzeugkasten; copy&paste in eigene Projekte ;)



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 scriptiX.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    I Ifkey (New Ubasic)
rem 1 is_pressed -> =is_key;  -1 is_key -> =is_pressed
 @default I 0
 @range   I -1 1
@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_av96
c=get_capture_mode
e=get_ev
D=5+(Q=2)*random -2 5
E=Q*3
rem~ifkey I
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
q=0
T=get_tv96
w=w*(Q>2)
z=0

rem~ begin
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 !! Old 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<>O
rem "shoot_full" -->
goto "restore"
:#end
end 5

:##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 "wifi" then k=12
 if is_pressed "playback" then k=13
 if is_pressed "print" then k=16
rem some cams NEED is_key (Sx200), &Touchscreen?
 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 3; gosub "##time2"
  case 4; click "left"
  case 5; click "set"
  case 6; click "right"
  case 8; click "down"
  case 9; click "menu"
  case 12; print "  click ^wifi^"
  case 13; exit_alt
  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 12; print "  click ^wifi^"
  case 13; sleep t
  case 29; gosub "##baustelle"
  case_else print "sleep 999"
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^"
  case_else playsound 5
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"
  case_else print ":...;....1..+.;....2...."
end_select
:)
return

:##zoom
E=1
rem 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
   Q=4*(Q=0)
    wend
 for Q=Q-(Q=5) to Q-1
  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)=1)+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,"Dig";get_digic,"PID:";get_platform_id
print "@param a Dim md_feld #"
print " @default a",D
print " @range a -11 11"
print "@param e CompInterv *10 (ms)"
print " @default e 3"
print " @range e 1 999"
print "@param f Reizschwe!!e"
print " @default f 5"
print " @range f -128 255"
print "@param w wait (s) | [.]"
print  "@default w 30"
print "@param U {0}@"
print " @default U ",U
print " "
print "gosub ^##init^"

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


:##tail
print " "
print ":##init"
print "t=";t
print "C=get_capture_mode"
print "A=get_av96"
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_tv96"
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_platform_id,"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 "return "

print " "
print ":restore"
print " print_screen 0"
print " set_aflock 0"
print " set_av96 A"
print " set_capture_mode C"
print " set_ev E"
print " set_iso_mode I"
print " set_tv96 T"
print "end"
print " "
print " "

print ":end"
gosub "##time"
return


:##foc
 set_aflock 0
  sleep 199
 press "shoot_half"
 do
  sleep 99
 until not 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 "  sleep 199"
print " press ^shoot_half^"
print " do"
print "  sleep 99"
print " until not get_shooting"
print " set_aflock 1"
print "print F,get_zoom,-get_focus,h-t"                              
print " release ^shoot_half^"

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 "q=0"
print "playsound 1"
print "do"
print " q=q+1"
print " sleep 99"
print "until (Y>get_free_disk_space)+(q>30)"
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 not get_shooting then"
print "  shoot"
print "  gosub ^##sd^"
print " endif"
print "until (is_pressed ^shoot_half^=0)+(h>t)"
print "return"
print " "
return

:##zoom2
E=1
rem E=get_mode=1
if (k-E)=24 then print "rem Error ^---^"
while E
 if k=22 then
  print "press ^zoom_in^"
  print "sleep 50"
  print "release ^zoom_in^"
  press "zoom_in"
  sleep 50
  release "zoom_in"
 else   
  print "press ^zoom_out^"
  print "sleep 50"
  print "release ^zoom_out^"
  press "zoom_out"
  sleep 50
  release "zoom_out"
 endif
 sleep 99
 print "  sleep 100+",k
 playsound 4
 E=0
wend
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_av96 a
set_capture_mode c
set_ev e
set_iso_mode I
set_tv96 T
E=0
end 2

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 23.12.2020, 17:37, insgesamt 21-mal geändert.
EsGibtKeinenErdaufgangAufDemMond! SoSimpel...
Benutzeravatar
Caefix
CHDK-Begeisterter
CHDK-Begeisterter
 
Beiträge: 78
Registriert: 15.06.2018, 19:14
Kamera(s): Einige!

Re: Ideen zu Ubasix

Beitragvon msl » 18.06.2018, 21: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
Benutzeravatar
msl
Super-Mod
Super-Mod
 
Beiträge: 4567
Bilder: 271
Registriert: 22.02.2008, 11:47
Wohnort: Leipzig
Kamera(s): A720 1.00c
SX220 1.01a

Re: Ideen zu Ubasix

Beitragvon Caefix » 20.06.2018, 18: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-- ...  }   ~~==xxxxxxxxxx< 43496 >XXXXXXXXXX]]--
---  (LUA-Voodoo??, for..io.lines frißt Speicher... )
--- < ~~~~~ >
--- <  \./~ >
--- <   I   >
--[[
@title scriptiX.Lua
@chdk_version 1.4
--- Speichermangel bei Ix230HS
--- (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 --- ???
@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 ---><: WOODTXT #^^%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|-noEd)
 @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 {}@  (|0 bei lowMem)
 @default U 1
--]]
 
--print_screen(-112)
 
function help(...)
local x=0
 if G<21 then for ee,lin in pairs(_G) do x=x+1
    if G<11 then if G and 1 then golog(ee) else golog(ee,lin) end end
    print(x,-collectgarbage("count"),ee,lin)
    wait(0) end
    if G/2==3 then return 0 end end
repeat
 local str=...
 local l,K,x=t,0,0
 collectgarbage()
 if str==nil then str="X" end
 if str=="" then str="L" end
 local hfile="A/CHDK/HELP/"..str
 if #str==1 then hfile=getstr("ß",str) end
 for lin in io.lines(hfile) do x=x+1
   if lin:find(find_str)~=nil then K=0; l=t end
   local ii=1; wait(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,ti=getkey(4)
         if K==2 then l=t
            str=edlin(str); Go=golog(str)
            if lstr(4,str)=="    " 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); ti=0 end
        if ti>555 then return x 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 f,r=...
--if r~=nil and isfile(f) then return output(f,r) end
local l=get_exp_count()
 if G~=0 then l=G end
 if G>0 then Glog=stf("A/CHDK/LOGS/LOG_%04d.TXT",G); G=-G end
 print_screen(l)
 set_console_autoredraw(-1)
 if type(...)=="table" then output(Glog,...) else
   print(...) end
 set_console_autoredraw(1)
 print_screen(0)
return l
end
 
function img_info(x,...)
local str,dd="",get_image_dir()
 if x>=1 then if (...) then print(...) end
    print(os.date()); K=5 end
 if x==t then str=file_browser(dd) or "" end
 if str=="" then
    str=printf("%s/IMG_%04d.JPG",dd,get_exp_count()) end
--return fpath(str)
return str,dd.."/"
end
 
function klix(x,...)
 collectgarbage()
--[ [--<<LowMem Notschalter
 shoot() -- Da geht dann SX210is wg. Speichermangels aus:
 dd,mdI=img_info(t,...)
local str=... or ''
repeat
  if 2>1 then --shoot(); file_browser(mdI) else
  repeat
    set_aelock(0); set_aflock(0)
    press("shoot_half"); sleep(42)
    while get_shooting() do sleep(42) end
    repeat
      iii=get_free_disk_space()
    until not get_shooting() and not is_pressed("shoot_half")
    set_aflock(1); set_aelock(1)
    press("shoot_full")
    play_sound(1)
    release("shoot_full")
    if (get_tv96()<1) and (get_raw_nr()~=1) then
      sleep(tv96_to_usec(get_tv96())/t) end--Zeit f. Darkframe,
    -- rettet Ixus300HS Kamerafehler E26 ?? --<Voodoo!
 
    local K,u=0,0--; if get_raw() then K=1 end
--    for u=0,K do u=0
--    for u=0,(getkey(t,'^')*9) do u=0
    for K=0,tonum(get_raw()) do u=0
        repeat sleep(t); u=u+1
        kkk=get_free_disk_space()
        play_sound(4)
        until iii>kkk or u==7
              iii=kkk end --u
    release("shoot_half")
  until not is_pressed("shoot_half") end
 
  repeat K=getkey(x*t+9); wait(0)
     if K==8 or x>0 then local i=img_info(1,...)
        if #str>1 then output(1,str); str='' end
        output(1,stf("%s\n %s",i,os.date())) end
     if x==t then return kkk else x=x%10 end
     if K==5 then K=exitalt(5,"*<klix>") end
      --x==1 notiert jedes Bild,10 nur das 1.
  until K~=9
until K~=29 --]]--
return K
end
 
function exitalt(x,...)
 play_sound(x,"exitalt");
 local K=getkey(t);
 if K==0 then set_aelock(0); set_aflock(0) end
 repeat exit_alt(); sleep(444)
 until get_alt_mode();
 K=getkey(t);
 K=getkey(5,...);
 pau=t
return K
end
 
function wait(w)
if _HLP or (W<0) then return 0 end
if not get_alt_mode() then exitalt(0,"exitalt wait") end
 wait_click(w*100+1,"wait")
 local t=get_tick_count()
 repeat wait_click(10)
 until not is_pressed "right"
 t=(get_tick_count()-t)/100
 if t>2 and t<22 then W=t end
 if is_pressed "down" then sleep(99)
    collectgarbage()
    if t>999 then find_str="" end
    if W>0 then W=W-1 end end
return t
end
 



function lstr(x,...)
  if x<0 then x=x-1 end
  return string.sub(...,1,x)
end
 
function rstr(x,...)
  if x<0 then x=string.len(...)+x end
  return string.sub(...,-x,t)
end
 
function printf(...)
  local str=string.format(...)
  print(str)
return  str
end
 
function stf(...)
local s,r=...
   if r~=nil and string.find(s,"\%%",1)~=nil then
      return assert(string.format(setarg(...)),...)  end
return ...
end
 
function cut(...)
if not ... then return "\t" end
local x,str=0,...
   repeat x=x+1 until x>=#str or str:sub(x,x)>"\30"
   str=str:sub(x,t); str=str:gsub("\t"," ")
   while str:find("  ")~=nil do str=str:gsub("  "," ") end
return str
end

function split(sep,str,...)
  str=tostring(str)
  if type(sep)=="number" then
     return lstr(sep,str),rstr(-sep,str),#str-sep end
  local spc=sep==" "
  local x=str:find(sep,...)
  if spc then str=cut(str) end
  if x==nil then sep="" else
     sep=str:sub(x+#sep,t); str=str:sub(1,x-1) end
  if x==1 and spc then str=sep end
return str,sep,str:find(sep,...) or 0
end
 
function tonum(x,...)
local p,chr,str=0,'',...
  if x==nil then tonumber() end
  if type(x)~="number" then
     if x=="" then return end
     str=x; x=1 end
  if type(str)=="boolean" then
     if str==x==x then return 1,1 else return 0,1 end end
  if str==nil then return nil,-t end
  if type(str)=="table" then return #str or -1,str[x] end
  if x*x>#str*#str then return 0,-#str end
  repeat chr=str:sub(x,x)
    if tonumber(chr)~=nil then if p==0 then p=x end else
       if p>0 then str=str:sub(p,x-1); chr=lstr(p-1,...) end end
    x=x+1 until x>#str
  if x+1<string.len(str) then p=x+1 else p=1-x end
  x=tonumber(str) or 0; if rstr(1,chr)=='-' then x=-x end
return x,p
end
--[ [--
function abs(x)
 x=tonum(x or 0) or 0
 if x>0 then return x end
 return -x
end --]]--
 
function setarg(...)
if ...==nil then arg=nil
   return collectgarbage("count") end
local X,sep,x,s=0,seP,...
  if type(x)=="boolean" then
     if s==nil then
        if x==x==x then table.concat(arg,sep) else table.sort(arg) end
           return unpack(arg) end
     if x==x==x then
        if type(s)=="boolean" then repeat X=X+1
           if arg[X]~=nil then
           if s==x==x then newline(t,arg[X]); writeln(arg[X])
              else print(arg[X]) end end until X>=#arg
           return unpack(arg) end         
        if type(s)=="table" then return unpack(s) else arg={...} end
     end end
  if isfile(x) then arg={}
     for z in io.lines(x) do X=X+1; arg[X]=z end
     collectgarbage(); return unpack(arg) end
  if arg==nil then arg={...} end
local arg={}
  if type(x)~="table" then arg={...} else repeat
     if s==nil then return unpack(x) else
        if type(s)=="table" then return unpack(x),unpack(s) end
        local x,a,b,c,d,e,f,g,h,i=...
        if tonumber(a)==nil then return unpack(x),a,b,c,d,e,f,g,h,i end
        if tonumber(b)==nil then b=#x end
        return unpack(x,a,b) end until 1<2 end
  x=tostring(x)
  if tonumber(x)==nil and #x==1 then sep=x end
  if #arg==1 then X=0; s=...
     if sep==' ' then s=cut(s) end
     repeat X=X+1; arg[X],s=split(sep,s) until s=='' end
  X=0
  if tonumber(arg[1])==nil then
     repeat X=X+1; arg[X]=tostring(arg[X]) until X>=#arg else
     repeat X=X+1; arg[X]=tonum(arg[X]) until X>=#arg end
return unpack(arg)
end

--[[
function argum(K,x,y,...)
if (#arg or 0)==0 then return 0 end
if x<0 then x=#arg+x+1 end
if y<0 then y=#arg+y+1 end
if y>#arg then y=#arg end
if K<0 then K=getkey(-K,...) end
while x<=#arg and x<=y do
   if K==K then x=x end
   if K==24 then repeat writeln(arg[x]); x=x+1 until x>y end
   x=x+1 end--wh
return x-1
end
--]]--
   
function output(f,...)
local X,str=0,stf([[%s]],...)
  while type(f)=="number" do if
   f<0 then newline(t,str); return writeln(str) elseif
   f==0 then f=mdX.."!notiX.tXt" elseif
   f==1 then f=mdI.."!notiX.tXt" elseif
   f==2 then f=Glog
        else print(str); f=f%10
          if f>2 then return 0 end end--if
   end--wh
   print(' --',f,'--')
  local out=io.open(f,"a") or io.open(erriX,"a")
  if type(str)=="table" then
     repeat X=X+1
     if str[X]~=nil then out:write(str[X].."\n") end
     until X>=#str
     else X=1; out:write(str.."\n") end
out:close()
return X
end
 

--- :...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
 
function begin(...)
local ubasic="fertiX"
if ...~=nil then print("*<",...,">") end
local K,l=0,0
   basfile=log42
   if U%t==0 then K=1; X=t*t; Z=X; rem="--- " else
   for zeile in io.lines(log42) do X=X+1; l=l+#zeile
       if zeile>"" and lstr(2,zeile)=="--" then
          bug=-1-bug; rem="--- " end
       for ee in zeile:gmatch("\34") do K=K+1 end
       bug=bug or K%2
       if bug>0 and L>=0 then L=-L
          if P<X then P=X+1 end end
--- -
       printf("%4d%5d%7d",X,collectgarbage("count"),l)-- so zum Zuschauen wie der Speicher schwindet.
--- -       if X%42==0 then collectgarbage() end --!! genau hier u.U. sehr wichtig.
   end end --forX
   if K>0 then
      if L==0 then L=t*t end
      if L>0 then L=-L end end
   if bug>0 then play_sound(6) end
   collectgarbage()
 
   if RW then wait(0)
      if eXt==".scX" then os.mkdir(lstr(-1,mdX)) end
      if eXt==".XxX" then ubasic="xyx00xyx" end
      if type(E)=="string" then ubasic=""
         if E:find('.')==nil then eXt=".tXt"; E=E..eXt; wa="a" end
         if lstr(2,E)~="A/"  then E=mdX..E end
         basfile=E else
--- -         ubasic=" |\\fertiX" -- die Striche können weg, sonst getstr...
         ubasic=textbox(stf("%d rw%d %s",collectgarbage("count"),R,dd..pc..eXt)
                ,os.date(),ubasic,9); wait(0) end
         if ubasic==nil then ubasic=""; basfile=erriX else
            if tonumber(ubasic)~=nil then return 3 end
            if ubasic==" " then ubasic="!!IXIXIX" end
            if ubasic~="" then basfile=mdX..ubasic..eXt end end
         if lstr(1,ubasic)==" " then ch4=string.sub(ubasic,2,1)
            basfile,K=getfile(dd)
            if K==3 then return 3 end 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 type(F)=="string" then find_str=F else
   if F>0 then
      local Fnd={"function (x,...)",
      "for =*+-,,???remd_---","while (<=~=>)","until (<=~=>)",
      "if (<=*+-~=>) and or then","=elseif <=~=>gosubto##",
      "--- 88><:","><WOOD.TXT","*:##==^^\34\34\\\\","???"}
      if F>#Fnd then F=#Fnd end
      find_str=textbox(basfile,pc..ee..lineal,Fnd[F],t)
      Fnd=nil end
      if find_str==nil then find_str=" " end end
 
   find_str,rep_str=split("><",find_str)
   collectgarbage()
   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=lstr(1,rem)
   basline=lineal
   --basline=ubasic
return 0
end
 
function nubas(camera_name)
txt=io.open(log42,"r"); Li=0
if RW and not TF then Lo=0
   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%s ß%d >",rem,U,pc,basfile,-collectgarbage("count")))
   else printf("%s %s ",remV,string.upper(bi.platform).." >") end
end
 
 
function readln(...)
local x=0
zeile=...
if Z-C*rw>Li then
   if txt==nil or Li<0 then zeile=edlin(...) else
   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
      repeat zeile=txt:read(); Li=Li+1 until zeile~=remV end
 
   if zeile==nil then zeile=remV; RV=1<2; Z=0 end
   if rstr(1,zeile)=="\13" then zeile=lstr(-1,zeile) end
   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
      if lstr(5,zeile)==rem.."?" then zeile=stf([[%s]],edlin(zeile)) end
      cb1=lstr(1,zeile)
      if R==1 and tonumber(cb1)~=nil then cb1,zeile=split(seP,zeile)
         x=string.find(zeile,"; %d") or 0 --entfernt Zeilennummern
         if x>0 then zeile=lstr(x-1,zeile) end end
      if cb1=="*" and not RV then zeile=ins_block(zeile) end
      if cb1==rC and lstr(4,zeile)==rem and #zeile>4 then
         zeile=rem_block(zeile) end end
   size_r=size_r+#zeile 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,...)
   if not W then return print('!!! ',...) end
   if W<0 then return (...) end
local str=...
--print(Li,Lo,pc,str..";")
   while (R==2) and rstr(3,str)=='---' do str=lstr(-3,str)..cut(readln()) end
   if (bug==0) and (L>=0) and (str:find("^")~=nil) and (x<t)
      then str=play_string(x,...) end
   if not RW then cut(str) end
   if #str>120 then local s,sr=str,""
      repeat s,sr,x=split(120,s)
      print(s); s=sr; wait(W+2) until x<1
   else if TO or not Lo then print(str)
      elseif Li==Lo+1 or Lo<0 then printf("%d%s%s;",Li,pc,str)
      else printf("%d%s %d",Li,pc..str..';',Lo+1) end end
   ti=wait(W)
   if ti>t then II=II end
return str
end

function writeln(...)
local str=...
if str==nil or rep_str=="^" and not str:find(find_str)
   or rep_str=="." then return end
if (find_str=="" or str:find(find_str)~=nil) and K~=t then repeat
   if find_str=="" and isfile(mdX..rep_str) then
      for wood in io.lines(mdX..rep_str) do K=t
          str=fire(wood,seP,str) end; K=0
      else if #find_str>0 then
          str=fire(find_str,rep_str,...) end end
      until o==o end
 
   if Lo>=0 then
      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 lstr(5,str)~=remV then
         if repZ<0 then repZ=-repZ end
         for x=1,repZ do Lo=Lo+1; bas:write(str..crLf)
             size_w=size_w+#str end
         RV=1<1; repZ=1 end
    end
end
 
 
function tail(x)
 play_sound(1-bug)
 for i=1,rw do K=getkey(2200)
     if K>19 then arX=newline(1,arX); writeln(rem..arX) end
     if TF then --bas=io.open(basfile,"a")
        --for z in io.lines(tfil) do
        --    newline(z); writeln(z); collectgarbage() end
        --os.remove(tfil)
        end
---
end end
 
function done()
if (Lo>=0) 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(5005)
--- - if K>20 and eXt==".Lua" then run(6,basfile) end
 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 input(x,...)
local str=""
  if type(x)=="string" then str=x else str=tostring(x) end
  str=textbox("Input "..str,cut(...),"",t)
  wait(0)
  if str==nil then str=tostring(x) end
  if str==" " then str=... end
  if str=="@" then str=...; Z=0 end
  if str=="G" then golog(...) end
  if str=="P" then str=fpath(...) end
  if str=="F" then str,E=getfile(mdX) end
  if str==nil then str=tostring(x) end
  if str=="A" then return edlin(...) end
  if str=="R" then return readln(...) end
  if str=="T" then x=readln(...); return input(...,x) end
return str,tonum(1,str)
end
 
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,m,n=...
    if m==nil then fil,m=split(cut(fil)) end
    fil=fpath(fil)
    if m~=nil then setarg(m,n) end
    if str=="" or not isfile(fil) then x=1 else
    for str in io.lines(fil) do z=z+1
        if str>"" then cb1=lstr(1,str)
           if cb1=="*" then str=ins_block(str) end
           if cb1==rC  and lstr(4,str)==rem and #str>4
              then str=rem_block(str) end end
        if rstr(5,str)~=remV then x=dostr(-z,str) end
        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",Li,cut(basline)),cut(...),str,t) end--wh
 if x>0 then
    str=textbox(stf("%d:%s",-z,cut(basline)),cut(...),
   [[--- < pc="> "; acT=0; repZ=1; --=*+-\\\\""; =*+-; --]]..str,t) end
 if str~=nil and lstr(2,str)~="  " then dostr(-z,str) end
 if repZ>1 then str=basline.." " end
 wait(0)
return str,z
end
 
function dostr(x,...)
local str=...
if str==nil then str=edlin(...) end
   --str=textbox(log42,cut(...),...,t) end
wait(0)
local i=#str
if i>2 then
   local as,K=0,0
   --print("\%--"..str)
--- -     if isfile(str) then run(3,str) else
      as=assert(loadstring(str,str))() ---
--- -     end
     print(str); wait_click(t)
  if as~=0 then i=-i else
     K=getkey(5,stf("%d:",x),str); ch4="E" end end
return i,K
end
 
function edlin(...)
if NE then return (...),tonum(1,...) end
local str=tostring(...)
 if _HLP and bas then bas:flush() end
 if #str>123 then printf("--- LINE %d TOO LONG TO EDIT (%d)",Li,#str)
    return ... end
 repeat
  repeat ch4="üx"
     repeat if str=="A" then str=... end
        if str==" " then str=" A S" end     
        str=textbox(stf("%d:%s",Li,cut(basline)),cut(...),str,t)
        if (str or "")=="" then str="-- -.-" end
     until #str>2
     while  str:sub(1,3)==" A " do
        ch4=str:sub(4,4)
        str=str:sub(4,t)
        if str=="" or lstr(2,str)=="AT" then str=" " end
        if str~=" " and ch4~=nil then str=check(ch4,str)
           if not _HLP then return edlin(str) end end
     end wait(0)
  until str~=" "
 
  K=0; ce=rstr(1,str)
  if ce==' ' and str~="   " and if_x<t*t then K=t
     str=lstr(-1,str)
     if #str>2 then newline(t,str); RV=P==P; writeln(str)
        if rstr(1,str)~=';' then str=' ' end
        else K=0 end end
  if lstr(1,str)==";" then Go=golog(str) end
  if ce==')' and lstr(1,str)=='(' then arX=str end
until K==0
if str~=... and Li and (L==Li or L==-Li) and if_x<t*t then
   if L>0 then L=Li+1 end
   if L<0 then L=Li-1 end end
return str,tonum(1,str)
end
 
function check(chr,...)
local str=...
ch4=chr
 if chr=="(" then arx=str end
 if string.find("/|\\_>GPRV",ch4)~=nil then str=rstr(-1,str) end ---<<~=!!
 if chr=="V" then remV=str end
 if chr==">" then find_str=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)
 if K==0 then return str end
    while K<t and string.find(str,".")~=nil do --play_sound(3,"check")
       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",Li,cut(basline)),ee..lineal,str,t)
             K=getkey(0) end end
       if K==9 then basline=str; pau=t end
       if K==6 then return str 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
 
 
 -- 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.
 -- Diese können auch hiesige functions aufrufen.
 -- NICHT: SX210is (LowMem)
--- -
--[[
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
 if K==-t then K=2; ti=0 end
 if tostring(D)==sX then D=0
    if type(E)=="string" then E=0 end end
 if Li>0 then txt:close(); if RW then bas:close() end end
 Li,J,A,C,Z,rC,s=0,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 exe:find(" ")~=nil then exe,arX=split(" ",exe) end
 if not isfile(exe) then exe=fpath(exe) end
 if (K==2) and arX~="()" then
    arX=textbox(cut(basline)..lineal,exe,arX,t); wait(0) 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>5 then gsub() end
      if K<3 then assert(gsub)(arX) end
      if K==3 then assert(gsub)(...) end
      if K==4 then assert(gsub)(D,8,2,9,1,-2,F,0,0,0,0,0,0) end
      if K==5 then assert(gsub)(setarg(arX)) end
   end
 
   if arX==nil then arX="" end
   if str==nil then str=exe end
   if K<t then newline(0,"--- ? "..str.." ("..arX..")") end
   if K==t then writeln("--- ? "..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
---*]]
 
 -- ...stenographische Elemente...
 --- >^function fire><|
function fire(find,rep,...)
local K,str=0,...
if not rep then return ... end
-- if find=='"' then find,str=split('"',str); return split('"',str) --:(
if rep=="" then K=getkey(9)
   if RW and (K<8) then pau=t;
      if K>4 or _HLP then return edlin(str) end end end
if find=='"' then find,str=split('"',str,1,1)
   return split('"',str,1,1) end
if rep==seP then find,rep=split(seP,find) end
if #rep==1 then local i=tonumber(rep)
   if rep=="!" then golog(str) else
   if i~=nil and repZ>-1 then repZ=i else
      if rep=="@" and repZ>-1 then
         find,str=split(seP,str); writeln(find) end
      if rep==";" then str=readln(); str,rep=split(seP,str) end
      if rep=="|" then bas:close(); Lo=0 end --fsplit>erroriX.tmp
      if rep=="?" then rep=input(find,str) end
      if rep=="/" then rep=fpath(find) end
      if rep=="=" then rep=find end
      if rep=="+" then rep=os.date() end
      if rep=="§" then rep=img_info(0,"") end
      if rep=="-" then return string.sub(str,6,t) end
      if rep==":" then return string.sub(find,1,5)..str end
      if rep=="~" then return string.reverse(str) end
      if rep==">" then return string.upper(str) end
      if rep=="<" then return string.lower(str) end
      if rep=="{" then return split(seP,str) end
      if rep=="}" then find,str=split(seP,str) end
      if rep=="[" then return split(find,str,1,1) end
      if rep=="]" then find,str=split(find,str) end
      end end end
if #rep>1 then
   if rep=="\59;" then rep="" end    -- ;;
   if rep=="\45+" then rep="\42" end -- -+ * Fehlen in textbox(): *,|,\
   if rep=="\45/" then rep="\\" end  -- -/ \
   if rep=="\64@" then rep="\13\10" end -- @@
   if lstr(4,rep)==rem or rstr(1,rep)==";" then str=rep..str
      else repeat
        if lstr(1,rep)==";" then str=str..rep
        else if repZ>-1 then str=string.gsub(...,find,rep) end end
        until o==o end
      end
return str
end
 
function ch_block(get1,ch2,st3,...)
if ...~=nil then RV=P==P; writeln(rem.."<",...,">") end
local str=...
  if ch2=="." then ch2=lstr(1,st3); acT=tonumber(ch2) or 0
     return str end
  if ch2=="-" then ch2=lstr(1,st3); K=tonumber(ch2) or 0
     if K>0 then
        if acT==K then st3=rstr(-1,st3) else st3=str end end
     while st3=="" do Z=Z; st3=readln()
           st3="--- :"..st3 end
    return st3 end --- ---- -z=--- -z
 
  if ch2==";" then st3=fpath(st3) end
  if ch2==">" then find_str=st3
     if st3:find("><")~=nil then find_str,st3=split("><",st3) end
     ch2= "_" end
  if ch2=="_" then
     if st3:find("}{")~=nil then st3,ch2=split("}{",st3) end
     rep_str=st3
     if ch2~="_" then return ch2 end end
  if ch2=="!" then
     if st3:find("=")==nil then dostr(Lo,stf([[ee=%s]],st3))
        else dostr(Lo,stf('ee=[[%s]]',st3)) end
     dostr(-Lo,ee); K=getkey(2,ee)
     if K==2 then ee=stf('%s',basline); writeln(ee); ee=dd end
     if K==4 then ee=zeile end
     if K==5 then prompt(42,ee) end
     if K==6 then ee=prompt(42,dd) end
     str=ee end
                  --II=II end
  if ch2=="&" then dostr(Li,st3) end
  if ch2=="%" then dostr(Li,[[ee=string.format(]]..st3..[[)]])
                   str=ee end
  if ch2=="]" then pc=st3 end
  if ch2==":" then if st3=="" then st3=lineal end
              str=rem.."-"..rem.."-"..rem..":"..st3 end
  if ch2=="^" then str=edlin(zeile); wait(1) end
  if ch2=="+" then str=basline; repZ=tonum(st3); get1=1<1
              if repZ==nil then repZ=1; writeln("--- +")
                 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 str:find(".",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(3,st3) end
  if ch2=="}" then str=prompt(t,st3) end
return str
end

function ins_block(...)
--[ [
local str=...
local st3=str:sub(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,str)
                   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 lstr(2,zeile)~="*<"
    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)
--while ch5=="<" and str==remV do str=readln() 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(2,st3) end
   if ch5=="*" then str="\42"..st3 end
   if ch5=="@" then Z=0 end
   if ch5=="!" then
      while K>8 do K=getkey(2,str)
            II=II end 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 fcopy(K,...)
local lin=...
local x=0
 for str in io.lines(fpath(...)) do x=x+1
     if str~="" and #str>5 then lin=str
        if lstr(5,str)=="--- (" or lstr(5,str)==rem.."("
           then lin=rstr(-5,str); arX=lin end end
     if K<8 then output(K,str) end
     if K==8 then if pc=="> " then printf("%d. %s",x,str) else print(str) end end
     if K==22 then golog(str) end
     if K==24 then str=newline(t,str); writeln(str) end
     collectgarbage() end -- for
 if K==8 then getkey(1,lin.." -- ",arX) end
return lin,tonum(lin)
end
 
function isfile(f,...)
if f==nil then return 2<1,"NIL" end
--if type(f)=="number" then return 2<1,tostring(f) end
-- local x,is="NIL",type(f)=="string" and os.stat(f) and (io.open(f)~=nil)
 --[ [
 local x,is,str="NIL",pcall(io.open(f)) -- nett, aber
 is=str:find("userdata")~=nil           -- Ix900Ti geht aus--]]-- ^^
 if is then str=f; x=io.type(f) end
--getkey(0,tostring(is)..str)
return is,str,x
end
 
function fpath(f,...)
--mdX=mdX or ""; mdI=mdI or ""
if not rem then rem="--- " end
local dd,dir='',
mdX..";SCRIPTS;LOGS;BOOKS;HELP;DATA;LOGS/logiX;;SCRIPTS/TEST;"..mdI
--  while type(f)=="number" do II=II
--       return end
  if isfile(f) then dd=f
     while rstr(1,dd)~="/" do dd=lstr(-1,dd) end
     return f,dd end
  if lstr(2,f)=="A/" then return f,rem.."^nofile:"..f end
  if path~=nil then dir=path..';'..dir end
  repeat dd,dir=split(';',dir)
    if lstr(2,dd)~="A/" then dd="A/CHDK/"..dd end
    if rstr(1,dd)~="/" then dd=dd.."/" end
    if isfile(dd..f) then return dd..f,dd end
    until #dir==0
return getfile(dd,...)
end
 
function getfile(dd,...)
local E,ee=-1,dd
  if ...~=nil then print(...); sleep(t) end
  if isfile(dd) then return fpath(dd,...) end
  if ee==nil then ee='ä' end
  if lstr(2,ee)~="A/" then dd="A/CHDK/" end
  if rstr(1,ee)~="/" then ee="SCRIPTS/" end
  dd=dd..ee
  repeat E=-1
     repeat ee=file_browser(dd); wait(1)
        E=E+1 until ee~=nil or E==3
     if E==1 then
--- -         if string.upper(rstr(3,ee))=="LUA" then run(-t,ee,...)
--- -            else prompt(t,ee) end
        II=II end
     if E==2 then
prompt(42,stf([[L=%2d; F=%d; R=%d; T=%d; G=%d; acT=%d; ee=%s]],L,F,R,T,G,acT,[['="\\";=*;=']]))
        if T==1 then II=II end
        R=R and 2 end
  until E==0 or E==3
return ee,E
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,K=getfile(); if str==nil then str="E" end 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 rstr(1,str)=="\n" then str=lstr(-1,str) end
  if lstr(2,str)=="A/" then
     while str:find(".",3,1)==nil do str=getfile(str) end
     K=string.find("/|\\",chr,1,1) or 0
     if K>0 then writeln(rem..str)
        if K==1 then fcopy(24,str) end
        if K==2 then prompt(t,str) end
--- -         if K==3 then run(2,str) end
        str=rem..str.." -- end "..ch4 end end
  if K*#str>1 then str=textbox(cut(basline),cut(zeile),str,t) end
  wait(1)
if #str==1 then ch4="E" end
--getkey(5,chr..ch4)
return str
end
 
 
function getkey(x,...)
local K,t=0,1000
console_redraw()
--print('--',...)
--if ...~=nil then print(stf('*<%s>',...)) end
if ...~=nil then print(setarg("*<",...,">")) 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 menux(...)
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
repeat
  if K==29 then klix(1,...); K=9 end
  if K==13 then press "playback"; wait(8); release "playback"; K=9 end
  if K==2 and ti>333 then help(""); K=9 end
  if K==4 then if ti>333 then basline=rem..":-) ".. basline end
               ti=t end
  if K==5 and ti>333 then exitalt(5,"*<alt>"); K=9 end
  if K==6 then basline=edlin(" A AT"..basline); ti=t end
  if K==8 and ti>333 then W=0; WP=1<1
           if ti>t then find_str="" end end
  if K==9 then K,ti=getkey(t+9)
           if ti>333 then K=submenu(K); ti=t end end
--  if not _HLP then console_redraw() end
wait(9) until K~=9
return K,ti
end
 
function submenu(K)
II=II
return K
end
 
--- :...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
 
function scriptix(...)
--(D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y)
 
local function restore()
 D,E=0,0
 set_aelock(0); set_aflock(0)
 if Li>=0 then
    if RR then txt:close() end
    if RR and RW then bas:close() end end
 set_console_layout(0,0,25,5)
 set_console_autoredraw(1)
 print(U,"scriptiX:",Li,Lo,-Error)
 K=getkey(2004,collectgarbage("count"),err)
 collectgarbage()
return basfile
end
 
t=1000
arX=...
mdI=""
mdX="A/CHDK/SCRIPTS/"
if H>=0 then ee,mdI=img_info(t,arX)
   Hf={"---","H","L","S","B","german.HLP"}
   hfil=Hf[H+1]; Hf=nil end
if isfile(D) then log42=D else
   log42=""
   dir={"SCRIPTS/","LOGS/","BOOKS/","HELP/","LOGS/logiX/"}
   dd=dir[D+1]; dir=nil end
---  ".XxX" gewählte Zeilen editieren; Datei direkt modifizieren.
if type(E)=="number" then
   ext={".Lua",".bAs",".tXt",".baK",".Tmp",".lOg",".scX",".XxX",".xXx"}
   eXt=ext[E+1]; ext=nil end
if eXt==nil then eXt=".eXt" end
if eXt==".lOg" then mdX="A/CHDK/LOGS/" end
if eXt==".scX" then mdX="A/CHDK/LOGS/logiX/" end
sX="A/CHDK/SCRIPTS/scryptiX.Lua"
if not isfile(sX) then sX="A/CHDK/SCRIPTS/scriptiX.Lua" end
dd=dd or "SCRIPTS/"
wa="w"; if eXt==".tXt" then wa="a" end
ch4="ö"
ee=""
basfile=""
Glog="A/CHDK/LOGS/!Glog.tXt"
seP=" "
crLf="\n"
rem="rem "; remV="rem <"
 
acT=U/t
bug=0
Err=0
Error=0
II=0
if_x=t*t
Go=0
K=0
Li=-1
Lo=-1
rw=1
repZ=1
size_r=0
size_w=0
sec=0
X=0
RR=1<2
RW=C>=0 and E>=0
TF=2<1
TO=A==0
NE=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 pc==nil then pc="> " end
if arX==nil then arX="(...)" end
if hfil==nil and H>0 then H=-H end
if find_str==nil then
   find_str="@title><" end
if erriX==nil then erriX=mdX.."erroriX.tmp" end
if pau==nil then pau=0 end
if lineal==nil then lineal=":...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,...." end
basline=lineal
zeile=lineal
if type(Y)=="number" then Y=Y+1 end
if type(Y)=="string" then getkey(6,pc..Y) end
if Y~=nil then II=II end
 
--[ [
if H>=0 then for x=0,14 do
    set_console_layout(0,0,x*3,x)
    print(lineal)
    console_redraw(); sleep(88) end end--]]--
set_console_layout(0,0,45,14)
if H>0 then help(hfil) end
collectgarbage()
 
--:...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....--begin txt2bas --
--isfile(fpath("scriptix.lua"))
--isfile(fpath("log_0123.txt"))
  if not isfile(D) then log42,K=getfile(dd,...)
     if K==3 then restore() end
     wait(1) end
  K=begin(...)
     if K==3 then restore() end
     wait(1); 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; wait(1)
for x=A,P-1 do readln(); writeln(zeile) end
if Li>X then Z=0 end
  if_x=1; wait(1)
while Li<Z-C do
         repeat readln() 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 (Li%10==0)) or (is_pressed "menu") or (pau>333) then
            K,pau=menux(basline) end
         writeln(basline)
         collectgarbage() --!!
--- -         if pau>t then run(6,sX," D,4,8,9,1,-2,F,2,1,0,0,0,0,G,1,333")
--- -            K=getkey(2222,not IX,Lo,err) end
end --wh
 
tail()
done()
ee=os.date()
restore()
return ee
end--txt2bas
-- end --scriptix(...)
 ---
 
 
if t==nil then repeat IX,err=pcall(scriptix())
              -- if not IX then error(err,1) end
               K=getkey(2002,not IX); P=1
               until K<21
 
else ---T=t
     if OOO==nil then --local x,pc=...
     --if type(x)=="number" then
        D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y=... end --end
--if OOO==nil then D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y=... end
UUU=U
t=1000
if pc==nil then pc="| " else pc="0"..pc end
mdX,mdI="",""
print("D=",D," type:",type(D),pc,XXX)
print("E=",E,"H",H,"Mem:",collectgarbage("count"))
print("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); --getkey(1,D)
lineal=":...;....1....;....2....;....3....;....4....;....5....;....6....;....7....;...."
if type(D)=="string" and D:find(")",1,1)==nil
   and isfile(fpath(D)) then
   D,mdX=fpath(D); rC="-"; rem="--- "; print(lineal)
   if D:upper()~="A/CHDK/SCRIPTS/SCRIPTIX.LUA" and ((H or 0)>=0) then
      if E==nil then prompt(t,D)
--- -         else run(2,D,...); XXX=1 ---
      end
      K=getkey(1,D); if K<20 then XXX=t end
      end end
 
 if E==nil then D=nil end
 if D==nil then D=0 end    ---  1=/LOGS/
 if E==nil then E=0 end    ---  2=>>.tXt; =anhängen
 if H==nil then H=0 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=0 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    --- wait
 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," ß",collectgarbage("count"))
print("J",J,"C",C,"A",A,"Z",Z,"G",G,"W",W,"U",U,"Y",Y,":",type(Y)) end
if H<0 then if Y==nil then Y=0 end
            scriptix(D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y)
       else wait_click(W*t)
               repeat IX,Y=xpcall(scriptix(),scriptix())
               K=getkey(4002,not IX,err); P=1
               until K<21 end end
end
 
--[[
--- >blah
--- blahbla blah --- 88
--- +
--- _sleep(t) ;
--- blahbla blah --- 88
--- +3
--- ---- ---- -
--- ---- _; --false
--- blahbla blah ---88
--- _fasel
    --,D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y
--- % "---D%s,E%s,H%s,T%s,P%s,L%s,F%s,R%s,I%s,J%s,C%s,A%s,Z%s,G%s,W%s,U%s",D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U
--- % "---Li%s, Lo%s, Mem%s, geC%4d %s",Li,Lo,collectgarbage("count"),get_exp_count(),lineal
--- ---- &R=0; --:)
--- % "acT=%d; d=%3d; e=%d; f=%d; p=%d; --=",acT or 0,d or 0,e or 0,f or 0,p or 0
--- &dd=stf('%s',basline)
--- !dd=textbox('blah',dd,dd,t)
--- ---- ---- &dd=stf('%s',basline)
--- !dd
--- % "acT=%d;d=%d;e=%d;f=%d;p=%d; ---=*",acT or 0,d or 0,e or 0,f or 0,p or 0
--]]--
--- (D,E,2,9,1,-2,F,0,0,0,C,A,Z,G,1,111,Y
--- :---------------------------------------
--- <


--[[
-- ... Runtimeminimierung vorerst maximiert ...


P.S. {^myTodo^}
 ? Bisserl rechnen {X=Y*is_valid_verregnetes_Wochenende+Z*is_involved_Bitschmied+?)
(Dieses Glasperlenspiel fand eine Fortsetzung bei HostluaPortable notepad++>)
]]--

_______________________________[ "~~~^^~~~~~~~~~~~~~~~... :-({|= CHDK mit Kommandozeilenfeelinx \:D/ ...~~~~~~~~~~~~~~~^^~~~" ]______________________________
Code: Alles auswählen
--[[
@title scryptiX.lua
@chdk_version 1.4
@param s ??? >|<
@default s 0
@param T Testschalter
@default T 0
]]--
 
play_sound(1)
 --if (s or 0)<0 then reboot("A/CHDK/SCRIPTS/scriptiX.Lua") end
 
t=1000
if scriptix~=nil or s==nil then lineal=... end
if scriptix~=nil then
  if lineal==nil then lineal=[[3,9,2]] end
                           --  D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y=...
  if s==nil and lineal:find(")",1,1)==nil then
     dostr(0,stf([[D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y=%s]],lineal)) end
print("D=",D," type:",type(D),pc,Li)
print("E=",E,"H",H," ß",collectgarbage("count"))
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....;...."
 if pc==nil then pc="| " else pc="0"..pc end
 if isfile(D) then
    rC="-"; rem="--- "; print(pc,...)
    if D~=sX then local D,E=...
       if E==nil then prompt(t,D) else run(2,...); XXX=1 end
       k=getkey(z,D); if k<20 then XXX=t end
       end end
 
 if E==nil then D=nil end
 if D==nil then D=0 end    --- 0=/LOGS/
 if E==nil then E=0 end    --- 2=>>.tXt; =anhängen
--ext={".Lua",".bAs",".tXt",".baK",".Tmp",".lOg",".scX",".XxX",".xXx"}
 if H==nil then H=0 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=-3 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=0 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,"ß",collectgarbage("count"))
print("J",J,"C",C,"A",A,"Z",Z,"G",G,"W",W,"U",U,"Y",Y,":",type(Y)) end
 getkey(0,collectgarbage("count"))
               repeat IX,Y=xpcall(scriptix(),scriptix())
               k=getkey(4002,not IX,err); P=1
               until k<21 end--XXX
 
 
else local F=T; collectgarbage()
--   Da sind SX210is & Ixus230HS Mangels Speichers schon aus dem Rennen...
     local gsub,err=loadfile("A/CHDK/SCRIPTS/scriptiX.Lua")
     if not gsub then error(err,2)
        getkey(0,collectgarbage("count")); s=t end
     if s< 0 then assert(gsub)(1,1,0,T,1,-1,F,0,0,0,-1,1,0,10,8,0) elseif --<-RO!
                          --   D,E,H,T,P, L,F,R,I,J,C,A,Z,G,W,U,Y
        s==0 then assert(gsub)(0,0,0,T,1, 1,F,2,1,0,0,0,0,0,3,0) elseif
        s==1 then assert(gsub)(0,0,0,T,1,-2,F,2,0,0,0,1,0,0,3,0) elseif
        s==2 then assert(gsub)(2,8,2,T,1,-2,F,0,0,0,0,0,0,10) elseif
        s==3 then assert(gsub)(1,1,0,T,1,-2,F,0,0,0,0,0,0) elseif
        s==4 then assert(gsub)("scriptiX.Lua","fertiX.Lua",-1,T,1,0,F,2,0,0,0,0,0,G,1,0)
      elseif s==5 then assert(gsub)("log_0042.tXt",1,-1,T,1, 1,F,2,1)
      elseif s<t then assert(gsub)() end
    play_sound(0)
    II=II
 end
 


______________________________ [ "~~~^^~~~~... :-({|= 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 not 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()
wait_click(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_key("menu") then look(1) end -- oder Alt-Modus für Einstellungen verlassen.
   if is_key("display") then --<-- use Your key!
 --     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
wait_click(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
      --  sd870 anders 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
]]--

--- +
--- (7,7,1,60000,20,2,1,0,2,4,4,4,4,1,2,16,10,100


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)


_______________________________[ "~~~^^~~~~~~~~~~~~~~~... :-({|= Kleinigkeit mit aufschlußreicher Log-Datei \:D/ ...~~~~~~~~~~~~~~~^^~~~" ]______________________________
Code: Alles auswählen
--[[
@title enviriX.lua
@chdk_version 1.4
@param o Zahl:
@default o 0
]]--

Mem=collectgarbage("count")
print("---",o,-Mem)
print_screen(9999)
print("--- < enviriX.lua;  Mem",collectgarbage("count"),o)
print("--- < ",os.date())
if t==1000 then print("--- < ",...); o,x=... end
o=tonumber(o) or 0
x=0

if o>=0 then print("--- > ><@}{fun><0}{0x><0}{") end

set_console_layout(0,0,50,14)
for ee,lin in pairs(_G) do x=x+1
    if o>=0 then print(ee,lin) else print(ee) end
   while is_pressed("menu") do sleep(200) end
    sleep(99) end
print("--- ::",x,"Mem",collectgarbage("count"))
collectgarbage()
set_console_layout(0,0,25,5)
print_screen(0)
wait_click(99)
wait_click(9999)


_______________________________[ "~~~^^~~~~~~~~~~~~~~~... :-({|= & ein einfacher Zeilensortierer \:D/ ...~~~~~~~~~~~~~~~^^~~~" ]______________________________
Code: Alles auswählen
--[[
@title sortiX.lua
@chdk_version 1.4
@subtitle :...;....1....;....2....;....3....;....4....;....5....;....6....;....7....;....
@param s ??? >|<
@default s 0
]]--
 
 
function fsort(s,sfil)
local lin,x,X,S,abs={},0,0,0,s
   if s<0 then abs=-s end
   for ee in io.lines(sfil) do if abs<#ee then
       if s~=0 or ee~=lin[x] then x=x+1; lin[x]=ee; S=S+#lin[x] end
       end end
   print("--- < ",collectgarbage("count"))
   collectgarbage()
   table.sort(lin); X=x
   if s<0 then repeat print(lin[x]); x=x-1 until x<=0
          else repeat print(lin[X-x]); x=x-1 until x<=0
      end
   lin=nil
return -X,S end
 
 
if t==1000 then sfil,s=... end
s=tonumber(s) or 0
if io.type(sfil)~="file" then sfil=file_browser("A/CHDK/LOGS/") end
if sfil~="A/CHDK/LOGS/LOG_0123" then print_screen(0123) else print_screen(0124) end
print("--- < ",collectgarbage("count"),sfil,fsort(s or 0,sfil))
collectgarbage()
print("--- < ",collectgarbage("count"))
print_screen(0)

Zuletzt geändert von Caefix am 12.03.2019, 19:42, insgesamt 12-mal geändert.
EsGibtKeinenErdaufgangAufDemMond! SoSimpel...
Benutzeravatar
Caefix
CHDK-Begeisterter
CHDK-Begeisterter
 
Beiträge: 78
Registriert: 15.06.2018, 19:14
Kamera(s): Einige!

Re: Ideen zu Ubasix

Beitragvon Caefix » 31.12.2018, 17:10

Das Leben ist ein GO-Spiel fein, unterm letzten Stein liegt das Gebein.

Gerne hätte ich weiter noch an meinen Skripten gefeilt & getestet &...
Wenn´s gut genug reicht & zur Kamera paßt, viel Spaß damit...
Code: Alles auswählen
@title Range [X=(set+?+)-§]
@chdk_version 1.4
@param    x AuslöseModus
 @default x 1
 @values  x Manuell -Auto -Astro -BlitZe M-hdr
@param    a Dim md_feld ^2
 @range   a -11 11
 @default a 7
@param    q Modus [set+o+set]
 @range   q 1 75
 @default q 2
@param    c {MeßMethode wenn [md] blinkt}
 @default c 1
 @values  c yYy UuU vVv rRr gGg bBb
@param    Q Sum max. md_cells  ((~1s/10!!))
 @default Q 0
 @range   Q 0 121
@param    e CompInterv *10 (ms)
 @default e 2
 @range   e 1 999
@param    p Trigger Delay ^2 (ms)
 @default p 4
@param    f Reizschwe!!e -1? | 0 & Auto=INT
 @default f 3
 @range   f -128 255
@param    W -mdINTervall (s) | [key>>]
 @range   W 0 6000
 @default W 0
@param    E -Bel. Astro -sec | BlZ +Tv=
 @range   E -64 33
 @default E -30
@subtitle :...,....1....,....2....,....3....,....4....,....5
@param    v -Min.Batt *100 (mV:)
 @range   v 20 40
 @default v 20
@param    u Extended Echo/Logging
 @default u 1
 @range   u 0 1
@param    U {0}@
 @default U 1
@param    Z -Max. +Bilder|-Min   {xx1>ND}
 @default Z 999


t=1000
M=t*t
i=x=2
B=x=3
D=x=4
A=x%4>0
n=A+i*8*A
C=0
e=e*10
f=f&255
d=90+e+A*(9910-e)+(i+B)*50*t
i=i|D|(a<-2)
a=(a-a*(a<0)*2)|(B*15)
b=a+3*(a=0)
a=a+(a=0)
if E>0 then E=-E*32 else E=seconds_to_tv96 -E 1
F=get_exp_count+1
g=3-i
h=0
H=a*b*t+f
I=0
j=(a+1)/2
k=(b+1)/2
l=a/2+1
m=b/2+1
i=i+1
o=i
p=p*p
N=Z%10=1
O=get_zoom_steps
s=(O+2)/4
P=0
q=(is_capture_mode_valid q)*q
r=0
R=0
V=get_vbatt
v=v*100
X=0
y=get_iso_mode
Y=get_free_disk_space
z=0
S=get_tick_count
T=S


if f=255 then
print_screen -1
gosub "time"
do
 gosub "place"
 gosub "##look"
 do
  T=get_tick_count
  shoot
  if Q then gosub "##md_calc" else P=-T
  print F;"]",U;"@",-P;"ms",-a*b
  if Q then gosub "##shot"
  gosub "##sd"
  print Y-r;"kb",-P;"ms§",(r-Y)*t/P;"kb/s"
  Y=r
 until not is_pressed "right"
until is_key "shoot_half"
gosub "info"
print_screen 0
endif


if (f<255)*(A+(R>-1)) then goto "#work"
 playsound A*6
 gosub "info"
 print "...Warnix, Caefix..."
 wait_click 9999
 if is_key "shoot_half" then goto "#work"
end


:#work
playsound A*3
gosub "##set"
if (i=1)-B then gosub "place"
if A=0 then set_exit_key "no_key"

do
 if A*(((get_vbatt-v)<0)+((get_tick_count-S)/t/60+Z=0)) then A=-M
 if U%10*((n<9)-B) then gosub "##look" else set_tv96_direct E
 :#watch
   if C then press "shoot_full_only"
   h=get_tv96<768-A
   md_detect_motion a+h,b,1,d,e,f,g,h,i,j,k,l,m,n,o,p
   if D*h then goto "#watch"
   T=get_tick_count
   if C+(n=9)*(a*b>20)*((a*b-h)<(a+b)) then
    release "shoot_full"
    if C<1 then gosub "plan_c"
   endif
   if n<9 then wait_click 99
   if is_pressed "shoot_full"+is_key "remote" then press "shoot_full_only" else goto "#cont"
:)
   if D then gosub "##hdr"
   h=-1
 :#cont
 if (A*h)+(h=-1) then gosub "##shot"
 r=1-is_key "no_key"
 if r then gosub "##keys"
 if (h=0)*((I+A)>-1) then goto "#watch"
until (z=Z)+(I=-M)+(A<0)

goto "restore"



:##look
 set_aflock 0
 press "shoot_half"
 do
  sleep 240
 until get_shooting<1
 set_aflock 1
 release "shoot_half"
 x=get_focus
 R=get_tv96
 if x=X then goto "#skip"
 if random 0 1 then
  print get_min_stack_dist;"mm",get_near_limit;" - ";x;" - ";get_far_limit
  else
  print "(";get_zoom;")-Dist:",x;"mm  Tv=";R/32
 endif
 X=x
:#skip
return


:##shot
 playsound 1
 R=tv96_to_usec get_tv96
 sleep ((n=9)+C)*R/t
 release "shoot_full"
 if u*((Q>=a*b) or (W*9>a*b)) then gosub "##md_calc" else H=-a*b*t-h
 gosub "##sd"
 I=get_focal_length
 if R>M then R=-R/M else R=M/R
 if u then
 gosub "time"
 print -z-1,"[";get_exp_count;"]","((";H;"))"
 print P;"ms",Y-r;"kb"
 print "(";get_zoom;")- f=";I/t;".";I%t/100;"mm";" s/";R
 print (get_vbatt-v)/10;"$-";get_near_limit;"-<",get_focus,">-";get_far_limit
 sleep (42)
 endif
 release "shoot_half"
 Y=r
 z=z+1
 I=t
 if A*(f=0)>0 then I=W*I
 if A-B then gosub "##wait"
return


:##hdr
H=get_ev
release "shoot_full"
for h=-6 to 6 step 12
 gosub "##sd"
 Y=r
 set_ev H+h*16
 shoot
 playsound 5
 next h
set_ev H
return


:##zoom
h=(get_mode=1)
while h
 if R=-1 then click "zoom_in" else click "zoom_out"
 h=0
 R=M
 sleep 50
wend
if R=M then return

set_zoom_speed 80
:#zoo
h=get_zoom+(R+2)
T=get_tick_count+90
if (h<0)+(h>O) then goto "#zoomed"
 h=get_zoom+(R+2)*s
 h=h*(h>0)
 if h>O then h=O
 set_zoom h
 sleep ((s+20)+(O<16)*s*50)*10
 R=-1-2*is_key "zoom_out"
 if is_pressed "zoom_in"+is_pressed "zoom_out" then goto "#zoo"
:#zoomed
print (R+2)*s;"+>(";get_zoom;")->";get_focal_length;"mm<-";get_tick_count-T;"ms"
if s<2 then s=((O+2)/4)*2
s=(s+1)/2
playsound 4
return


:##keys
is_key F "set"
set_lcd_display 1
if F then playsound 2
do
 if F then wait_click 1
 if is_pressed "down" then click "down"
 if is_pressed "left" then click "left"
 if is_pressed "right" then click "right"
 if is_pressed "up" then click "up"
 if is_pressed "set" then click "set"
 if is_pressed "menu" then click "menu"
 if F*is_pressed "playback" then click "playback"
 if is_pressed "video"+is_pressed "face"+is_pressed "print"+is_pressed "help"+is_pressed "display" then gosub "##mykeys"
 R=0-is_pressed "zoom_in"-3*is_pressed "zoom_out"
 if R then gosub "##zoom"
 if is_pressed "shoot_full" then
  if get_mode=1 then goto "#done"
   press "shoot_full_only"
   T=get_tick_count
   gosub "##shot"
  :#done
  I=-get_mode*M
  endif
 F=F-is_pressed "shoot_half"
until (F<1)+(-I=M)
gosub "zzz"
return


:zzz
console_redraw
playsound 4
if D+get_mode then return
while is_pressed "shoot_half"
if is_pressed "shoot_full" then
T=get_tick_count
shoot
gosub "##shot"
endif
wend
h=f=255
return


:##mykeys
playsound 2
gosub "zzz"
do
 if is_pressed "up" then gosub "place"
 if is_pressed "right" then exit_alt
 if is_pressed "down" then goto restore
 if is_pressed "menu" then gosub "##look"
 if is_pressed "set" then set_capture_mode q+2*(q=0)
 wait_click 99
 if is_key "shoot_full" then I=-M
until is_key "shoot_half"+(I=-M)
return


:##wait
wait_click 1
if is_pressed "shoot_half" then gosub "##mykeys"
if is_key "set" then
 set_focus -1
 gosub "place"
 T=get_tick_count
 endif
if is_key "left" then print I+T-get_tick_count,-X
if is_key "up" then console_redraw
if is_key "down" then set_lcd_display 0
if I%10=8 then
 I=I*is_key "no_key"
 if is_pressed "left" then I=-M
 endif
I=I-A-(is_key "right"+is_key "remote"+A*((get_vbatt-v)<0))*I
if (I+T-get_tick_count)>0 then goto "##wait"
return


:##md_calc
H=h*10*t*(f>0)
for I=0 to a*b-1
 if h*f then md_get_cell_diff I/a+1,I%a+1,r else md_get_cell_val I/a+1,I%a+1,r
 H=H+(1-2*(h<1))*r
next I
P=get_tick_count-T
return


:##sd
for I=0 to get_raw
x=0
do
x=x+1
 sleep 50
 r=get_free_disk_space
until (Y>r)+(x>42)
if I<>get_raw then Y=r
next I
P=get_tick_count-T
A=(-(r<20000)*r)|A
return


: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 (z=0)*(f<99)*h 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)
return


:plan_c
C=1
n=0
E=(E>-320)*E
set_ev get_ev-192
set_nd_filter 1
return


:##set
set_aelock 0
gosub "##look"
if B then
 set_ev get_ev-192
 e=9
 if E<0 then E=444
 g=0
 o=3
 p=0
 N=N|(R>9)
 endif
if (n=9)+B then
 set_capture_mode 2
 set_raw_nr 1
 set_iso 1
 set_focus -1
 sleep 3*t
 set_aelock 1
 set_aflock 1
 if (n=9)*(R>1) then gosub "plan_c"
 endif
if N then set_nd_filter 1
set_lcd_display 1
print_screen F
print "---Logfile ~ LOG_";F;".TXT"
print U;"@ PS";get_propset;"  PID:";get_platform_id
print get_prop 0,get_capture_mode,q,"IS";get_IS_mode,"ND";get_nd_present,"(";get_zoom;")<";O
gosub "info"
I=2018
gosub "##wait"
set_draw_title_line 1-A
playsound 4
return


:info
gosub "time"
print "°C Opt.";get_temperature 0;", CCD:";get_temperature 1;", Bat:";get_temperature 2
if z+(f=255) then gosub "##md_calc"
print get_tick_count-S;"ms ((";H;"))",A,get_vbatt-v;"mV$"
print get_exp_count;"/ Bat:";get_vbatt;"mV -";V-get_vbatt
I=(z>0)*3008
gosub "##wait"
return


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



:restore
if N+C then set_nd_filter 2
set_ev get_ev+(B+C)*192
set_lcd_display 1
set_draw_title_line 1
gosub "info"
print "==> In",(get_tick_count-S)/t/60,"Min",z,"*+* *~-."
set_aflock 0
set_aelock 0
set_iso y
playsound 5
I=8888
gosub "##wait"
if I=-M then goto "#work"
if A-B then exit_alt
end

:rem ERROR

:sht
return



_______________________________[ "~~~^^~~~~~~~~~~~~~~~... im Notepad++ (language Batch) wird´s bunt \:D/ ...~~~~~~~~~~~~~~~^^~~~" ]_____________________________
Code: Alles auswählen
@title Luggage
@chdk_version 1.4
@param e CompInterv *10=e
@default e 3
@param f Trigger Threshold f
@default f 1
@param p Trigger Delay (ms) p
@default p 1
@subtitle :...,....1....,....2....,....3....,....4....,....5
@param F LOG_xxxx.TXT
@default F 1001
@param v -Min.Batt *100 (mV:)
@range v 20 40
@default v 20
@param U {0}@
@default U 1

A=0
a=7
b=7
c=1
d=500
D=1
e=e*10
g=3
h=0
H=0
i=1 
j=1
k=1
K=0
l=a
m=b
M=999999
n=4
o=1
O=get_orientation_sensor
r=0
R=0
s=1
S=get_tick_count
t=get_tick_count
T=get_tick_count
v=v*100
V=get_vbatt
x=1
Y=get_iso_mode
z=0
Z=999


rem init
cls
  if V>v then goto "##work" else rem :)
     playsound 6
     print V,"mV => Energiemix isnix!"
     print "Warnix, Caefix!"
     wait_click 10000
     if is_key "shoot_half" then goto "##work"
    
end


:##work
   set_exit_key "print"
   rem set_exit_key "face"
   F=F-1
   gosub "##settings"
   playsound 4
   wait_click 10
   gosub "##place"

do
   :##watch
       T=get_tick_count
       rem md_detect_motion a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p
       md_detect_motion a,b,1,d,e,f,g,h,i,j-h,k,l,m,n,o,p
       if h>0 then print get_tick_count-T,"ms -#-",get_orientation_sensor,"---",h else goto "##cont"
          if (T-t)<30000*D then
             sleep 500
             while is_pressed "down"
            wait_click 10
             wend
        endif
          H=h
    :##cont
    if (h=0) then h=get_orientation_sensor-O
    if (T-t)>300000 then gosub "##batt"
    wait_click 10
    r=1-is_key "no_key"
    if r then gosub "##keys"
    if (h=0) then goto "##watch"
    gosub "##shock"
until (z=Z) or (r=1)

goto "##exit"



:##shock
   playsound 2
   h=H*10000
   for H=0 to a*b-1
       md_get_cell_diff H/a+1,H%a+1,K
       h=h+K      
   next H
   print z;". "; get_time 2;":"; get_time 1;":"; get_time 0;" =-";O/10;"-= ";h
   O=get_orientation_sensor
   sleep 1000

   if s=0 then goto "##skip"
      playsound 4
      if h>1 then playsound 4
      if h>100 then playsound 2
      if h>1000 then playsound 5
      if h>3001 then playsound 6
      if h>10000 then playsound 0
      if h>30001 then playsound 3
      if h>99999 then playsound 1
   :##skip
   if A and (get_capture_mode=0) then playsound 7
   z=z+1
   H=0
return


:##keys
    r=is_key "set"
  do   
    if is_pressed "shoot_full" then gosub "##shot"
    if r<>0 then wait_click 10
    if is_pressed "down" then click "down"
    if is_pressed "left" then click "left"
    if is_pressed "right" then click "right"
    if is_pressed "up" then click "up"
    if is_pressed "set" then click "set"
    if is_pressed "zoom_in" then click "zoom_in"
    if is_pressed "zoom_out" then click "zoom_out"
    if is_pressed "menu" then click "menu"
    if is_pressed "playback" then exit_alt
    if is_key "shoot_half" then h=-1
    if h=-1 then
       playsound 2*s+2
       r=get_tick_count-S
       print O;"-=  -------- ";r/60000;":";r%60000/1000;",";r%1000/10
       wait_click 980
       D=1
       r=0
       endif
    if is_pressed "no_key" then r=(get_tick_count-T)<120000 else T=get_tick_count
  until r=0
  if is_key "up" then s=1-s
  if is_key "down" then D=1-D
  if is_key "menu" then gosub "##settings"
  if s=1 then playsound 5
  set_lcd_display D
  console_redraw
  O=get_orientation_sensor
  t=get_tick_count
return


:##shot
   if A*get_capture_mode then shoot
   if s=1 then playsound 1
   sleep 1000
   if is_pressed "shoot_full" then A=1-A
   if A=1 then playsound 3
   release "shoot_full"
   release "shoot_half"
   h=0
   r=0
   if get_capture_mode then D=1-A
   print s,"==------=#=------==",A
   gosub "##info"
   wait_click 1000
   wait_click 10
return


:##batt
   rem set_lcd_display 0
   print T,t,T-t
   g=(g-1) & 3
   if get_vbatt<v then
      h=0
      z=Z
      gosub "##shock"
      playsound 6
   endif
return


:##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 (z=0)*(f<99)*h 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)
return

:##look
 set_aflock 0
 press "shoot_half"
 do
  sleep 240
 until get_shooting<1
 set_aflock 1
 release "shoot_half"
 x=get_focus
 R=get_tv96
 if x=X then goto "#skip"
 if is_pressed "shoot_half" then
  print get_min_stack_dist;"mm",get_near_limit;" - ";x;" - ";get_far_limit
  else
  print "(";get_zoom;")-Dist:",x;"mm  Tv=";R/32
 endif
 X=x
:#skip
return

:##info
print U;"@  ",get_tick_count-S
print get_time 5;"/";get_time 4;"/";get_time 3,"//",get_time 2;":";get_time 1;":";get_time 0,"---"
print "°C Opt.";get_temperature 0;", CCD:";get_temperature 1;", Bat:";get_temperature 2
print get_exp_count;"/";get_orientation_sensor;"/ Bat:";get_vbatt;"mV -";V-get_vbatt
if s=1 then sleep 3000
return


:##settings
   playsound 4
   print_screen 0
   set_lcd_display 1
   F=F+1
   print_screen F
   if F>0 then print "--- Logfile ~ LOG_";F;".TXT"
   print get_propset,get_IS_mode,get_nd_present,get_zoom_steps,get_platform_id
   gosub "##info"
return



:##exit
if z<>Z then goto "restore"

:restore
set_lcd_display 1
set_aflock 0
set_aelock 0
set_iso Y

print " In ";(get_tick_count-S)/60000;" Min ";z;" *+* *~-."
gosub "##info"
playsound 5
sleep 100
playsound 0
if z=Z then shut_down
sleep 3100

  wait_click 10000
do
  is_key k "down"
until k<=1
end


--------------------------------------------------------------------------------------[ Hier ruht Caefix, #4447 - Error404 ]---------------------------------------------------------------------------------
EsGibtKeinenErdaufgangAufDemMond! SoSimpel...
Benutzeravatar
Caefix
CHDK-Begeisterter
CHDK-Begeisterter
 
Beiträge: 78
Registriert: 15.06.2018, 19:14
Kamera(s): Einige!


Zurück zu Code-Ecke

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast

cron