Page 1 of 1

GAA! structures...

Posted: Sun Dec 28, 2003 8:12 pm
by Dreglor
it seams every time i use sturctures i get some weird error that either doesn't make sinces or does apply to that part of the code :|

so i been working on a 3d engine (have been for some time now) and i rewriting it so i can use everything i learned so far in it, live stuctures.

this code creates the structure and there not problems in here it after this is has problems...

Code: Select all

Procedure init(h,w,d,title.s,rr,fr)
  #HW_limit=1000
  Global object_count
  
  Structure 3d_Object
    object_x.l
    object_y.l
    object_z.l
    face_count.l
    face_vertex_p0.w[#HW_limit]
    face_vertex_p1.w[#HW_limit]
    face_vertex_p2.w[#HW_limit]
    vertex_count.l
    vertex_posion_x.l[#HW_limit]
    vertex_posion_y.l[#HW_limit]
    vertex_posion_z.l[#HW_limit]
    draw.b
  EndStructure
  
  Dim 3d_data.3d_Object(#HW_limit)
  
  InitSprite()
  InitSound()
  InitMouse()
  InitKeyboard()
  OpenScreen(w,h,d,title)
  SetRefreshRate(rr)
  SetFrameRate(fr)
EndProcedure
now after this procedure if it encouters "3d_data(some_number)\any_sturcture" it won't complie because it "Not a valid Decimal number" and i trying to figure wtf does that mean and why does it do it i spent 4 hours trying to figure out were it getting that error from...so please could you point out what setting it off...

Posted: Sun Dec 28, 2003 8:38 pm
by Karbon
Can you post actual code that produces the error? I don't understand what you mean by what you said in your post..

Posted: Sun Dec 28, 2003 9:09 pm
by Dreglor
this should give a complire error

Code: Select all

Procedure Drake_init(h,w,d,title.s,rr,fr)
  #Drake_HW_limit=1000
  Global object_count
  
  Structure 3d_Object
    object_x.l
    object_y.l
    object_z.l
    face_count.l
    face_vertex_p0.w[#Drake_HW_limit]
    face_vertex_p1.w[#Drake_HW_limit]
    face_vertex_p2.w[#Drake_HW_limit]
    vertex_count.l
    vertex_posion_x.l[#Drake_HW_limit]
    vertex_posion_y.l[#Drake_HW_limit]
    vertex_posion_z.l[#Drake_HW_limit]
    draw.b
  EndStructure
  
  Dim 3d_data.3d_Object(#Drake_HW_limit)
  
  InitSprite()
  InitSound()
  InitMouse()
  InitKeyboard()
  OpenScreen(w,h,d,title)
  SetRefreshRate(rr)
  SetFrameRate(fr)
EndProcedure

Drake_init(800,600,32,"",60,30)
3d_data(0)\object_x=0
3d_data(0)\object_y=0
3d_data(0)\object_z=10
just enter that in as it is and try to complie it it gives me a error like i stated above and no matter what to change in the that line it doesn't fix...

Posted: Sun Dec 28, 2003 9:18 pm
by freak
It is, because your Array name starts with a number: 3d_data
You can't have a name of whatever start with a number in PB.

But it is the wrong error message. This should be corrected.

Timo

Posted: Sun Dec 28, 2003 9:25 pm
by Danilo
freak wrote:But it is the wrong error message. This should be corrected.
Fred already knows about this, its the same when procedures
begin with a number in the name.

@Dreglor:
The arguments w and h in you procedure were reversed,
it cant open a screen 600x800 here.

Code: Select all

Procedure Drake_init(w,h,d,title.s,rr,fr) 
  #Drake_HW_limit=1000 
  Global object_count 
  
  Structure 3d_Object 
    object_x.l 
    object_y.l 
    object_z.l 
    face_count.l 
    face_vertex_p0.w[#Drake_HW_limit] 
    face_vertex_p1.w[#Drake_HW_limit] 
    face_vertex_p2.w[#Drake_HW_limit] 
    vertex_count.l 
    vertex_posion_x.l[#Drake_HW_limit] 
    vertex_posion_y.l[#Drake_HW_limit] 
    vertex_posion_z.l[#Drake_HW_limit] 
    draw.b 
  EndStructure 
  
  Dim Data_3D.3d_Object(#Drake_HW_limit) 
  
  If InitSprite() And InitSound() And InitMouse() And InitKeyboard()
    SetRefreshRate(rr) 
    If OpenScreen(w,h,d,title) 
      SetFrameRate(fr)
      result = #TRUE
    EndIf
  EndIf
  ProcedureReturn result
EndProcedure

If Drake_init(800,600,32,"",60,30) 
  Data_3D(0)\object_x=0
  Data_3D(0)\object_y=0 
  Data_3D(0)\object_z=10
Else
  MessageRequester("ERROR","Cant open screen!",#MB_ICONERROR)
EndIf

Posted: Sun Dec 28, 2003 11:37 pm
by Dreglor
cool thanks :)

edit i figured it out i had it before it was delcared...