Author Topic: Comming up features  (Read 6446 times)

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2796
    • View Profile
Re: Comming up features
« Reply #15 on: 2020-Nov-23 »
Phew, quick try of my own game source produced the following error...

Code: (glbasic) [Select]
FOREACH w IN self.w[]
IF name$=w.text$[WB_NAME_STRING] THEN RETURN i%
INC i%
NEXT

"gui.gbas"(1685) error : GPC0007 wrong argument type on line...
Code: (glbasic) [Select]
FOREACH w IN self.w[]
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Comming up features
« Reply #16 on: 2020-Nov-24 »
Code: (glbasic) [Select]
TYPE TX
    text$[]
ENDTYPE

TYPE TT
    w[] AS TX

    FUNCTION foo:
FOREACH w IN self.w[]
IF "x"=w.text$[0] THEN RETURN
NEXT
    ENDFUNCTION

ENDTYPE
This works for me, so can you make a short complete example that does not work?

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2796
    • View Profile
Re: Comming up features
« Reply #17 on: 2020-Nov-25 »
Code: (glbasic) [Select]
TYPE TX
    text$[]
ENDTYPE

TYPE TT
    w[] AS TX

    FUNCTION foo:
FOREACH w IN self.w[]
IF "x"=w.text$[0] THEN RETURN
NEXT
    ENDFUNCTION

ENDTYPE
This works for me, so can you make a short complete example that does not work?

I added... "LOCAL i%, w AS TX" to be more like my original source, it now reproduces the error standalone.

Code: (glbasic) [Select]
TYPE TX
    text$[]
ENDTYPE

TYPE TT
    w[] AS TX

    FUNCTION foo:
    LOCAL i%, w AS TX
FOREACH w IN self.w[]
IF "x"=w.text$[0] THEN RETURN
NEXT
    ENDFUNCTION

ENDTYPE


Also, I just pasted this to the end of the file for reference ...

Code: (glbasic) [Select]
FUNCTION GetWidgetID%: name$
IF name$="" THEN RETURN -1
LOCAL i%, w AS TWidget
FOREACH w IN self.w[]
IF name$=w.text$[WB_NAME_STRING] THEN RETURN i%
INC i%
NEXT
RETURN -1
ENDFUNCTION

Highlighted the code and pressed CTRL+K to block remark it and the IDE crashed and exited to desktop. I Think it has something to do with the  final line not having a carriage return. I redid it again but made sure I pressed enter after the last line, then it didn't crash when I remarked it.
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Comming up features
« Reply #18 on: 2020-Nov-26 »
Good find on the IDE. The compiler issue is harder. Can you redesign this piece of code, please  =D

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2796
    • View Profile
Re: Comming up features
« Reply #19 on: 2020-Nov-28 »
Good find on the IDE. The compiler issue is harder. Can you redesign this piece of code, please  =D

I could.. but sometimes I reuse a variable within a block of code, so its not always viable to simply remove the declaration. eg. You will notice I've used the variable "m" twice here, on both occasions its a single type that represents a single material, so logically it makes sense. I could code around it with different variable names but isn't this coding around backwards compatibility?

Actually looking at my game code, I do this quite a lot unfortunately.  :'(

Gernot my opinion is this, this is just a "quality of life" improvement, my opinion is not to spend too much time on it if its causing you grief. By this stage I think every one had gotten used to self. anyways!  :good:

Code: (glbasic) [Select]
FUNCTION ReadFile: filename$
LOCAL f%,l$
LOCAL n%,t$[]
LOCAL i%
LOCAL m AS TMaterial
self.Destroy()
self.SetUp()
f%=GENFILE()
OPENFILE(f%, filename$, TRUE)
//DEBUG "Start read TMaterials.ReadFile("+filename$+") file >\n"
REPEAT
READLINE f%, l$
n%=SPLITSTR(l$,t$[]," ")
IF LEN(t$[])=0 THEN CONTINUE
SELECT t$[0]
CASE "newmtl"
DIMPUSH self.m[], m
self.m[-1].name$=t$[1]
CASE "Kd"
self.m[-1].red# = t$[1]; self.m[-1].green# = t$[2]; self.m[-1].blue# = t$[3]
CASE "Tr"
self.m[-1].alpha# = t$[1]
CASE "Ns"
self.m[-1].size# = t$[1]
CASE "#"
DEFAULT
ENDSELECT
UNTIL ENDOFFILE(f%)
FOREACH m IN self.m[]
m.combined% = ASL((m.alpha#)*255,24)+ASL(m.blue#*255,16)+ASL(m.green#*255,8) + m.red#*255
NEXT
//DEBUG "< End read material file\n"
CLOSEFILE f%
ENDFUNCTION
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2796
    • View Profile
Re: Comming up features
« Reply #20 on: 2020-Nov-29 »
I changed the offending code in this routine...
Code: (glbasic) [Select]
FOREACH m IN self.m[]
m.combined% = ASL((m.alpha#)*255,24)+ASL(m.blue#*255,16)+ASL(m.green#*255,8) + m.red#*255
NEXT
to...
Code: (glbasic) [Select]
FOREACH mat IN self.m[]
mat.combined% = ASL((mat.alpha#)*255,24)+ASL(mat.blue#*255,16)+ASL(mat.green#*255,8) + mat.red#*255
NEXT

...but still got eh error "error : GPC0007 wrong argument type" at the FOREACH line, even though I changed "m" to "mat", only within these lines?!?!
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Comming up features
« Reply #21 on: 2020-Dec-01 »
OK, I'll quite the possibility to drop the "self.". I'm sorry.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2796
    • View Profile
Re: Comming up features
« Reply #22 on: 2020-Dec-02 »
No worries Gernot, thanks for giving it a go.  :booze:
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4453
    • View Profile
    • FUED
Re: Comming up features
« Reply #23 on: 2020-Dec-02 »
Yep, thanks for the efforts! Anything you feel could help will always be appreciated.

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5117
  • O Rly?
    • View Profile
Re: Comming up features
« Reply #24 on: 2020-Dec-03 »
The biggest thing for me would be GLOBALS will show up on any gbas-File in the autocompletion.
Thats a "bug" thats drivin me crazy for years now.
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline dreamerman

  • Global Moderator
  • Dr. Type
  • *******
  • Posts: 455
    • View Profile
    • my personal website
Re: Comming up features
« Reply #25 on: 2021-Mar-09 »
New improvements in IDE and language features are welcome, also nice to see some fixes for few bugs, yet from what I've checked that bug with loading images from ShoeBox wasn't fixed :/ I hope that this also will come in proper update ;-) I mentioned that bug here
Check my source code editor for GLBasic - link Update: 20.04.2020

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Comming up features
« Reply #26 on: 2021-Mar-13 »
Get the beta branch. The Shoebox bug is fixed. You need to recreate the SBX files, though.

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 389
  • to program what I have do how should programming?
    • View Profile
Re: Comming up features
« Reply #27 on: 2021-Mar-13 »
how do you access the debug branch?

Offline dreamerman

  • Global Moderator
  • Dr. Type
  • *******
  • Posts: 455
    • View Profile
    • my personal website
Re: Comming up features
« Reply #28 on: 2021-Mar-14 »
Thanks for looking into it but there is still some issue, check my post in that bug topic.
In Logfile update list I saw that HTML5 platform was added, was it updated to latest emscripten or need some old version is still needed or something? As it was already in this topis there were serious issues with previously available version.

Qedo: find GLBasic on Your Steam Library list, right click - Properties - Betas and there select beta builds :-) from what I see standard version also was updated.
Check my source code editor for GLBasic - link Update: 20.04.2020

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 389
  • to program what I have do how should programming?
    • View Profile
Re: Comming up features
« Reply #29 on: 2021-Mar-14 »
thanks dreamerman you are always kind and helpful  :booze:
Ad maiora