titus
New Member
Posts: 7
|
Post by titus on Sept 23, 2022 10:18:55 GMT -5
this is a try at nlp
i tryed to create the first comand but i get a error that i did not expekt
'' titus 23 sept 2022 '' Naturel Language Prosesing proof of consept WindowWidth = DisplayWidth WindowHeight = DisplayHeight global winw , winh winw = WindowWidth winh = WindowHeight dim color$( 3 ) , plek$( 6 , 6 ) color$(1)="red green yellow blue pink cyan" color$(2)="rood groen geel blauw paars cyaan" color$(3)="ruga verda flava blua purpla ciana" menu #m , "help" , "?" , [help] textbox #m.txt 50 , winh - 50 , 500 , 50 button #m.btn "go !" , [go] , UL , 600 , winh - 50 , 50 , 50 global talenS : talen$ = "english nederlands esperanto" global taal$ : taal$ = "english" global create$ : create$ = "create maak faru" global put$ : put$ = "put zet metu" global on$ : on$ = "on op sur" open "BLOCK WORLD 1.0" for graphics as #m #m "trackclose [quit]" wait [quit] close #m end [go] #m.txt "!contense? in$" fl = 0 ''comand not fount jet if word$( in$ , 2 ) = "" _ and instr( talen$ , in$ ) then taal$ = in$ fl = 1 end if t = gettaalnr() if t and word$( in$ , 1 ) = word$( create$ , t ) then klnr = getcolornr( word$( in$ , 2 ) ) if getcolornr( word$( in$ , 2 ) ) then kl$ = word$( color$( 0 ) , klnr ) while not( plek$( x , 0 ) = "" ) x = x + 1 wend plek$( x , 0 ) = kl$ fl = 1 else select case taal$ case "nederlands" notice "FOUT !! : "+CHR$(13) _ +word$( in$ , 2 ) + " is geen bekende kleur !!" case "esperanto" notice "ERARO !! :" + CHR$(13) _ +word$( in$ , 2 ) + " mi ne scias tio coloro !!" case else notice "ERROR !! :" + chr$( 13 ) _ +word$( in$ , 2 ) + " i do not know that color !!" end select end if
if fl = 0 then select case taalS case "nederlands" notice "FOUT !! : ik begrijp dit niet !!" case "esperanto" notice "ERARO !! : mi ne komprenas !!" case else ''default is english notice "ERROR !! : i do not understand !!" end select end if wait [help] txt$ = "" select case taal$ case "nederlands" txt$ = "Instrukties : " + txt$ = txt$ + "de volgende opdrachten zijn daar :" + chr$( 13 ) txt$ = txt$ + "english : put this code on english mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "maak <kleur> ." + chr$( 13 ) txt$ = txt$ + "zet <kleur> op <kleur> ." + chr$( 13) txt$ = txt$ + "<kleur> = " ; color$( 2 ) case "esperanto" txt$ = "Legu : " + txt$ = txt$ + "Oni eblas klavaru :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "faru <coloro> ." + chr$( 13 ) txt$ = txt$ + "metu <coloro> sur <coloro> ." txt$ = txt$ + "<coloro> = " ; color$( 3 )
case else txt$ = "Instruktions : " + txt$ = txt$ + "The flowing comands are there :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "create <color> ." + chr$( 13 ) txt$ = txt$ + "put <color> on <color> ." txt$ = txt$ + "<color> = " ; color$( 0 ) end select wait function gettaalnr() i = 0 for j = 1 to 3 if taal$ = word$( talen$ , j ) then i = j next j gettaalnr = i end if function getcolornr( colorin$ ) t = gettaalnr() i = 0 for j = 1 to 4 if colorin$ = word$( color$( t ) , j ) then i = j end if next j getcolornr = i end function
|
|
|
Post by Walt Decker on Sept 23, 2022 12:33:33 GMT -5
What is the error? Is it a compile-time error or a run-time error?
I expect it is a compile-time error because:
function gettaalnr() i = 0 for j = 1 to 3 if taal$ = word$( talen$ , j ) then i = j next j gettaalnr = i end if '<--- ERROR HERE; THIS SHOULD BE END FUNCTION
function getcolornr( colorin$ ) t = gettaalnr() i = 0 for j = 1 to 4 if colorin$ = word$( color$( t ) , j ) then i = j end if next j getcolornr = i end function
|
|
honky
Junior Member
Posts: 63
|
Post by honky on Sept 24, 2022 2:09:53 GMT -5
It's not: "#m "trackclose [quit]" but: #m "trapclose [quit]"
|
|
|
Post by Rod on Sept 24, 2022 3:27:06 GMT -5
I knocked a few bugs out of it. Not sure it is doing what you want quite yet. Bugs were mostly spelling and occasional logic errors.
'' titus 23 sept 2022 '' Naturel Language Prosesing proof of consept WindowWidth = DisplayWidth WindowHeight = DisplayHeight global winw , winh winw = 800 winh = 600 dim color$( 3 ) , plek$( 6 , 6 ) color$(1)="red green yellow blue pink cyan" color$(2)="rood groen geel blauw paars cyaan" color$(3)="ruga verda flava blua purpla ciana" menu #m , "help" , "?" , [help] textbox #m.txt 50 , winh - 50 , 500 , 50 button #m.btn "go !" , [go] , UL , 600 , winh - 50 , 50 , 50 global talenS : talen$ = "english nederlands esperanto" global taal$ : taal$ = "english" global create$ : create$ = "create maak faru" global put$ : put$ = "put zet metu" global on$ : on$ = "on op sur" open "BLOCK WORLD 1.0" for graphics as #m #m "trapclose [quit]" wait
[quit] close #m end [go] #m.txt "!contents? in$" fl = 0 ''comand not fount jet if word$( in$ , 2 ) = "" and instr( talen$ , in$ ) then taal$ = in$ fl = 1 end if t = gettaalnr() if t and word$( in$ , 1 ) = word$( create$ , t ) then klnr = getcolornr( word$( in$ , 2 ) ) if getcolornr( word$( in$ , 2 ) ) then kl$ = word$( color$( 0 ) , klnr ) while not( plek$( x , 0 ) = "" ) x = x + 1 wend plek$( x , 0 ) = kl$ fl = 1 else select case taal$ case "nederlands" notice "FOUT !! : "+CHR$(13) _ +word$( in$ , 2 ) + " is geen bekende kleur !!" case "esperanto" notice "ERARO !! :" + CHR$(13) _ +word$( in$ , 2 ) + " mi ne scias tio coloro !!" case else notice "ERROR !! :" + chr$( 13 ) _ +word$( in$ , 2 ) + " i do not know that color !!" end select end if end if
if fl = 0 then select case taal$ case "nederlands" notice "FOUT !! : ik begrijp dit niet !!" case "esperanto" notice "ERARO !! : mi ne komprenas !!" case else ''default is english notice "ERROR !! : i do not understand !!" end select end if wait
[help] txt$ = "" select case taal$ case "nederlands" txt$ = "Instrukties : " txt$ = txt$ + "de volgende opdrachten zijn daar :" + chr$( 13 ) txt$ = txt$ + "english : put this code on english mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "maak <kleur> ." + chr$( 13 ) txt$ = txt$ + "zet <kleur> op <kleur> ." + chr$( 13) txt$ = txt$ + "<kleur> = " ; color$( 2 ) case "esperanto" txt$ = "Legu : " txt$ = txt$ + "Oni eblas klavaru :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "faru <coloro> ." + chr$( 13 ) txt$ = txt$ + "metu <coloro> sur <coloro> ." txt$ = txt$ + "<coloro> = " ; color$( 3 )
case else txt$ = "Instruktions : " txt$ = txt$ + "The flowing comands are there :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "create <color> ." + chr$( 13 ) txt$ = txt$ + "put <color> on <color> ." txt$ = txt$ + "<color> = " ; color$( 0 ) end select wait function gettaalnr() i = 0 for j = 1 to 3 if taal$ = word$( talen$ , j ) then i = j next j gettaalnr = i end function function getcolornr( colorin$ ) t = gettaalnr() i = 0 for j = 1 to 4 if colorin$ = word$( color$( t ) , j ) then i = j end if next j getcolornr = i end function
|
|
titus
New Member
Posts: 7
|
Post by titus on Sept 24, 2022 7:34:01 GMT -5
@ rod : thanks for help
changing language does not work creating color does not work
'' titus 23 sept 2022 '' Naturel Language Prosesing proof of consept WindowWidth = DisplayWidth WindowHeight = DisplayHeight global winw , winh winw = WindowWidth winh = WindowHeight dim color$( 3 ) , plek$( 6 , 6 ) , exist( 6 ) color$(1)="red green yellow blue pink cyan" color$(2)="rood groen geel blauw paars cyaan" color$(3)="ruga verda flava blua purpla ciana" plek$( 0 , 0 ) = "red" : exist( 1 ) = 1 plek$( 1 , 0 ) = "green" : exist( 2 ) = 1 plek$( 3 , 0 ) = "blue" : exist( 3 ) = 1 menu #m , "?" , "?" , [help] textbox #m.txt 50 , winh - 100 , 500 , 50 button #m.btn "!" , [go] , UL , 600 , winh - 100 , 50 , 50 global talenS : talen$ = "english nederlands esperanto" global taal$ : taal$ = "english" global create$ : create$ = "create maak faru" global put$ : put$ = "put zet metu" global on$ : on$ = "on op sur" nomainwin open "BLOCK WORLD 1.0" for graphics as #m #m "trapclose [quit]" #m "fill lightgray" #m.txt "!font 30 bold" #m.btn "!font 30 bold" call draw wait
[quit] close #m end [go] SCAN #m.txt "!contents? in$" fl = 0 ''comand not fount jet if word$( in$ , 2 ) = "" and instr( talen$ , in$ ) then taal$ = in$ fl = 1 end if t = gettaalnr() klnr = getcolornr( word$( in$ , 2 ) ) ''notice t ; " "; klnr if t and klnr and word$( in$ , 1 ) = word$( create$ , t ) then if klnr then kl$ = word$( color$( 1 ) , klnr ) x = 0 while not( plek$( x , 0 ) = "" ) x = x + 1 wend plek$( x , 0 ) = kl$ exist( klnr ) = 1 fl = 1 else select case taal$ case "nederlands" notice "FOUT !! : "+CHR$(13) _ +word$( in$ , 2 ) + " is geen bekende kleur !!" case "esperanto" notice "ERARO !! :" + CHR$(13) _ +word$( in$ , 2 ) + " mi ne scias tio coloro !!" case else notice "ERROR !! :" + chr$( 13 ) _ +word$( in$ , 2 ) + " i do not know that color !!" end select end if end if
if fl = 0 then select case taal$ case "nederlands" notice "FOUT !! : ik begrijp dit niet !!" case "esperanto" notice "ERARO !! : mi ne komprenas !!" case else ''default is english notice "ERROR !! : i do not understand !!" end select end if call draw wait sub draw #m "size 3" for x = 0 to 5 xs = x * winw / 7 + 100 for y = 0 to 6 if plek$( x , y ) <> "" then kl$ = plek$( x , y ) else kl$ = "lightgray" end if ys = winh - y * winh / 10 - 250 #m "backcolor " ; kl$ #m "place " ; int( xs ) ; " " ; int( ys ) #m "down" #m "boxfilled " ; int( xs ) + winw / 10 ; " " ; int( ys + winh / 12 ) #m "up" next y next x end sub [help] txt$ = "" select case taal$ case "nederlands" txt$ = "Instrukties : " txt$ = txt$ + "de volgende opdrachten zijn daar :" + chr$( 13 ) txt$ = txt$ + "english : put this code on english mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "maak <kleur> ." + chr$( 13 ) txt$ = txt$ + "zet <kleur> op <kleur> ." + chr$( 13) txt$ = txt$ + "<kleur> = " ; color$( 2 ) case "esperanto" txt$ = "Legu : " txt$ = txt$ + "Oni eblas klavaru :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "faru <koloro> ." + chr$( 13 ) txt$ = txt$ + "metu <koloro> sur <koloro> ." + chr$( 13 ) txt$ = txt$ + "<koloro> = " ; color$( 3 )
case else txt$ = "Instruktions : " txt$ = txt$ + "The flowing comands are there :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "create <color> ." + chr$( 13 ) txt$ = txt$ + "put <color> on <color> ." + chr$( 13 ) txt$ = txt$ + "<color> = " ; color$( 1 ) end select notice txt$ wait function gettaalnr() select case taal$ case "nederlands" i = 2 case "esperanto" i = 3 case "english" i = 1 case else i = 0 end select gettaalnr = i end function function getcolornr( colorin$ ) t = gettaalnr() i = 0 for j = 1 to 4 if colorin$ = word$( color$( t ) , j ) then i = j end if next j getcolornr = i end function
where are my button and textbox ?
|
|
|
Post by Rod on Sept 24, 2022 8:35:43 GMT -5
I moved the buttons and textbox to top left, but what is the code supposed to do? I key in nederlands and press ! what should then happen?
WindowWidth = DisplayWidth WindowHeight = DisplayHeight global winw , winh winw = WindowWidth winh = WindowHeight dim color$( 3 ) , plek$( 6 , 6 ) , exist( 6 ) color$(1)="red green yellow blue pink cyan" color$(2)="rood groen geel blauw paars cyaan" color$(3)="ruga verda flava blua purpla ciana" plek$( 0 , 0 ) = "red" : exist( 1 ) = 1 plek$( 1 , 0 ) = "green" : exist( 2 ) = 1 plek$( 3 , 0 ) = "blue" : exist( 3 ) = 1 menu #m , "?" , "?" , [help] textbox #m.txt 100 , 20 , 500 , 50 button #m.btn "!" , [go] , UL , 700 , 20 , 50 , 50 global talenS : talen$ = "english nederlands esperanto" global taal$ : taal$ = "english" global create$ : create$ = "create maak faru" global put$ : put$ = "put zet metu" global on$ : on$ = "on op sur" nomainwin open "BLOCK WORLD 1.0" for graphics as #m #m "trapclose [quit]" #m "fill lightgray" #m.txt "!font 30 bold" #m.btn "!font 30 bold" call draw wait
[quit] close #m end [go] SCAN #m.txt "!contents? in$" fl = 0 ''comand not fount jet if word$( in$ , 2 ) = "" and instr( talen$ , in$ ) then taal$ = in$ fl = 1 end if t = gettaalnr() klnr = getcolornr( word$( in$ , 2 ) ) ''notice t ; " "; klnr if t and klnr and word$( in$ , 1 ) = word$( create$ , t ) then if klnr then kl$ = word$( color$( 1 ) , klnr ) x = 0 while not( plek$( x , 0 ) = "" ) x = x + 1 wend plek$( x , 0 ) = kl$ exist( klnr ) = 1 fl = 1 else select case taal$ case "nederlands" notice "FOUT !! : "+CHR$(13) _ +word$( in$ , 2 ) + " is geen bekende kleur !!" case "esperanto" notice "ERARO !! :" + CHR$(13) _ +word$( in$ , 2 ) + " mi ne scias tio coloro !!" case else notice "ERROR !! :" + chr$( 13 ) _ +word$( in$ , 2 ) + " i do not know that color !!" end select end if end if
if fl = 0 then select case taal$ case "nederlands" notice "FOUT !! : ik begrijp dit niet !!" case "esperanto" notice "ERARO !! : mi ne komprenas !!" case else ''default is english notice "ERROR !! : i do not understand !!" end select end if call draw wait sub draw #m "size 3" for x = 0 to 5 xs = x * winw / 7 + 100 for y = 0 to 6 if plek$( x , y ) <> "" then kl$ = plek$( x , y ) else kl$ = "lightgray" end if ys = winh - y * winh / 10 - 250 #m "backcolor " ; kl$ #m "place " ; int( xs ) ; " " ; int( ys ) #m "down" #m "boxfilled " ; int( xs ) + winw / 10 ; " " ; int( ys + winh / 12 ) #m "up" next y next x end sub [help] txt$ = "" select case taal$ case "nederlands" txt$ = "Instrukties : " txt$ = txt$ + "de volgende opdrachten zijn daar :" + chr$( 13 ) txt$ = txt$ + "english : put this code on english mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "maak <kleur> ." + chr$( 13 ) txt$ = txt$ + "zet <kleur> op <kleur> ." + chr$( 13) txt$ = txt$ + "<kleur> = " ; color$( 2 ) case "esperanto" txt$ = "Legu : " txt$ = txt$ + "Oni eblas klavaru :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "faru <koloro> ." + chr$( 13 ) txt$ = txt$ + "metu <koloro> sur <koloro> ." + chr$( 13 ) txt$ = txt$ + "<koloro> = " ; color$( 3 )
case else txt$ = "Instruktions : " txt$ = txt$ + "The flowing comands are there :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "create <color> ." + chr$( 13 ) txt$ = txt$ + "put <color> on <color> ." + chr$( 13 ) txt$ = txt$ + "<color> = " ; color$( 1 ) end select notice txt$ wait function gettaalnr() select case taal$ case "nederlands" i = 2 case "esperanto" i = 3 case "english" i = 1 case else i = 0 end select gettaalnr = i end function function getcolornr( colorin$ ) t = gettaalnr() i = 0 for j = 1 to 4 if colorin$ = word$( color$( t ) , j ) then i = j end if next j getcolornr = i end function
|
|
titus
New Member
Posts: 7
|
Post by titus on Sept 25, 2022 6:07:36 GMT -5
@ rod : target : you shoot be able to create and move block's q & a : 'nederlands' => the program reacts on comand's in dutch '?' => is then olso in dutch
|
|
honky
Junior Member
Posts: 63
|
Post by honky on Sept 25, 2022 6:36:30 GMT -5
Computer language instructions cannot and must not be translated into any language without having set up a transcription lexicon: Language X--> Language of the computer language.
|
|
|
Post by tsh73 on Sept 25, 2022 9:47:58 GMT -5
(after issuing command "english") I was able to "create" a color say "create red" "create yellow" (but it says it not understands green and blue) But it did not "put" say "put yellow in red" (it says it not understands)
I think I found a code that understands "create"
if t and klnr and word$( in$ , 1 ) = word$( create$ , t ) then Is where a code what understands "put"?
|
|
|
Post by tsh73 on Sept 25, 2022 9:59:39 GMT -5
if t and klnr and word$( in$ , 1 ) = word$( create$ , t ) then is wrong - AND in LB is bitwise
if (t<>0) and (klnr<>0) and (word$( in$ , 1 ) = word$( create$ , t )) then works for "create green"
|
|
honky
Junior Member
Posts: 63
|
Post by honky on Sept 25, 2022 11:30:19 GMT -5
It would be easier to do a conversion file: Any vernacular: Put blue in x, y to xx, yy Converted in: #w.g, "down; color blue;backcolor blue" #w.g, "place "; x;" ";y: #w.g, "boxfilled ";xx;" ";yy
EDIT: Two indexed files The list of vernacular commands in a listbox. On click the program will look for the right instructions in JB/LB. Copy them to a file: "name.bas" All that's left to do is launch. A big job...
|
|
titus
New Member
Posts: 7
|
Post by titus on Oct 30, 2022 6:25:34 GMT -5
update : create is working corectly try : create [ red , green , yellow , blue , pink , cyan ] error : 'nederlands' and 'esperanto' not working good jet !! the default is 'english'
future : put <color> on <color> i m thinking about that
if this is ready then others can put in other languages
'' titus 23 sept 2022 '' Naturel Language Prosesing proof of consept WindowWidth = DisplayWidth WindowHeight = DisplayHeight global winw , winh winw = WindowWidth winh = WindowHeight global klmax : klmax = 6 global tmax : tmax = 3 dim color$( tmax ) , plek$( 6 , 6 ) , exist( klmax ) color$(1)="red green yellow blue pink cyan" color$(2)="rood groen geel blauw paars cyaan" color$(3)="ruga verda flava blua purpla ciana" plek$( 0 , 0 ) = "red" : exist( 1 ) = 1 plek$( 1 , 0 ) = "green" : exist( 2 ) = 1 plek$( 3 , 0 ) = "blue" : exist( 3 ) = 1 menu #m , "?" , "?" , [help] textbox #m.txt 50 , 10 , 800 , 50 button #m.btn "!" , [go] , UL , 900 , 10 , 50 , 50 global talenS : talen$ = "english nederlands esperanto" global taal$ : taal$ = "english" global create$ : create$ = "create maak faru" global put$ : put$ = "put zet metu" global on$ : on$ = "on op sur" nomainwin open "BLOCK WORLD 1.0" for graphics as #m #m "trapclose [quit]" #m "fill lightgray" #m.txt "!font 30 bold" #m.btn "!font 30 bold" call draw wait
[quit] close #m end [go] SCAN #m.txt "!contents? in$" fl = 0 ''comand not fount jet if word$( in$ , 2 ) = "" and instr( talen$ , in$ ) then taal$ = in$ fl = 1 end if t = gettaalnr() klnr = getcolornr( word$( in$ , 2 ) ) ''notice t ; " "; klnr if (t<>0) and (klnr<>0) and (word$( in$ , 1 ) = word$( create$ , t )) then if exist( klnr ) then select case taal$ case "english" txt$ = "ERROR !! :" + CHR$( 13 ) txt$ = txt$ + word$( color$( 1 ) , klnr ) + " is already there !" case "nederlands" txt$ = "FOUT !!" + CHR$( 13 ) txt$ = txt$ + word$( color$( 2 ) , klnr ) + " is er al !" case "esperanto" txt$ = "ERARO !!" + CHR$( 13 ) txt$ = txt$ + word$( color$( 3 ) , klnr ) + " jam eksistas !" case else end select notice txt$ fl = 1 else if klnr then kl$ = word$( color$( 1 ) , klnr ) x = 0 while not( plek$( x , 0 ) = "" ) x = x + 1 wend plek$( x , 0 ) = kl$ exist( klnr ) = 1 fl = 1 else select case taal$ case "nederlands" notice "FOUT !! : "+CHR$(13) _ +word$( in$ , 2 ) + " is geen bekende kleur !!" case "esperanto" notice "ERARO !! :" + CHR$(13) _ +word$( in$ , 2 ) + " mi ne scias tio coloro !!" case else notice "ERROR !! :" + chr$( 13 ) _ +word$( in$ , 2 ) + " i do not know that color !!" end select end if end if end if
if fl = 0 then select case taal$ case "nederlands" notice "FOUT !! : ik begrijp dit niet !!" case "esperanto" notice "ERARO !! : mi ne komprenas !!" case else ''default is english notice "ERROR !! : i do not understand !!" end select end if call draw wait sub draw #m "size 3" for x = 0 to 5 xs = x * winw / 7 + 100 for y = 0 to 6 if plek$( x , y ) <> "" then kl$ = plek$( x , y ) else kl$ = "lightgray" end if ys = winh - y * winh / 10 - 150 #m "backcolor " ; kl$ #m "place " ; int( xs ) ; " " ; int( ys ) #m "down" #m "boxfilled " ; int( xs ) + winw / 10 ; " " ; int( ys + winh / 12 ) #m "up" next y next x end sub [help] txt$ = "" select case taal$ case "nederlands" txt$ = "Instrukties : " txt$ = txt$ + "de volgende opdrachten zijn daar :" + chr$( 13 ) txt$ = txt$ + "english : put this code on english mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "maak <kleur> ." + chr$( 13 ) txt$ = txt$ + "zet <kleur> op <kleur> ." + chr$( 13) txt$ = txt$ + "<kleur> = " ; color$( 2 ) case "esperanto" txt$ = "Legu : " txt$ = txt$ + "Oni eblas klavaru :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "faru <koloro> ." + chr$( 13 ) txt$ = txt$ + "metu <koloro> sur <koloro> ." + chr$( 13 ) txt$ = txt$ + "<koloro> = " ; color$( 3 )
case else txt$ = "Instruktions : " txt$ = txt$ + "The flowing comands are there :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "create <color> ." + chr$( 13 ) txt$ = txt$ + "put <color> on <color> ." + chr$( 13 ) txt$ = txt$ + "<color> = " ; color$( 1 ) end select notice txt$ wait function gettaalnr() select case taal$ case "nederlands" i = 2 case "esperanto" i = 3 case "english" i = 1 case else i = 0 end select gettaalnr = i end function function getcolornr( colorin$ ) t = gettaalnr() i = 0 for j = 1 to klmax if colorin$ = word$( color$( t ) , j ) then i = j end if next j getcolornr = i end function
|
|
|
Post by tsh73 on Oct 30, 2022 13:41:38 GMT -5
I think I fixed it first, I changed code pre-setting colored boxes from
plek$( 0 , 0 ) = "red" : exist( 1 ) = 1 plek$( 1 , 0 ) = "green" : exist( 2 ) = 1 plek$( 3 , 0 ) = "blue" : exist( 3 ) = 1 (it was probably wrong, keeping telling me yellow already exists) to code using function returning color index by name
plek$( 0 , 0 ) = "red" : exist( getcolornr( "red" ) ) = 1 plek$( 1 , 0 ) = "green" : exist( getcolornr( "green" ) ) = 1 plek$( 3 , 0 ) = "blue" : exist( getcolornr( "blue" ) ) = 1
But it had to be called after language is set, or function does not work. (so I put it just before nomainwin)
And I fixed language checking condition from
if word$( in$ , 2 ) = "" and instr( talen$ , in$ ) then to
if word$( in$ , 2 ) = "" and (instr( talen$ , in$ )<>0) then - it was already said last time, "AND" works bitwise so condition failed on "esperanto"
With these changes, I am able to change language at any time and create color in any language set.
(and I made text smaller because "!font 30" just do not fit in textbox on my Windows.)
Have a few more ideas - but that would require changing some stuff, may be later.
'' titus 23 sept 2022 '' Naturel Language Prosesing proof of consept WindowWidth = DisplayWidth WindowHeight = DisplayHeight global winw , winh winw = WindowWidth winh = WindowHeight
global klmax : klmax = 6 global tmax : tmax = 3 dim color$( tmax ) , plek$( 6 , 6 ) , exist( klmax ) color$(1)="red green yellow blue pink cyan" color$(2)="rood groen geel blauw paars cyaan" color$(3)="ruga verda flava blua purpla ciana"
menu #m , "?" , "?" , [help] textbox #m.txt 50 , 10 , 800 , 50 button #m.btn "!" , [go] , UL , 900 , 10 , 50 , 50 global talenS : talen$ = "english nederlands esperanto" global taal$ : taal$ = "english" global create$ : create$ = "create maak faru" global put$ : put$ = "put zet metu" global on$ : on$ = "on op sur"
plek$( 0 , 0 ) = "red" : exist( getcolornr( "red" ) ) = 1 plek$( 1 , 0 ) = "green" : exist( getcolornr( "green" ) ) = 1 plek$( 3 , 0 ) = "blue" : exist( getcolornr( "blue" ) ) = 1
nomainwin open "BLOCK WORLD 1.0" for graphics as #m #m "trapclose [quit]" #m "fill lightgray" #m.txt "!font 20 bold" #m.btn "!font 20 bold" call draw wait
[quit] close #m end
[go] SCAN #m.txt "!contents? in$" fl = 0 ''comand not fount jet if word$( in$ , 2 ) = "" and (instr( talen$ , in$ )<>0) then taal$ = in$ notice taal$ fl = 1 end if t = gettaalnr() klnr = getcolornr( word$( in$ , 2 ) ) ''notice t ; " "; klnr if (t<>0) and (klnr<>0) and (word$( in$ , 1 ) = word$( create$ , t )) then if exist( klnr ) then select case taal$ case "english" txt$ = "ERROR !! :" + CHR$( 13 ) txt$ = txt$ + word$( color$( 1 ) , klnr ) + " is already there !" case "nederlands" txt$ = "FOUT !!" + CHR$( 13 ) txt$ = txt$ + word$( color$( 2 ) , klnr ) + " is er al !" case "esperanto" txt$ = "ERARO !!" + CHR$( 13 ) txt$ = txt$ + word$( color$( 3 ) , klnr ) + " jam eksistas !" case else end select notice txt$ fl = 1 else if klnr then kl$ = word$( color$( 1 ) , klnr ) x = 0 while not( plek$( x , 0 ) = "" ) x = x + 1 wend plek$( x , 0 ) = kl$ exist( klnr ) = 1 fl = 1 else select case taal$ case "nederlands" notice "FOUT !! : "+CHR$(13) _ +word$( in$ , 2 ) + " is geen bekende kleur !!" case "esperanto" notice "ERARO !! :" + CHR$(13) _ +word$( in$ , 2 ) + " mi ne scias tio coloro !!" case else notice "ERROR !! :" + chr$( 13 ) _ +word$( in$ , 2 ) + " i do not know that color !!" end select end if end if end if
if fl = 0 then select case taal$ case "nederlands" notice "FOUT !! : ik begrijp dit niet !!" case "esperanto" notice "ERARO !! : mi ne komprenas !!" case else ''default is english notice "ERROR !! : i do not understand !!" end select end if call draw wait sub draw #m "size 3" for x = 0 to 5 xs = x * winw / 7 + 100 for y = 0 to 6 if plek$( x , y ) <> "" then kl$ = plek$( x , y ) else kl$ = "lightgray" end if ys = winh - y * winh / 10 - 150 #m "backcolor " ; kl$ #m "place " ; int( xs ) ; " " ; int( ys ) #m "down" #m "boxfilled " ; int( xs ) + winw / 10 ; " " ; int( ys + winh / 12 ) #m "up" next y next x end sub [help] txt$ = "" select case taal$ case "nederlands" txt$ = "Instrukties : " txt$ = txt$ + "de volgende opdrachten zijn daar :" + chr$( 13 ) txt$ = txt$ + "english : put this code on english mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "maak <kleur> ." + chr$( 13 ) txt$ = txt$ + "zet <kleur> op <kleur> ." + chr$( 13) txt$ = txt$ + "<kleur> = " ; color$( 2 ) case "esperanto" txt$ = "Legu : " txt$ = txt$ + "Oni eblas klavaru :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "faru <koloro> ." + chr$( 13 ) txt$ = txt$ + "metu <koloro> sur <koloro> ." + chr$( 13 ) txt$ = txt$ + "<koloro> = " ; color$( 3 )
case else txt$ = "Instruktions : " txt$ = txt$ + "The flowing comands are there :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "create <color> ." + chr$( 13 ) txt$ = txt$ + "put <color> on <color> ." + chr$( 13 ) txt$ = txt$ + "<color> = " ; color$( 1 ) end select notice txt$ wait function gettaalnr() select case taal$ case "nederlands" i = 2 case "esperanto" i = 3 case "english" i = 1 case else i = 0 end select gettaalnr = i end function function getcolornr( colorin$ ) t = gettaalnr() i = 0 for j = 1 to klmax if colorin$ = word$( color$( t ) , j ) then i = j end if next j getcolornr = i end function
|
|
|
Post by tsh73 on Oct 30, 2022 14:05:04 GMT -5
Just draw some text on screen. Showing selected language. Making check "i do not know that color " work required not changing but removing one condition - from
if (t<>0) and (klnr<>0) and (word$( in$ , 1 ) = word$( create$ , t )) then to
if (t<>0) and (word$( in$ , 1 ) = word$( create$ , t )) then So now it rightfully barks on unknown colors.
'' titus 23 sept 2022 '' Naturel Language Prosesing proof of consept WindowWidth = DisplayWidth WindowHeight = DisplayHeight global winw , winh winw = WindowWidth winh = WindowHeight
global klmax : klmax = 6 global tmax : tmax = 3 dim color$( tmax ) , plek$( 6 , 6 ) , exist( klmax ) color$(1)="red green yellow blue pink cyan" color$(2)="rood groen geel blauw paars cyaan" color$(3)="ruga verda flava blua purpla ciana"
menu #m , "?" , "?" , [help] textbox #m.txt 50 , 10 , 800 , 50 button #m.btn "!" , [go] , UL , 900 , 10 , 50 , 50 global talenS : talen$ = "english nederlands esperanto" global taal$ : taal$ = "english" global create$ : create$ = "create maak faru" global put$ : put$ = "put zet metu" global on$ : on$ = "on op sur"
plek$( 0 , 0 ) = "red" : exist( getcolornr( "red" ) ) = 1 plek$( 1 , 0 ) = "green" : exist( getcolornr( "green" ) ) = 1 plek$( 3 , 0 ) = "blue" : exist( getcolornr( "blue" ) ) = 1
nomainwin open "BLOCK WORLD 1.0" for graphics as #m #m "trapclose [quit]" #m "fill lightgray" #m.txt "!font 20 bold" #m.btn "!font 20 bold" #m "font 20 bold" call draw wait
[quit] close #m end
[go] SCAN #m.txt "!contents? in$" fl = 0 ''comand not fount jet if word$( in$ , 2 ) = "" and (instr( talen$ , in$ )<>0) then taal$ = in$ 'notice taal$ fl = 1 end if t = gettaalnr() klnr = getcolornr( word$( in$ , 2 ) ) ''notice t ; " "; klnr 'if (t<>0) and (klnr<>0) and (word$( in$ , 1 ) = word$( create$ , t )) then 'do not require color exists - it is checked later if (t<>0) and (word$( in$ , 1 ) = word$( create$ , t )) then if exist( klnr ) then select case taal$ case "english" txt$ = "ERROR !! :" + CHR$( 13 ) txt$ = txt$ + word$( color$( 1 ) , klnr ) + " is already there !" case "nederlands" txt$ = "FOUT !!" + CHR$( 13 ) txt$ = txt$ + word$( color$( 2 ) , klnr ) + " is er al !" case "esperanto" txt$ = "ERARO !!" + CHR$( 13 ) txt$ = txt$ + word$( color$( 3 ) , klnr ) + " jam eksistas !" case else end select notice txt$ fl = 1 else if klnr then kl$ = word$( color$( 1 ) , klnr ) x = 0 while not( plek$( x , 0 ) = "" ) x = x + 1 wend plek$( x , 0 ) = kl$ exist( klnr ) = 1 fl = 1 else select case taal$ case "nederlands" notice "FOUT !! : "+CHR$(13) _ +word$( in$ , 2 ) + " is geen bekende kleur !!" case "esperanto" notice "ERARO !! :" + CHR$(13) _ +word$( in$ , 2 ) + " mi ne scias tio coloro !!" case else notice "ERROR !! :" + chr$( 13 ) _ +word$( in$ , 2 ) + " i do not know that color !!" end select fl = 1 'we already reported that, so set fl = 1 end if end if end if
if fl = 0 then select case taal$ case "nederlands" notice "FOUT !! : ik begrijp dit niet !!" case "esperanto" notice "ERARO !! : mi ne komprenas !!" case else ''default is english notice "ERROR !! : i do not understand !!" end select end if call draw wait sub draw #m "size 3" for x = 0 to 5 xs = x * winw / 7 + 100 for y = 0 to 6 if plek$( x , y ) <> "" then kl$ = plek$( x , y ) else kl$ = "lightgray" end if ys = winh - y * winh / 10 - 150 #m "backcolor " ; kl$ #m "place " ; int( xs ) ; " " ; int( ys ) #m "down" #m "boxfilled " ; int( xs ) + winw / 10 ; " " ; int( ys + winh / 12 ) #m "up" next y next x #m "color black" #m "place 10 0" #m "\\^\|\";"help menu is up there"
#m "place 970 50" #m "\";"<-- enter a command then press that button" #m "place 50 150" #m "\";"Language: ";space$(50) #m "place 50 150" #m "\";"Language: ";taal$
#m "flush" end sub
[help] txt$ = "" select case taal$ case "nederlands" txt$ = "Instrukties : " txt$ = txt$ + "de volgende opdrachten zijn daar :" + chr$( 13 ) txt$ = txt$ + "english : put this code on english mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "maak <kleur> ." + chr$( 13 ) txt$ = txt$ + "zet <kleur> op <kleur> ." + chr$( 13) txt$ = txt$ + "<kleur> = " ; color$( 2 ) case "esperanto" txt$ = "Legu : " txt$ = txt$ + "Oni eblas klavaru :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "faru <koloro> ." + chr$( 13 ) txt$ = txt$ + "metu <koloro> sur <koloro> ." + chr$( 13 ) txt$ = txt$ + "<koloro> = " ; color$( 3 )
case else txt$ = "Instruktions : " txt$ = txt$ + "The flowing comands are there :" + chr$( 13 ) txt$ = txt$ + "english : put this code on eglish mode ." + chr$( 13 ) txt$ = txt$ + "nederlands : zet deze code op nederlands ." + chr$( 13 ) txt$ = txt$ + "esperanto : metu tio codo sur esperanto ." + chr$( 13 ) txt$ = txt$ + "create <color> ." + chr$( 13 ) txt$ = txt$ + "put <color> on <color> ." + chr$( 13 ) txt$ = txt$ + "<color> = " ; color$( 1 ) end select notice txt$ wait function gettaalnr() select case taal$ case "nederlands" i = 2 case "esperanto" i = 3 case "english" i = 1 case else i = 0 end select gettaalnr = i end function function getcolornr( colorin$ ) t = gettaalnr() i = 0 for j = 1 to klmax if colorin$ = word$( color$( t ) , j ) then i = j end if next j getcolornr = i end function
|
|