GAA! structures...

Everything else that doesn't fall into one of the other PB categories.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

GAA! structures...

Post 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...
~Dreglor
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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..
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post 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...
~Dreglor
freak
PureBasic Team
PureBasic Team
Posts: 5947
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Post 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
cya,
...Danilo
...:-=< http://codedan.net/work >=-:...
-= FaceBook.com/DaniloKrahn =-
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

cool thanks :)

edit i figured it out i had it before it was delcared...
~Dreglor
Post Reply