calling an entity, heeelp..

Blitz3D Forums/Blitz3D Beginners Area/calling an entity, heeelp..

njesper(Posted 2003) [#1]
Help me please,

I have question (perhaps it's just straight forward):

I have an entity called playerOne (which is a b3d-file).
If I want to change the color of the entity, I just write:
entitycolor playerOne,x,x,x

NO problem, but:
If I have two string-variables (a$, and b$) containing:
a$="player", and b$="One", then what do I have to do, to be able to use them for pointing at my entity?

example: entitycolor (a$+b$),x,x,x - I know this doesnt work, so do you have another suggestion?

Best regards,
Jesper Colding - Jørgensen

Jesper


churchaxe(Posted 2003) [#2]
you can't use a string-variable for pointing at an entity
because what you get back when you load your b3d-file with something like

playerone = loadmesh("myobject.b3d")

is an integer i.e. a number. But you can use the value stored in playerone (by the line above) directly to modify the color of your mesh:

entitycolor playerone, x, x, x


SopiSoft(Posted 2003) [#3]
you can use custom types for that, if you know how to use them.

here's an example:

Type player
  Field entity
  Field a$
  Field b$
End Type

Global p.player = New player
p\entity=LoadMesh("mesh.b3d")
p\a$="player"
p\b$="one"

For p.player = Each player
  If p\a$ = "player" And p\b$ = "one"
    EntityColor p\entity,r,g,b
  EndIf
Next




njesper(Posted 2003) [#4]
Thank you very much for your quick replies.
It was helpful, and as always ;-) I have now found another solution. But still, you were very kind, thanks mp__ and SopiSoft!!!

:-)

best regards,

Jesper