Recent posts

#21
OxygenBasic Examples / Re: OpenGl Grid Inputs
Last post by Frank Brübach - April 06, 2024, 09:16:39 PM
Hi Charles First of all thx for correction :)

I'm actually doing it in a similar way, only this time I'm building Code example from the back to the front and at the end the Input Control didnt Work .. Often I divide Code example in three four parts with my checking Control Set If Print 1 OK and so on...

I know that AI's are producing Error Messages and they are doing mistakes but otherside I See Always chances to improve Code examples..

But in this Case I am more disappointed of improvements the AI announced ;)

Regards nice Weekend , frank
#22
Deep corruption in science academia. Institutions pursuing grants.

Sabine Hossenfelder
5 apr 2024


#23
OxygenBasic Examples / Re: OpenGl Grid Inputs
Last post by Charles Pegge - April 06, 2024, 12:39:42 PM
Hi Frank,
I've restored the core section. The best way is to introduce your changes step by step, testing each time:

Uses consoleG
'
function isnumeric(string a) as int 'is_numeric2
   select asc(a)
   case 0x30 to 0x39 : return 1 '0 to 9
   case 45           : return 1 '-
   end select
end function


function irnd(int z1, z2) as int
================================
mov    eax,z2
sub    eax,z1
inc    eax
imul  edx,Seed,0x8088405
inc    edx
mov    Seed,edx 'store new seed
mul    edx 'multiply eax by edx
return edx+z1
end Function

redim string dat[3,3] static 'dat[5,5] static
redim int ytot[3,1] static '[5,1]
redim int xtot[3] static

procedure main()
================

sys a,i,p
static string ins
static string s
if opening
  'INTIAL EXAMPLE DATA
  int x,y
  for y=lbound(dat,1) to ubound(dat,1)
    for x=lbound(dat,2) to ubound(dat,2)
      dat[y,x]=str irnd(1,9) 'Changed range to 1-9 for better visibility
    next
  next
  '
endif
'
if closing
  del ytot
  del dat
  del xtot
  'mbox "closed"
  exit procedure
endif
cls .10,.10,.20
'
'GRID INPUTS
------------
scale 1.5
int x,y
pushstate
move 4,-0.25
scale 1.5
print "Calculations"
popstate
move 0,-2
'
for x=lbound(dat,2) to ubound(dat,2)
  PushState
  move x*4
  print "Col " chr(x+64)
  PopState
next
PushState
move x*4
print "Total"
PopState
'
for y=lbound(dat,1) to ubound(dat,1)
  PushState
  move 1, -y*2
  print "Row" str(y)
  PopState
next
PushState
move 1, -y*2
print "Total"
PopState
'
int v,v2
int gtot=1
for x=lbound(dat,2) to ubound(dat,2)
  ytot[x]=1
next
'
'------------------------------------------- //
int selectedX=-1, selectedY=-1
for y=lbound(dat,1) to ubound(dat,1)
  xtot[y]=1
  for x=lbound(dat,2) to ubound(dat,2)
    ' multiply go ------------
    v=val(dat[y,x])
    xtot[y]*=v
    ytot[x]*=v

============================
============================
      PushState
      move x*4,-y*2
      if pick
        'MARK PICKING AREA
        picklabel y*10+x
        move 0,0,-.01
        PutBoxArea 3,1
      else 'not pick
        if picked=y*10+x
          'DATA EDITING
          color 0.9,.9,0.9
          a=input dat[y,x]
          lastkey=0
          lastchar=0
        else 'not picked
          'DATA DISPLAY
          move 0,0,-.01
          color .2,.6,.3
          PutBoxArea 3,1
          move 0.2,0.2,.01
          color .8,.8,.6
          print dat[y,x]
        endif
      endif
      PopState
============================
============================

/*
    ' multiply go ------------
    PushState
    move x*4,-y*2
    if pick or (selectedX=x and selectedY=y)
      'MARK PICKING AREA
      picklabel y*10+x
      move 0,0,-.01
      PutBoxArea 3,1
      if lastkey=13 'Enter key
        selectedX=x
        selectedY=y
      endif

    else 'not pick
      if selectedX=x and selectedY=y
        'DATA EDITING
        color 0.9,.9,0.9

'------------------------------ input doesnt work here ---- //
        a=input dat[y,x]
        print "a: "+a ' first cell top left
        if not isnumeric(a)
          color 1,0,0 'Red color for invalid input
          print "Invalid input"
        else
          dat[y,x]=a
        endif
        lastkey=0
        lastchar=0
      else 'not selected
'------------------------------ input doesnt work here ---- //
    ' color added
    'DATA DISPLAY
        move 0,0,-.01
        'Color coding based on value
        if v<3
          color .2,.6,.3 'Green for low values
        elseif v<7
          color .6,.6,.2 'Yellow for medium values
        else
          color .6,.2,.2 'Red for high values
        endif
'------------------------------------- //
        PutBoxArea 3,1
        move 0.2,0.2,.01
        color .8,.8,.6
        print dat[y,x]
        'print "#.##", val(dat[y,x])
      endif
    endif
    PopState
*/
  next 'x
  '----------------------- // multiply
  gtot*=xtot[y]
  '----------------------- // multiply
  PushState
  move x*4,-y*2
  color .9,.9,.6
  print "xtot " + xtot[y]
  'print "#.##" + xtot[y]
  PopState
next 'y
'--------------------------------------- //
'COL TOTALS
for x=lbound(dat,2) to ubound(dat,2)
  PushState
  move x*4,-y*2
  color .9,.9,.6
  print ytot[x]
  PopState
next 'col totals

PushState
move x*4,-y*2
color .9,.9,.6
print gtot
PopState

scale 1/1.5
'printl str(picked)
'
end procedure
EndScript
#24
General Discussion / What Were Humans doing 10,000 ...
Last post by Charles Pegge - April 06, 2024, 12:32:41 PM
What Were Humans Doing 10,000 Years Ago?

NORTH 02
30 mar 2024



What Were Humans doing 100,000 Years Ago?

NORTH 02
17 june 2023



What were Humans doing 1,000,000 years ago?

NORTH 02
22 oct 2022

#25
OxygenBasic Examples / Re: OpenGl Grid Inputs
Last post by Frank Brübach - April 05, 2024, 10:16:07 PM
Hi Charles again , I have adapted the Code perhaps you can Check this Second expl with colored Background and new Changes of Theo/AI.. the Input entry values doesn't Work anymore Rest of Code is OK seems to me

Uses consoleG
'
function isnumeric(string a) as int 'is_numeric2
   select asc(a)
   case 0x30 to 0x39 : return 1 '0 to 9
   case 45           : return 1 '-
   end select
end function


function irnd(int z1, z2) as int
================================
mov    eax,z2
sub    eax,z1
inc    eax
imul  edx,Seed,0x8088405
inc    edx
mov    Seed,edx 'store new seed
mul    edx 'multiply eax by edx
return edx+z1
end Function

redim string dat[3,3] static 'dat[5,5] static
redim int ytot[3,1] static '[5,1]
redim int xtot[3] static

procedure main()
================

sys a,i,p
static string ins
static string s
if opening
  'INTIAL EXAMPLE DATA
  int x,y
  for y=lbound(dat,1) to ubound(dat,1)
    for x=lbound(dat,2) to ubound(dat,2)
      dat[y,x]=str irnd(1,9) 'Changed range to 1-9 for better visibility
    next
  next
  '
endif
'
if closing
  del ytot
  del dat
  del xtot
  'mbox "closed"
  exit procedure
endif
cls .10,.10,.20
'
'GRID INPUTS
------------
scale 1.5
int x,y
pushstate
move 4,-0.25
scale 1.5
print "Calculations"
popstate
move 0,-2
'
for x=lbound(dat,2) to ubound(dat,2)
  PushState
  move x*4
  print "Col " chr(x+64)
  PopState
next
PushState
move x*4
print "Total"
PopState
'
for y=lbound(dat,1) to ubound(dat,1)
  PushState
  move 1, -y*2
  print "Row" str(y)
  PopState
next
PushState
move 1, -y*2
print "Total"
PopState
'
int v,v2
int gtot=1
for x=lbound(dat,2) to ubound(dat,2)
  ytot[x]=1
next
'
'------------------------------------------- //
int selectedX=-1, selectedY=-1
for y=lbound(dat,1) to ubound(dat,1)
  xtot[y]=1
  for x=lbound(dat,2) to ubound(dat,2)
    ' multiply go ------------
    v=val(dat[y,x])
    xtot[y]*=v
    ytot[x]*=v
    ' multiply go ------------
    PushState
    move x*4,-y*2
    if pick or (selectedX=x and selectedY=y)
      'MARK PICKING AREA
      picklabel y*10+x
      move 0,0,-.01
      PutBoxArea 3,1
      if lastkey=13 'Enter key
        selectedX=x
        selectedY=y
      endif

    else 'not pick
      if selectedX=x and selectedY=y
        'DATA EDITING
        color 0.9,.9,0.9

'------------------------------ input doesnt work here ---- //
        a=input dat[y,x]
        print "a: "+a ' first cell top left
        if not isnumeric(a)
          color 1,0,0 'Red color for invalid input
          print "Invalid input"
        else
          dat[y,x]=a
        endif
        lastkey=0
        lastchar=0
      else 'not selected
'------------------------------ input doesnt work here ---- //
    ' color added
    'DATA DISPLAY
        move 0,0,-.01
        'Color coding based on value
        if v<3
          color .2,.6,.3 'Green for low values
        elseif v<7
          color .6,.6,.2 'Yellow for medium values
        else
          color .6,.2,.2 'Red for high values
        endif
'------------------------------------- //
        PutBoxArea 3,1
        move 0.2,0.2,.01
        color .8,.8,.6
        print dat[y,x]
        'print "#.##", val(dat[y,x])
      endif
    endif
    PopState
  next 'x
  '----------------------- // multiply
  gtot*=xtot[y]
  '----------------------- // multiply
  PushState
  move x*4,-y*2
  color .9,.9,.6
  print "xtot " + xtot[y]
  'print "#.##" + xtot[y]
  PopState
next 'y
'--------------------------------------- //
'COL TOTALS
for x=lbound(dat,2) to ubound(dat,2)
  PushState
  move x*4,-y*2
  color .9,.9,.6
  print ytot[x]
  PopState
next 'col totals

PushState
move x*4,-y*2
color .9,.9,.6
print gtot
PopState

scale 1/1.5
'printl str(picked)
'
end procedure
EndScript
#27
OxygenBasic Examples / Re: OpenGl Grid Inputs
Last post by Charles Pegge - April 05, 2024, 08:51:50 AM
Just checking the first character of the string:

uses console

' how to check if is_numeric is a value or string ?
'
function is_numeric2(string a) as int
   select asc(a)
   case 0x30 to 0x39 : return 1 '0 to 9
   case 45           : return 1 '-
   end select
end function

print " is numeric2 abc? " + is_numeric2("abc") cr
print " is numeric2 100? " + is_numeric2("100") cr

wait
#28
OxygenBasic Examples / Re: OpenGl Grid Inputs
Last post by Frank Brübach - April 05, 2024, 08:16:07 AM
Morning Charles, how I can use this isnumeric function in a correct way cause I am Not Sure how to handle

uses console

' how to check if is_numeric is a value or string ?
'
function is_numeric2(int a) as string
   if a<=1 then
   return 1 ' true
   else
     return is_numeric2(a-1) ' false ?
   end if
end function

print " is numeric2 " + is_numeric2("abc")
print " is numeric2 " + is_numeric2(100)

wait

I want to Fix Second OpenGL expl from Theo / AI

Regards Frank
#30
OxygenBasic / Re: Create a PDF directly
Last post by Zlatko Vid - April 04, 2024, 09:44:58 PM
there is old PDF program written in XBlite compiler which use goAsembler
i think that i tried it long time ago
and seems that overall result is very poor..
so i don't know what this autoIT3 program do and what GDI+
have with all this ..
PDF is what Portable Document Format
it is something like compressed RTF ...
what is UDF ..i don't know  ::)