EntityTexture command not working?

Blitz3D Forums/Blitz3D Beginners Area/EntityTexture command not working?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

If counter = 20 Then
  hold(counter)\item = loadmesh("../media/cube.b3d")
  hold(counter)\item1 = CopyMesh(hold(counter)\item)
  hold(counter)\anim1 = 0
  hold(counter)\ID = counter
  hold(counter)\points = 0
  hold(counter)\sizex# = 2
  hold(counter)\sizez# = 2
  hold(counter)\gridx = -1
  hold(counter)\gridz = -1
  hold(counter)\status = 1
  hold(counter)\itemcount = 1
  hold(counter)\lives = 0
  hold(counter)\puzzle = 0
  hold(counter)\secret = 0
  hold(counter)\time = 0
  hold(counter)\sphere = 0
  hold(counter)\fruit = 0
  hold(counter)\cube = 1
  hold(counter)\particle = 0
  hold(counter)\player = 0
  hold(counter)\texture = 0
  hold(counter)\nextitem = ID_cube
  hold(counter)\nextarray = 20
  HideEntity(hold(counter)\item)
  HideEntity(hold(counter)\item1)
  counter = counter + 1
EndIf

If grid(countx%,countz%) = ID_cube Then ;wall section so create a cube and load a texture for it.

		  lvlgrid(countx%,countz%)\item1 = hold(ID_cube)\item1

		  ;rndynum = Rnd(1,2)

		  ScaleEntity(lvlgrid(countx%,countz%)\item1,1.1,1.1,1.1)

		  rndtnum = Rnd(0,9)  ; get a rnd num 0-9, to select a texture to load and assign to wall.
		  tfilename$ = "../media/cube" + Str(rndtnum) + ".png" ;used to load in randomized textures.
            tfilename$ = Trim$(tfilename)
		  lvlgrid(countx%,countz%)\texture = LoadTexture(tfilename$)
            Text 250,600, "Texture:" + tfilename$    
		  EntityTexture(lvlgrid(countx%,countz%)\item1, lvlgrid(countx%,countz%)\texture)
		  
		  lvlgrid(countx%,countz%)\item = CopyMesh(lvlgrid(countx%,countz%)\item1)
		  lvlgrid(countx%,countz%)\anim1 = 0
		  lvlgrid(countx%,countz%)\cube = 1  ;this is a wall section, so texture is needed also.
		  lvlgrid(countx%,countz%)\nextitem = ID_cube  ;we will always be a cube, never changing.
		  lvlgrid(countx%,countz%)\nextarray = ID_cube ; array position of cube item loaded.
		  lvlgrid(countx%,countz%)\sizex# = 2.0
		  lvlgrid(countx%,countz%)\sizez# = 2.0
		  lvlgrid(countx%,countz%)\gridx = countx%
		  lvlgrid(countx%,countz%)\gridz = countz%
            PositionEntity lvlgrid(countx%,countz%)\item,countx% * GX#, 0, countz% * GZ#
		  EntityType lvlgrid(countx%,countz%)\item, GetEntityType(hold(ID_cube)\item)
            EntityRadius lvlgrid(countx%,countz%)\item, 2.0,2.0
		  lvlgrid(countx%,countz%)\status = 1 ; the wall segment is always stopped.
		End If


Hope this helps.. I am just doing like other examples, loading the mesh, then copying the mesh, then using loadtexture, and then entitytexture... and I get nothing, but original texture.