ID:1894856
 
(See the best response by Ter13.)
Code:
mob/proc
SChakraCheck() //SHARINGAN
if(src.Intride||src.Intride2)
if(src.chakra>0)
src.chakra-=100
for(var/mob/NPC/UchihaTablet/M in oview(src))
src.UchihaStoneCheck(M)
for(var/mob/clone/Clone/M in oview(src))
src.CloneImageCheck(M)
for(var/mob/clone/KageClone/M in oview(src))
src.CloneImageCheck(M)
for(var/mob/clone/WaterClone/M in oview(src))
src.CloneImageCheck(M)
for(var/mob/clone/RockClone/M in oview(src))
src.CloneImageCheck(M)
for(var/mob/clone/BakuhaClone/M in oview(src))
src.CloneImageCheck(M)
for(var/mob/clone/RaitonClone/M in oview(src))
src.CloneImageCheck(M)

for(var/mob/clone/CrowClone/M in oview(src))
src.CloneImageCheck(M)

for(var/mob/EdoSummon/M in oview(src))
src.ImageCheck(M)

for(var/mob/enemyvillage/M in oview(src))
src.ImageCheck(M)

for(var/mob/missingwonder/M in oview(src))
src.ImageCheck(M)

for(var/mob/villagewonder/M in oview(src))
src.ImageCheck(M)

for(var/mob/DeadSoulJutsu/M in oview(src))
src.ImageCheck(M)

for(var/mob/clone/PaperClone/M in oview(src))
src.CloneImageCheck(M)

for(var/mob/clone/BugClone/M in oview(src))
src.CloneImageCheck(M)

for(var/mob/Pets/Split/M in oview(src))
src.ImageCheck(M)
for(var/obj/Mine/M in oview(src))
src.MineCheck(M)
for(var/mob/M in oview(src))
if(M.client)
if(M.InGenjutsu)
src.GenjutsuImageCheck(M)
else
src.ImageCheck(M)
for(var/obj/JaminguBugs/M in oview(src))
src.JaminguCheck(M)
if(src.chakra <= 0)
src.chakra = 0
src.move = 1
src<<"Please Cover your Eye."
else
sleep(5)
src.SChakraCheck()


Problem description:
after 5 seconds it literally cancels itself
Uh... Yeah. This is the opposite of what you should be doing. You should never be doing this much looping through the view.

What exactly is the point of all of this?
Oh dear god.... *takes off sunglasses for dramatic effect*
In response to Ter13
too see someoens energy if there in your view or in this case "Chakra"
Can you explain what you are trying to do more in depth than that?
In response to Ter13
too be able to see peoples chakra as well as certain objs like the uchiha tablet and etc the issue is it works then 5 seconds later it literally stops working
I'm going to need a better explanation of what you are trying to do.

Explain it to me like I'm not living inside of your brain please. You know, because I don't actually live inside of your head.

In other words, use your words. It's really tedious to keep telling you that we can't see your thought process.

I'd also like to add that your thought process has turned out something very bad. Like, the worst thing that you could ever do. So obviously there's something wrong with how you are thinking. I just need to find it to help you understand where you have gone wrong.
In response to Ter13
i want to make it so you can see peoples energy when you have a certain eye technique activated.
In response to Daiguren Hyourinamru
See in what way? Is the energy meant to be a visual effect? Or are you talking about outputting their energy variable to the chat?
In response to LordAndrew
yes its ment to be a visual effect only seeable if you activate a certain technique (hence the Intride because the verb sets that varible on)
Best response
Okay, that's much clearer. I'd use images for this:

var
list/energy_images = list()
list/energy_observers = list()
proc
add_energy_image(image/i,mob/m)
if(ismob(m)&&m.client)
for(var/client/c in energy_observers-m.client)
c << i
else
for(var/client/c in energy_observers)
c << i

remove_energy_image(image/i,mob/m)
for(var/client/c in energy_observers)
c.images -= i

add_energy_observer(client/c)
if(ismob(c)) client = c:client
if(istype(client,/client)
//make sure that the client was added
. = -energy_observers.len
energy_observers |= c
. += energy_observers.len
if(.) c.images.Add(energy_images)

remove_energy_observer(client/c)
if(ismob(c)) client = c:client
if(istype(client,/client)
//make sure that the client was removed
. = -energy_observers.len
energy_observers -= c
. -= energy_observers.len
if(.) c.images.Remove(energy_images)


This global variable will store every image in the world that's attached to a chakra-having object.

Next, we need to make every object that has energy have one of these objects:

atom/movable
var
has_energy = 0
image/energy_image
New()
..()
if(has_energy)
energy_image = image('energybar.dmi',src)
add_energy_image(energy_image,src)
Del()
if(energy_image)
remove_energy_image(energy_image,src)
..()


Alright, so next we need to set up energy on an object and manage hooks for dealing with it:

mob
var
energy = 100
max_energy = 100
proc
addEnergy(value)
energy = min(max(energy+value,0),max_energy)
updateEnergyImage()
subEnergy(value)
energy = min(max(energy-value,0),max_energy)
updateEnergyImage()
setEnergy(value)
energy = min(max(value,0),max_energy)
updateEnergyImage()
setEnergyMax(value)
max_energy = value
energy = min(max(energy,0),max_energy)
updateEnergyImage()

updateEnergyImage()
var/obj/o = new()
o.icon = 'energybar.dmi'
o.layer = FLOAT_LAYER
var/sz = round(min(max(energy/max_energy,0),1) * BAR_WIDTH) //bar width should be how big the icon for the bar is
o.transform = matrix(sz,0,round((sz-BAR_WIDTH)/2),0,1,0)
energy_image.overlays = list(o)


When you change the energy of something, you need to use the setter procs to do it, otherwise the energy bar's graphics can get out of sync.

Next, we need to know how to enable seeing energy images:

mob
var
see_energy = 0
proc
showEnergy()
see_energy = 1
add_energy_observer(src)
hideEnergy()
see_energy = 0
remove_energy_observer(src)
Login()
. = ..()
if(see_energy) showEnergy()
Logout()
if(see_energy) hideEnergy()
. = ..()


All you need to do is call show/hide energy procs to show the statbars.

This approach requires none of the constant looking around in view()/oview() that yours does, and it's much smaller and cleaner, not to mention faster than what you are doing.
hmm intresting but one thing tho..the energy image is ment to go on the mob its not excatly an energy bar in itself in laymans terms its a image overlay that only u can see that appears on anyone else within your range.
This is why you need to explain yourself better.

It should be a trivial change for you to make. Just ignore the third block of code in my example.