ID:149660
 
ok my ploppsys are haveing trouble again..

my plopsys live in a fantisy world outside of the map.. this world is mad up entirelt of my code.. my problem is there are different plains to this world, so my plopsys can communicat to each other if they sar both on the same plain.

so the ploppsyhave a verb.. its called radar. if a human makes a plopsy radar then it will give the name of all plopsy in its plain of fantsy and three number vars for each
HX,HY,HZ
view >> "plopsy1 345,985,-900

plopsy3 4059,549876,85

" so on and so forth..

the problem i have with this is i cant seem to be able to link my ploppsys together this way. a verb by a human should be able to change its plain and radar should be able to list all ploppsy on this plain. but i cant find any way to do this. i cant do it by makeing it the contents of something becase they set locationson the map.

jobe wrote:
ok my ploppsys are haveing trouble again..

my plopsys live in a fantisy world outside of the map.. this world is mad up entirelt of my code.. my problem is there are different plains to this world, so my plopsys can communicat to each other if they sar both on the same plain.

so the ploppsyhave a verb.. its called radar. if a human makes a plopsy radar then it will give the name of all plopsy in its plain of fantsy and three number vars for each
HX,HY,HZ
view >> "plopsy1 345,985,-900

plopsy3 4059,549876,85

" so on and so forth..

the problem i have with this is i cant seem to be able to link my ploppsys together this way. a verb by a human should be able to change its plain and radar should be able to list all ploppsy on this plain. but i cant find any way to do this. i cant do it by makeing it the contents of something becase they set locationson the map.

You could make each plane a different map, which would make it a different Z level. Then you could do this:

mob/verb/plane_talk(msg, z_lev)
for(mob/plopsys/P in world)
if(P.z == z_lev)
P << msg


Then if you called plane_talk("hi", 2) it would give the message of "hi" to all plopsys on the second plane.

I had a little trouble understanding your question, so this may not be what you're looking for.
In response to Skysaw
Skysaw wrote:
You could make each plane a different map, which would make it a different Z level. Then you could do this:
> mob/verb/plane_talk(msg, z_lev)
> for(mob/plopsys/P in world)
> if(P.z == z_lev)
> P << msg
>


Looping through all mobs in world can be cpu-consuming for big worlds (At least I think it can, and I'm a sucker for optimizing!), so I suggest using block() instead.
mob/verb/plane_talk(msg, z_lev)
for(mob/plopsys/P in block(locate(1,1,z_lev),locate(world.maxx,world.maxy,z_lev))
P << msg


/Andreas
In response to Gazoot
Gazoot wrote:
Skysaw wrote:
You could make each plane a different map, which would make it a different Z level. Then you could do this:
> > mob/verb/plane_talk(msg, z_lev)
> > for(mob/plopsys/P in world)
> > if(P.z == z_lev)
> > P << msg
> >

Looping through all mobs in world can be cpu-consuming for big worlds (At least I think it can, and I'm a sucker for optimizing!), so I suggest using block() instead.
> mob/verb/plane_talk(msg, z_lev)
> for(mob/plopsys/P in block(locate(1,1,z_lev),locate(world.maxx,world.maxy,z_lev))
> P << msg
>

/Andreas

Not a bad approach, but my example didn't loop through all the mobs in the world. It looped through all the plopsys in the world... a world of difference!
In response to Skysaw
thats just my problem though. i cant do that. all ploppsys have a set location on the map where as they can change there plain. i cant use z levels becase then the ploppsys will not be able to travel to other areas while still staying in the same place on the map.
In response to jobe
Are you describing sort of an out of body experience? Where the plopsys are on the world map but their "spirits" can jump to different plains? Those may not be the correct terms for your world but are the ideas similar?

If they are then you can just create lists for each plain and add them to whichever one they're on:

//these are all global lists
var/list/plains = list(plain1,plain2,plain3)
var/list/plain1 = list()
var/list/plain2 = list()
var/list/plain3 = list()

mob
var/list/current_plain
verb
Change_Plain()
current_plain = input("Which plain?","Change") in plains

Radar()
for(var/plopsy/P in current_plain)
usr << "Found [P]!"
Plopsy
Change_Plain()
current_plain -= src
current_plain = pick(plain1,plain2,plain3)
current_plain += src
In response to Skysaw
Not a bad approach, but my example didn't loop through all the mobs in the world. It looped through all the plopsys in the world... a world of difference!

If there are lots of plopsys and plane_talks, it could still be much to loop through. Well now we got two ways to do it.


/Andreas
In response to English
well thank you.. this was exactly what i was getting at. although ploppsys and plains are not going to be in any of my game the code help was still verry usefull for my next release.
In response to English
this is good.. yes good. my only problem with it is.... lag

you see. when two plopsys in the same plain have vars that are close to each other stuff happens.. but if a single plain has alot of ploppsys and they are all cheacking each others vars then lag happens.

is there any way of useing this list thing but also not needlessly checking vars of to many ploppsys?
In response to jobe
The only thing I can think of off hand would be to reduce the frequency of the checks. Perhaps post how your handling the Radar (or whatever) code so we can see what might be causing uneeded lag.