Strukturen-gelöst!

Anfängerfragen zum Programmieren mit PureBasic.
Benutzeravatar
darius676
Beiträge: 512
Registriert: 08.03.2010 22:12
Computerausstattung: Intel i5 16GB RAM nVidia 1050, Win11
Atari Jaguar, Surface Pro 5,Surface Laptop i5 7200, XBOX ONE X, XBOX Series X
Wohnort: AT
Kontaktdaten:

Strukturen-gelöst!

Beitrag von darius676 »

guten Tag. Hab das Forum durchsucht finde jedoch keinen Beitrag....

gibt es in PB eine Begrenzung für die Anzahl von Elementen einer Struktur?

Structure xxxx
e1
e2
e3
e4
e5
.
.
.
.
Endstructure

?
Zuletzt geändert von darius676 am 15.04.2012 21:57, insgesamt 1-mal geändert.
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Re: Strukturen

Beitrag von ts-soft »

Jede größe, wofür eine Strukture sinnvoll einsetzbar ist, ist möglich ...

Das Du dazu keinen Beitrag findest, liegt wohl an der Sinnlosigkeit :mrgreen:
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Benutzeravatar
darius676
Beiträge: 512
Registriert: 08.03.2010 22:12
Computerausstattung: Intel i5 16GB RAM nVidia 1050, Win11
Atari Jaguar, Surface Pro 5,Surface Laptop i5 7200, XBOX ONE X, XBOX Series X
Wohnort: AT
Kontaktdaten:

Re: Strukturen

Beitrag von darius676 »

ts-soft hat geschrieben:Jede größe, wofür eine Strukture sinnvoll einsetzbar ist, ist möglich ...

Das Du dazu keinen Beitrag findest, liegt wohl an der Sinnlosigkeit :mrgreen:

danke...:
meine frage kam daher, weil nach hinzufügen eines weiteren elements fehler gemeldet werden (onerror) ..:
"
An attemped read or write to/from an address to which that process isn't allowed
Module:J:\MyWorks\Games\MYGAMEENGINE\DarknesOverEarth\SGFXCORE.pbi AT LINE:834
"
wobei die Zeile varieren kann. wenn ich jedoch ein beliebiges element aus der struktur entferne funktioniert alles wieder....
am ram-verbrauch kanns nicht liegen, weil ich mit unterschiedlichsten grössen getestet hab. (dim()) . steh im wald...


anbei ein codesnipsel aus meinem IN_GRID_DNA System...

Code: Alles auswählen

Structure _DDDGFX
 worldFTileName.s
 worldFTileGFX.l
 worldFTileIs_GFX.b
 worldFTile_2D_EFFECT_GFX.l  ;used as overlay 
 worldFTile_3D_EFFECT_GFX.l  ;used as overlay 
 worldFTile_EFFECT_GFX.s  ;stores the location of the gfx used for effects (connected to the worldFTileGFX)
 worldFTile_Is_EFFECT_GFX.b ;true/false
 worldFTileUseShadow.s  ;holds the shadow filename, file-path is stored by:worldFTile_EFFECT_GFX.s 
 worldFTile_2D_SHADOW.l
 worldFTile_3D_SHADOW.l
 worldFTile_Is_Shadow.b
 worldFTileRandomRotate.l
 isRotating.b ;internal
 _2DTILEW.f  ;internal
 _2DTILEH.f ;internal
 rescal_w.f ;internal
 rescal_h.f ;internal 
 maxW.f ;internal
 maxH.f ;internal
 areaX.f ;internal
 areaY.f ;internal
 areaW.f ;internal
 areaH.f ;internal
 worldFTileInTouch.b  ;internal use for some object controlling
 worldFTileAnim2DFrameDEFAULT.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnim2DFrameR.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnim2DFrameL.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnim2DFrameU.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnim2DFrameD.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnimFrameDEFAULT.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnimFrameR.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnimFrameL.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnimFrameU.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnimFrameD.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnimFrameRW.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnimFrameRH.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnimFrameLW.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnimFrameLH.l[32]
 worldFTileAnimFrameUW.l[32] ;the anim frame containers (Right, Left, Up, Down) 3D Sprite ID is copied to worldFTileGFX
 worldFTileAnimFrameUH.l[32]
 worldFTileAnimFrameDW.l[32]
 worldFTileAnimFrameDH.l[32]
 worldFTileAnimFrameDEFAULTH.l[32]
 worldFTileAnimFrameDEFAULTW.l[32]
 worldFTileValidMirror.b
 worldFTileAnimFrame.l ;actualFrame (does not check anim direction, will set  to startvalue if animdirection is changed or animframe> maxframes)
 worldFTileMaxFramesDEFAULT.l ;internal
 worldFTileMaxFramesR.l ;internal
 worldFTileFrameR.l
 worldFTileFrameL.l
 worldFTileFrameU.l
 worldFTileFrameD.l  ;internal control for the animframe version 191211
 actualDirection.l  ;internal for new animversion or other engine system values for version 191211
 worldFTileIsAnim.b  ;internal use for  version 191211
 worldFTileMaxFramesL.l ;internal
 worldFTileMaxFramesU.l ;internal
 worldFTileMaxFramesD.l ;internal
 worldFTileAnimW.f ;internal
 worldFTileAnimH.f ;internal
 worldFTileMaxAnimFrames.l
 animStartTime.l
 animContainer.s ;holds the animdata
 animTimer.l  ;external skript, default =40 ms = 25 FPS
 animAutoPlay.b
 worldFH.f;offsets (automatic positioning the tiles in the right distance...
 worldFV.f
 worldFTileMaterialIndex.l ;#_grass,#_sand.
 worldFTileCollision.b
 worldFTileType.l
 worldFTileW.f
 worldFTileH.f
 worldFTileRotate.f
 worldFTileFollow.s
 worldFTileDestinationID.l ;for the followobject to make a simple/fast way for the follow action way
 worldFTileTransparency.f
 worldFTileTransparencyBackUp.l  ;internal
 worldFTileXPOS.f
 worldFTileYPOS.f
 worldFTileGOBACK.l
 worldFTileTouchMove.l
 worldFTileTouchTransparency.l
 worldFTilePlayerID.l
 worldFTileExpansionValueH.f
 worldFTileExpansionValueV.f
 worldFTileIsGUI.b
 worldFStretch.b
 worldFTileAngle.f
 worldFTileMove.f
 worldFTileVELO.f
 worldFTileFadeOutStep.f
 worldFTileVeloV.f  ;for the Parable..
 worldFTileVeloH.f   ;for the Parable
 worldFTilePlayerMOVE.f
 worldFTileInventoryObject.s[127] ;stores the ObjectName if object is one to carry by object (simple imventory)
 inventoryCounter.b  ;0-127 objects counter for the inventoryobject
 worldFTilePLINKI.l
 worldFTileGravity.l
 worldFTileScrollH.f    ;autoscroll direction without playerpower, can be combined with useLayerScroll.b
 worldFTileScrollV.f    ;autoscroll direction without playerpower, can be combined with useLayerScroll.b
 worldFTileCollisionDestroy.b
 worldFTileIsActive.b
 worldFTileGlobalGravity.f
 worldFTileFollowObject.l
 worldFTileMoveH.f
 worldFTileMoveV.f
 worldFTileUseMoveLogic.l ;internal for some special move controls (like use horizontal move only...)
 worldFTileUseKeyboard.b
 worldFTileUseStick.b
 worldFTileIsHWMousePointer.b
 worldFTileTouchRotate.l
 FTileLayer.l ;           we can use layer (back/front/medium ....) actual range: 0...256
 useLayerScroll.b       ;if <>0 paralaxscrolling possible (layer# = velo-factor ) = scrollspeed * layer# 
                           ; useLayerScroll MUST be used in ONE level-tile, do not use this in more than ONE tile as switch (playerObject preferred, because it will be in every level on position and so thhe engine will be able to use the keyword), that will cause multiple scrolling events with chaotic situation
 worldGlobalScrollH.f  
 worldGlobalScrollV.f 
 worldFTileWeight.l ;for simple physics  
 worldFTileShadow.f
 AI.b
 worldFTileTransport.b
 worldFTileFadeOUT.f
 worldFTileFadeIn.f
 worldFTileFadeInStep.f
 worldFTileFlire.f
 worldFTileID.l
 worldFTileIDString.s ;id string if you want to use this instead of "numbers"
 worldFTileORIGW.f  ;internal systemvaribale to use with some effects
 worldFTileORIGH.f  ;internal systemvaribale to use with some effects
 worldFTileORIGX.f
 worldFTileORIGY.f
 worldFTileUseScript.s ;control structure for AI Controls (uses a simple interpretersystem)
 hp.l     ;hitpoints if needed...
 max_hp.l ;store the maximumhitpoints of the object....
 worldFTileShowHP.b ;internal use but external changeable 
 useWeapon.s
 worldFTileObjectText.s
 postEFFECT.s
 worldFTileLoopH.b
 worldFTileLoopV.b
 worldFTileFollowUseDistance.b
 worldFTileRandomActivateWeapon.l  ;random number if >0 1 is used for activate the weaponfunction/emitter if useweapon = true
 goONX.b ;internal, for collsion stop/go AI
 goONY.b ;internal, for collision stop/go AI
 lastMoveX.f ;internal for AI
 lastMoveY.f ;internal for AI
 geneseID.s  ;use this for the worldcontruction to put / seperate AI Objects from level structure. ...so we make shure that AI objects blitted on the right layer
 worldFTileRandomMove.b
 worldFTileLifeTime.l ;value , resolution is defined by " worldFTileTimerMS.l"
 worldFTileTimerMS.l ;timer resolution
 worldFTileStartTime.l ;internal Helper for the objecttimer
 worldFTileAutoMove.b
 worldFTileHideOnStart.b
 playerSCORE.l  ;now we show /store the score to the object!!!!
 worldFTileAutoLayer.b ;is used if you want to set layers to objects, so you can build your map without thinking of layers...,  defaultvalue=-1 = OFF!!!
                                            ;          nal use....so we can make it "blink" If colided With enemy Or If we like.... (does Not infect standard settings setable thru builder                 
 inUse.b  ;internal variable (ex: you can check with this if "your" object is doing something
 usedBy.l ; internal variable stores the index of the object which started the object/action (inUse.b) :ex you activate a shot: bullet stores the index of the object which did the shot, and you can set this object as  "inUse", so you prevent from shooting all ammo with one enemy/shotgun....
;  worldFTileAIX.l[16];internal AI stores... if maximum (16) is reached the first one will be overwritten by new data (FIFO)
;  worldFTileAIY.l[16] ;internal stores up to 16 steps (brain) of AI for AI-movement -> Is AIX= free Area or used..(FIFO)
;  worldFTileAI.l[16] ;internal store of 16 AI actions/Responses (FIFO)
 worldFTileIsMirror.l ;if value>0 this object is used as mirror tile value= mirro pic transparency
 worldFTileMirrorAt.s ;the reflection direction
 worldFTileIsSound.b  ;true/false
 worldFTileSoundPlayOnAction.b  ;like collision....
 worldFTilePlaySoundOnView.b  ;if is in screen start the sound ...
 worldFTileSoundFile.s ;stores stringId of  connected sound
 worldFTileSoundIndex.l ; internal value with direct access to sound file counterindex...
 worldFTileSoundDuration.l ;milliseconds
 worldFTileSoundStartTime.l ;elapsedmilliseconds..start value INTERNAL
 worldFTileSoundVolume.b ;up to 100 or down to 0 ; every object can use its own soundvolume!
 worldFTileIsInScreen.b ;internal varibale set this for fast detection if object is in visible zone.
 worldFTileSoundType.s  ;used for definition if  is env or objectsound (water/wind/rain = worldsound, walksound = objectsound.....)
 button_pressed.b ;here we check keyboard/joypad buttons pressed in combination with objectactivity , used for humancontrolled objects
 worldFTileSoundIsPlaying.b ;internal control
 worldFTileRandomSound.l  ;if >0 we use value as random base...for sound activating
 worldFTileKillOutOfScreen.b
 weaponPower.l ;weaponpower!
 EndStructure
Zuletzt geändert von darius676 am 14.04.2012 15:39, insgesamt 1-mal geändert.
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Re: Strukturen

Beitrag von ts-soft »

Compileroptionen und Purifier enablen, dann findeste den Fehler schon.
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Benutzeravatar
darius676
Beiträge: 512
Registriert: 08.03.2010 22:12
Computerausstattung: Intel i5 16GB RAM nVidia 1050, Win11
Atari Jaguar, Surface Pro 5,Surface Laptop i5 7200, XBOX ONE X, XBOX Series X
Wohnort: AT
Kontaktdaten:

Re: Strukturen, gelöst

Beitrag von darius676 »

danke! gelöst. (sehr dummer fehler.....) hab einen negativen indexwert übergeben....hat sich erst ab einer bestimmten strukturgröße bemerkbar gemacht...der fehler "schlummerte" schon seit der ersten IN_GRID version....
Antworten