2 registered members (TedMar, AndrewAMD),
1,067
guests, and 0
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: skills and local variables treated as global
[Re: Nowherebrain]
#204181
04/27/08 16:03
04/27/08 16:03
|
Joined: Jul 2005
Posts: 1,002 Trier, Deutschland
Nowherebrain
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
|
should I be using...
set(me,speaker);
I also use a material(just ambient change) change here and it works???
Last edited by Nowherebrain; 04/27/08 16:04.
|
|
|
Re: skills and local variables treated as global
[Re: Nowherebrain]
#204215
04/27/08 21:54
04/27/08 21:54
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Yes, you should, if you really want to mess it up... Honestly, set is a macro designed for easily setting flags of an entity. Don't use it on pointers. One thing caught my eye: You said there were three entities non-speakers and on speaker. Your code doesn't represent this. You just check the distance and assign a pointer corresponding to the distance. As you only defined two pointers only the last two entites checked will be pointed to anyways. If you're lucky and the distance of one is > 100 and the other ones is < 100 then you will have to pointers, one pointing to an entity farer away, the other one pointing to the nearer one. If you're not so lucky the distance will be < 100 or < 100 for all entites and only one pointer will get assigned at all. Keep in mind a pointer can only point to one certain address and will not be able to point to a group of entities.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: skills and local variables treated as global
[Re: Nowherebrain]
#204390
04/29/08 00:57
04/29/08 00:57
|
Joined: Jul 2005
Posts: 1,002 Trier, Deutschland
Nowherebrain
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
|
OK, I was wrong...dead wrong. if you are setting my.skillx, it sets them all.. instead use pointerstring.skill1, this will only affect the pointer...Doh! This is not the place, but maybe this should be added to "beginners mistakes" in the manual. ???
Last edited by Nowherebrain; 04/29/08 00:58.
|
|
|
Re: skills and local variables treated as global
[Re: Nowherebrain]
#204492
04/29/08 16:19
04/29/08 16:19
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
if you are setting my.skillx, it sets them all.. instead use pointerstring.skill1, this will only affect the pointer. That's not the whole truth. my.skillx = y will only set one entities skillx to y. But you have to keep in mind, that there may be multiple instances of a function running, with their me pointers pointing to different entities.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
|