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: 6
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: 4538
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/ ...~~~~~~~~~~~~~~~^^~~~" ]_____________________________
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-- ...  }   ~~=xxxxx13646XXX]]--

--[[
@title scriptiX.lua
@chdk_version 1.4
@param D Startordner
@values D LOGS SCRIPTS BOOKS HELP (.scX)
@param E Endung
@values E .bAs .Lua .tXt .baK .tmp .scX .XxX
@param T try and error
@values T --- dofile loadfil loadstr require
@param P bearbiten  +ab|0>_|-letzte
@default P 1
@param L edit Zeile  xxx>_ (!-=^^=!)
@default L 0
@param F finde Zeile
@values F --- for while until then else #^^%q%q
@param R rem Zeilen
@values R JA nein >_rem_?
@param I *?* Insertix
@values I nein JA
@subtitle :...,....1....,....2....,....3....,....4....,....5
@param i Layoutix?
@values i nein JA
@param C Kürzen           (!-=RO=-!)
@default C 0
@param A Ab Zeile (|0)
@default A 1
@param Z Bis Zeile
@default Z 9999
@param G LOG_~.TXT (+Neu|-Anh|0=gec)
@default G -999
@param H Hilfedatei
@values H --- german ???
@param W Laufzeitbremse
@default W 5
@param U {}@
@default U 1
--]]


Dir={"LOGS/","SCRIPTS/","BOOKS/","HELP/","LOGS/logiX/"}
 dd=Dir[D+1]
--- ".XxX" gewählte Zeilen editieren; Datei direkt modifizieren.
Ext={".bAs",".Lua",".tXt",".baK",".tmp",".scX",".XxX"}
 ext=Ext[E+1]
Hf={"?","german.HLP","???"}
 hfil=Hf[H+1]
if hfil=="???" then hfile=file_browser("A/CHDK/HELP/") end
HLP=hfil~="?"
md="A/CHDK/SCRIPTS/"
if ext==".scX" then md="A/CHDK/LOGS/logiX/" end
wa="w"; if ext==".tXt" then wa="a" end
find_str="?"
arX="(...)"
rem="rem "

t=1000
bug=0
E=0
Err=0
Error=0
II=0
if_x=t*t
go=0
k=0
lenz=0
li=0
lo=0
rw=1
size_r=0
size_w=0
S=0
x=0
X=0
RR=1<2
RW=(Z>0) and (C>=0)
TO=A==0
WP=W<0
if WP then W=-W end
if I>0 then II=1 end
if i==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=-Z end
if RW then rr="rw" else rr="RO" end
if ext==".XxX" and L>-1 then L=-1 end
lineal=":...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,...."
basline=lineal


function restore()
 if RR then txt:close() end
 if RW then bas:close() end
 set_console_layout(0,0,25,5)
 set_console_autoredraw(1)
 print(U,"skriptiX:",li,lo,-Error)
 wait_click(9999)
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 G=-G end
print_screen(0)
return l
end


function help(...)
repeat
local str=...
local lin=...
local x=0
local k=0
local l=t
hfile="A/CHDK/HELP/"..str
if str=="" then hfile=file_browser(hfile) elseif #str==1 then hfile=getstr(...) end
for lin in io.lines(hfile) do x=x+1
  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
         if k==29 then go=golog(str) end
     end end --ii
   lin="" end -- wh lin
end --io
k=getkey(5)
until k~=5
return x
end

function img_info(...)
---
k=5
end

function klix(...)
local k=0
repeat
  repeat
    set_aflock(0)
    press("shoot_half")
    repeat sleep(42)
      ii=get_free_disk_space()
    until get_shooting and not is_pressed "shoot_half"
    press("shoot_full")
    set_aflock(1)
    play_sound(1)
    release("shoot_full")
    repeat sleep(t)
      kk=get_free_disk_space()
      play_sound(4)
    until ii>kk
    release("shoot_half")
  until not is_pressed "shoot_half"
 repeat k=getkey(5)
--if k==8 then img_info(DIY) end
  if k==5 then exit_alt() end
 until k~=5
until k~=29
return k
end

function wait(W)
repeat wait_click(W*100+1)
until not is_pressed "right"
end

function printf(...)
 local str=string.format(...)
 print(str)
 return str
end

------------------------------------------------------

function begin(...)
   log42 = file_browser("A/CHDK/"..dd)
   basfile=log42
   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
   if E>0 then
      if L==0 then L=1 end
      if L>0 then L=-L end end
   if bug>0 then play_sound(6) end
   if RW then
      for x=1,rw do
          if ext==".scX" then local x=os.mkdir(md) end
          if ext==".XxX" then ubasic="xyx00xyx" else
          ubasic=textbox(dd..rr..ext,os.date(),"fertiX",8) end end
      if ubasic=="" then ubasic="!!IXIXIX" end
      basfile=printf(md..ubasic..ext)
      if log42==basfile then print("  >>--->>")
         basfile=printf(md.."tempX"..ext) end
      if log42==basfile then RW=false end end
   if RW then rw=1 else rr="RO"; rw=0 end
    
   if F>0 then
      Ext={"for =,???remd_---","while (<=~=>)","until (<=~=>)","(<=~=>) then","=else =gosubto",":##==^^\34\34","???"}
      find_str=textbox(basfile,rr..lineal,Ext[F],t)
      if find_str=="" then find_str=" " end end
   Ext=nil
   FI=#find_str>1
   S=get_tick_count()
   printf(">> %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>X then Z=X end
   basline=lineal
   --basline=ubasic
end


function nubas(camera_name)
txt=io.open(log42,"r")
if RW then bas=io.open(basfile,wa)
   bas:write(rem..os.date().."\n")
   bas:write(rem,"scriptiX für "..camera_name.."\n") end
end
       
function head(camera_name)
bi=get_buildinfo()
nubas(bi.platform)
if RW then writeln(printf("%s %d %s ",rem,-U,"@ -- "..ubasic..ext))
      else printf("%s%s ",rem,string.upper(bi.platform)) end
wait_click(9999)
end


function readln(...)
   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.byte(zeile,1)
      if cb1==42 then ins_block(...) end
      if cb1==114 and string.find(zeile,rem,1,1)~=nil and #zeile>4
        then zeile=rem_block(zeile) end end
   lenz=string.len(zeile)
   size_r=size_r+lenz
end

function play_string(...)
local str=...
   lz=string.len(...)
   E=0
   for i=1,bug*lz 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(...,"^")~=nil) then str=""
        for i=1,lz 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,li," EYn ^VV^ildsch^vv^eYn! ",lo))
      play_sound(2)
       wait_click(0)
       if RW and k~=t*t then str=edlin(str) end end
   return str
end   

function newline(...)
local str=...
   if (bug==0) and (L>=0) and (string.find(...,"^")~=nil)
      then str=play_string(...) end
   if TO then print(str,";")
      elseif (li==lo) then print(li,"> ",str,";")
      else printf("%d %s %d",li,">"..str..";",lo) end
   wait(W)
   return str
end
   
function writeln(...)
local str=...
   lo=lo+1
   if FI and k~=t and (string.find(...,find_str)~=nil) then
      wait_click(0)
     if RW then str=edlin(str) end end
   if R~=1 and (str=="") or str==("**") then str=string.format("%s%d",":-)",lo) end
   if RW then bas:write(str,"\n") end
   size_w=size_w+string.len(str)
end


function tail(x)
if RW then
 k=getkey(0)
if k==24 then newline(arX); lo=lo+1
         writeln("--[[ \n"..arX) 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,size_w-8192,-Error)
 print(U,basfile," in s",(S-get_tick_count())/t)
 play_sound(1-bug)
 k=getkey(0)
 for x=13,0,-1 do
     set_console_layout(0,0,x*3,x)
     console_redraw()
    sleep(88) end
end


------------------------------------------------------

function check(...)

 local function fcopy(...)
 local str=...
 local lin=...
 local x=0
 for str in io.lines(...) do x=x+1
  if str~="" and str~="\n" then lin=str end
   if k==8 then print(x,".",str) end
   if k==22 then golog(str) end
   if k==24 then k=t*t
      newline(str)
      writeln(str) end
 end
 k=88
 if lin~="" and string.sub(lin,1,1)=="(" then arX=str end
 return lin
 end

 local function run(...)
 local str=...
 str=str..arX
 --if arX=="(...)" then
 arX=textbox(basline,str,arX,t) --end
 print_screen (-44)
   if T==0 then T=getkey(2)/2 end
   if T==1 then dofile(str) end
   if T==2 then local file = assert(loadfile(str))() end
   if T==3 then assert(loadstring(str))() end
   if t==4 then require(str) end
 print_screen (0)
 end

local str=...
 if str=="" then ch4="D" end
 if ch4==" " then str="   " end
 if ch4=="G" then golog(...) end
 while ch4=="D" do ch4="K" ---<<!!
    str=getstr(str)
 end --wh
 if ch4=="E" then str=rem.." ??? Error --- ^ "..str end
 if str=="" then str=rem end
 
 while ch4=="K" do k=getkey(0)
    while k<t and string.find(str,".")~=nil do play_sound(3)
       while k==29 do run(str)
          k=getkey(0)
          if k==4 then str=textbox(basline,lineal,str,t)
            k=getkey(0) end end
       if k==8 or k>20 then str=fcopy(str) --letzte Zeile
              if str~="--" then k=getkey(0) end 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
 ch4="KK" end

--- ...
return str
end

function edlin(...)
local str=...
repeat
   repeat if str=="" then str=... end
      str=textbox(basline,str,...,t)
      lz=string.len(str)
   until lz>2
   while string.sub(str,1,3)==" A " do
      ch4=string.sub(str,4,4)
      str=string.sub(str,5,lz)
      if string.sub(str,1,2)=="AT" then str="" end
      str=check(str)
      ---
   end --wh
   k=0
   lz=string.len(str)
   ce=string.sub(str,lz,1)
   if ce==")" then arX=str end
   if ce==" " and if_x<t*t then k=t
      str=string.sub(str,1,lz-1)
      if lz>2 then writeln(str) else k=0 end end
   if string.sub(str,1,4)=="    " then go=golog(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 ins_block(x)
ch2=string.sub(zeile,2,2)
zeile=rem.." -- *"..zeile
for i=1,II do
 if ch2=="*"  then writeln(rem,"*? (]wwwwww>  +|-|=)?") end
 if ch2=="^"  then zeile=textbox(basline,zeile,zeile,t) end
 if ch2=="?"  then zeile=edlin(rem,"???##(<=~=>)") end
 if ch2=="!"  then k=getkey(x)
                   II=II end
 if ch2=="-"  then wait_click (9999) end
 if ch2=="+"  then zeile="wait_click 9999" end
 if ch2=="("  then arX=string.sub(str,2,t) end
 
 ---[[  Reserviert f. keylogiX :###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
end

function rem_block(...)
local str=...
ch5=string.sub(str,5,5)
if (R==1) or (ch_5=="-") then str=rem end
for i=2,R do --- rems auswerten?
   if ch5=="?" then str=edlin(...) end
   if ch5=="@" then Z=0 end
   if ch5==":" then k=getkey(2) end
   if ch5=="(" then arX=string.sub(str,5,t) end
   while string.sub(str,4,6)==" A " do ch4="D"
       if #str<7 then str="" else str=string.sub(str,7,t) end
       str=check(str) end
end --for R
return str
end


function menu(...)
local k=getkey(2)
 if k==29 then klix(x) end
 if k==2 then basline=edlin(...) end
 if k==4 then basline=rem..":-)" end
 if k==5 then exit_alt() end
 if k==6 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)
end

function getstr(...)
local k=1
local str=...
  if str=="" then str="C" end
  if str=="A" then str="A/" end
  if str=="C" then str="A/CHDK/" end
  if str=="B" then str="A/CHDK/BOOKS/" 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=="X" then str=md end
  if str=="F" then str="---function xyz(,,,...) \\n--- ?\\n---end" end
  if str=="M" then str="md_detect_motion a,b,1,d,e,f,g,h, i,j,k,j+(a%2=0)-(a=2),k+(b%2=0)-(b=2), n,o,p" end
  if string.sub(str,1,2)=="A/" then k=0
     str=file_browser(str) end
  for x=1,k do if #str~=1 then str=textbox(basline,lineal,str) end end
return str
end

function getkey(x,...)
local k=0
if ...~=nil then print(...) end
if x<8 then play_sound(x)
   repeat wait_click(9) until is_key "no_key"
   console_redraw()
   wait_click(0)
   sleep(33) end
 if is_pressed "shoot_half" then k=29 end
 if is_pressed "face" then k=1 end
 if is_pressed "up" then k=2 end
 if is_pressed "video" then k=3 end
 if is_pressed "left" then k=4 end
 if is_pressed "set" then k=5 end
 if is_pressed "right" then k=6 end
 if is_pressed "display" then k=7 end
 if is_pressed "down" then k=8 end
 if is_pressed "menu" then k=9 end
 if is_pressed "help" then k=11 end
 if is_pressed "playback" then k=13 end
 if is_pressed "print" then k=16 end
 if is_pressed "zoom_in" then k=22 end
 if is_pressed "zoom_out" then k=24 end
 while x==t do x=0
    k=get_orientation_sensor()
    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
 sleep(99)
return k
end


--begin txt2bas --
set_console_layout(0,0,45,13)
if HLP then help(hfil) end
begin()
play_sound(rw)
head()

for x=1,A-1 do readln(...) end
if_x=t
for x=A,P-1 do readln(...)
    writeln(zeile) end
if P>X then P=P*P end
if_x=1
for x=P,Z-C*rw do readln(...)
    if RW and (L==li or L==-li) then zeile=edlin(zeile) end
   basline=newline(zeile)
    if WP and x%12==0 or is_pressed "menu" then menu(basline) end
    writeln(basline)
    if is_pressed "down" then W=0 end
end --=next x

tail()
done()
restore()
--end txt2bas --[[

--[[
-- ... 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/ ...~~~~~~~~~~~~~~~^^~~~" ]_____________________________
Caefix
CHDK-Einsteiger
CHDK-Einsteiger
 
Beiträge: 6
Registriert: 15.06.2018, 20:14
Kamera(s): Einige!


Zurück zu Code-Ecke

Wer ist online?

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