ID:1875340
 
(See the best response by Lummox JR.)
Problem:

Well, the thing is that im trying to make an object search for the same object in an area of 0x1, it is a basic power system, but im having serious troubles with it, and yes, im working with electrical wires, now, im having problems with the procs where im placing the code, i dont know how to use it or at least that is what i think, im still learning DM and it is a very interesting software, but I have tried many ways to do it and I have read a lot about the "subject" but im still stuck...
Well, here is how im doing it:

        proc
Charge()
if(src in view(0x1) == src)
(..)


The thing is that i dont know how to make it to work in this way, with the proc* i will be very grateful if you tell me a way how could it work.
I'm confused. in a 0 x 1 radius?

That doesn't make sense to me. (If you're literally multiplying, you probably know that 0 times 1 is 0)

In the event that you want to simply check for another object that's within one tile. You'd just put. . .

'view(1)'

You also should post the errors you get. Don't know what the (...) is for either.
In response to Gtgoku55
0x1 is a hexadecimal number; it's just 1.
Best response
There's a lot missing here that I think you left out. We also need to know what errors you're seeing. But I can go over the code you posted, which basically is just this line:

if(src in view(0x1) == src)

A few things:

1) 0x1 is the same as 1; the 0x prefix just means a number will be treated as hexadecimal. So just use 1, since it's clearer.

2) view(1) is the same as view(1,usr), but this is a proc, not a verb. Therefore usr should not be used here. I think you want something like view(1,src), but I'm really not sure what you're trying to accomplish.

3) == has higher precedence than "in". Therefore the if() looks like this to the compiler:

if(src in (view(1) == src))

The == will result in either 0 or 1, so your if() boils down to if(src in 0) or if(src in 1), either of which will always be false.

But if "in" was stronger or you used parentheses, it'd still be wrong, because this:

if((src in view(1)) == src)

...would be if(0 == src) or if(1 == src).

Based on what you said, I think you don't want to search for the same object, but a different object of the same type. To help you with that, it would help to see more of your code--specifically, what object type this proc is supposed to belong to.
Yes, what you are saying is true, but my first problem is that i dont want to activate the proc with a verb, i want it to go all alone when the game starts and it make loopings each 1 or 2 seconds, i cant find a way to make it..
Also, i dedicated all the weekend to the power/cable process, and yes, the problem right now is the proc*, and i understood what you said about the == and the in () "inside", thanks by the way..

Pd: The code is inside an object/cable/proc..., so when i want to call that procedure, i dont know if it is working so i place a procedure that shows me a energy var = 0 (click proc) and if the proc is working it should show me a energy = 1, but it is 0.. thats my problem
Although view(1) is probably generally best, I think Stroop was actually trying to use view("0x1", src), which is 1 tile wide and 2 tiles tall, extending to the north. But then, oview() would be more appropriate, and get_step(src, NORTH) would be even better to use.
Yes, you are right, but the thing is that i dont want to call the procedure with a verb!, example:

obj/poison
name = "can of soda"
verb/drink()
set src in view(0)
usr.HurtMe(25) //OUCH!
del src //one use only (please recycle)


As you can see (you can find the code in the chapter 6 of the guide), there is a proc called HurtMe() and it was created in mob, now, the thing is that he is calling it with a verb, and that is what i dont want to do, all i want is that he call itself when it find another same object (what i mean is: "Cable = Cable", it is the same object, so it is going to call the proc.)
One big question is: when is that proc going to be called? Is it called when the cable is created? (That's gonna be a nightmare at world startup if you don't do something to optimize it.)
It doenst matter if i want it to be called/executed each second or each minute or each hour, or if it is called when there is a cable next to it (or another kind of obj)...
So right now, what i want is a way to call it <_< by itself, for example, yesterday i was trying to make it execute when a user "log in" with the Login() proc, but if the proc is inside a object, how do i call it?

Pd: Sorry my english, again x/.
I'm not sure why this would make sense to call from Login(), but all right. Let's say this object is called /obj/wire.

mob/Login()
..() // do default login stuff
... // do other login stuff (you fill this in)
var/obj/wire/W = locate(/obj/wire) // find any wire
W.Charge()

That's it. But it's probably not very useful to you in that form. To help you better, it would be best to understand exactly what you need.
You should really have an "if(W)" in there as not to get null.Charge() runtimes.