for(var/mob/M in world)
check EVERY mob in the world? for example
for(var/mob/M in world)
if(M:client)
world << "[M] I am a real person!"
ID:262328
Apr 19 2005, 3:15 pm
|
|
Erm..does
for(var/mob/M in world) check EVERY mob in the world? for example for(var/mob/M in world) |
Replace that : with a . .s are usually better to use than a :
if(M.client) would make sure that the mob is a player, so the second example will show only players. The first example would go through all mobs, even NPCs. |
In response to SSJ2GohanDBGT
|
|
I am asking, What I am trying to do is, when you create a "Dog(Rush)" you cannot create another one until your "Dog" is deleted. and when I do
for(var/mob/Allies/Rush/M in world) It works, but when I play multiplayer, it doesnt. |
In response to ITG Master
|
|
Ok, actually what Im asking is how can I loop through every mob in the world, and find the ones with lets say, Variable N00b = 1.
|
In response to ITG Master
|
|
for(var/mob/M in world) To easy to need comments. -Ryan |
In response to Ryne Rekab
|
|
_> I already knew that....hmm maybe I am just not doing something right. |
In response to ITG Master
|
|
mob/verb this pretty much just checks the mobs in the world and sees if there Noob var is set to 1. if it is it tells the world there a Noob if not it says they aint. |
In response to Odine
|
|
Odine, You really need to stop trying to give advice. Quite frankly it's really bad. Learn to program a little bit more before you give help.
~>Jiskuha |
In response to Jiskuha
|
|
dude... why dont u shut the F up. i gave the code he was asking for i know... i checked my game first it works. instead of just sitting around looking at the screen for somebody else to do something then you say something about it why didnt u help him??? exactly be quiet
|
In response to Odine
|
|
No need to be hostile, Oh and maybe while your brushing up on programming you should try English as well. He should be using the ! operators not ==.
~>Jiskuha |
In response to Jiskuha
|
|
what? why should i be using the != operator in my coding? my code does exactly what its supposed to do. if noob = 1 then it tells the world that there a noob. and then the else statement means that if noob isnt = to 1. it can be equal to anything else but 1 and it will say there not a noob.
|
In response to Odine
|
|
Here is what it should look like. if(M.noob) ~>Jiskuha |
In response to Jiskuha
|
|
um... its actually the exact some code almost it does the same thing. but anyway im droping this subject and this stupid posts you have me making. this is a place to help people dont have anything to help the person? dont post
|
In response to Odine
|
|
Odine wrote:
um... its actually the exact some code almost it does the same thing. No. His is MUCH more robust. What happens if nub was set to 2 in that thing? It phails. |
In response to Hell Ramen
|
|
if noob was set to 2 in my code it would fall under the else statement and still tell the world there not a noob which is what i wanted it to do. but personally what i think he should do is stop criticizing(spelled that wrong) other people who try to help somebody and start helping people himself.
|
In response to Odine
|
|
Odine wrote:
if noob was set to 2 in my code it would fall under the else statement and still tell the world there not a noob which is what i wanted it to do. but personally what i think he should do is stop criticizing(spelled that wrong) other people who try to help somebody and start helping people himself. Uh, 0 = off, 1 or more = on. With boolean vars, 2 would with if(M.n00b), but not with if(M.n00b==1). Just because your code does what it should do at first glance doesn't mean it isn't a bad bit o' code. |
In response to Elation
|
|
hm... i see what your saying. which is why i said only if noob == 1 then it tells the world there a noob. not if noob >= 1. i know i just double checked myself and tested it out just to make sure i didnt make some mistake. if the noob is equal to anything but 1 it says there not a noob in my game.
|
In response to Odine
|
|
I think y'all both are idiots. Stop bickering. There was nothing wrong with the code I posted that he didn't understand. Y'all should just stop acting like n00b=1's.
-Ryan |
In response to ITG Master
|
|
Copy and paste what you have so I can look at it.
-Ryan |
A) You shouldn't be using a colon there
and
B) There are better alternatives to looping through the players(granted you are asking a question, but if not then..)