ID:264980
 
Code:
    mob/player
Move()
.=..()
var/skill/kidou/TigerCannon/t = locate()
for(var/image/i in image_list)
if(t)
usr << "found"
t.run_animation = 0

// t.overlays -= t.tiger_cannon
// t.refresh(src.dir) */


skill
parent_type = /atom/movable
var
level // skill level?
kidou
TigerCannon
name = "tiger_cannon"

var
image/tiger_cannon
damage = 0
run_animation = 1

New(var/newDir,var/mob/player/m)
.=..()
refresh(newDir,m)
m.add(tiger_cannon)

proc
refresh(var/newDir,var/mob/player/m)
usr << "refreshing"
switch(newDir)
if(1) tiger_cannon = image('spells/TigerCannon/TigerCannonNORTH.dmi',pixel_x = -32, pixel_y = 32, layer=FLY_LAYER)
if(2) tiger_cannon = image('spells/TigerCannon/TigerCannon.dmi',pixel_x = 0, pixel_y = -128, layer=FLY_LAYER)
if(4) tiger_cannon = image('spells/TigerCannon/TigerCannonEAST.dmi',pixel_x = 0, pixel_y = 0, layer=FLY_LAYER)
if(8) tiger_cannon = image('spells/TigerCannon/TigerCannonWEST.dmi',pixel_x = -128, pixel_y = -16, layer=FLY_LAYER)
overlays += tiger_cannon

remove()
overlays -= tiger_cannon

animation(var/mob/m)
while( run_animation == 1 )

icon_state = "start"
m.overlays += src
sleep(5)
m.overlays -= src

usr << run_animation
icon_state = "charge"
m.overlays += src
sleep(10)
m.overlays -= src
usr << run_animation

icon_state = "finish"
m.overlays += src
sleep(3)
m.overlays -= src
usr << run_animation
run_animation = 0

m.overlays -= src

/////////////////////////SPELLS//////////////

zz()
set category = "Keys"
set hidden = TRUE
if( state == STATE_NORMAL || state == STATE_RUNNING )
var/skill/kidou/TigerCannon/t = new /skill/kidou/TigerCannon(dir,src)
src << "triggered"
overlays += t
changeState( STATE_SPELL )
changeIconState( "spell" )
t.animation(src)
spawn(10)
changeState( STATE_NORMAL )
changeIconState( "" )
overlays -= t
remove(t)


Problem description:

Im trying to stop a running proc from an outside procedure. Move() attempts to stop animation via use of run_animation var. The loop seems to exit but the icon will still play. Yes "found" displays. And in 'usr << stop_animation', it outputs 1, but when the var becomes 0. It does not output. So the loop is working. But the icon doesn't play.

This should happen:

animation()
runs animation
Move()
stops skill.animation()

Again what makes things difficult: images. My end goal is for this spell to move with the player when they walk (an energy ball they can run with, then explodes into a crazy beam trail at the end).
Well, you're doing some really funky things in your code first off.

I see usr a significant amount of times while you are using a datum, and when you have a mob variable defined. As well, occasionally you just throw out "overlays" without attaching a reference to it, so it automatically assumes src - but src is a datum, and can't display it's overlays on a map, in this case.

As for your actual problem, I've been having an issue with this recently too, specifically with image() overlays as well...

If you un-comment this line:
t.overlays -= t.tiger_cannon // Why is this t.overlays and not just overlays?
t.refresh(src.dir)


If you do that (and fix it, unless I'm missing something here), does the image() stay on the screen, even though you removed it and even if you attempt to delete it? If so, when you use t.refresh(), does it just place that image on top of the previous one? So it just looks like a cluttered arrangement of overlay images?
In response to CauTi0N
@ src. I thought src was the objects reference on its on. I didnt think you'd have to make an entirely new reference to that obj. O.o

@ usr. It's laziness. (just for testing tho) I do that to get output rather then typing out world << output(...) and all that.

@ images. Heres a picture at whats going on.

Image and video hosting by TinyPic

We add the object to mob.overlays. So that the images are auto outputted to the player. We add the image data to the object.overlays. Which the object automatically has.

@does the image() stay on the screen, even though you removed it and even if you attempt to delete it?
Move()
t.overlays -= t.tiger_cannon

that image will just freeze and just animate that one icon_state over and over.

@when you use t.refresh(), does it just place that image on top of the previous one?

Pretty much, the first image will freeze to its icon_state animation. Then the final icon_state animation will continuously play in your new direction.

@So it just looks like a cluttered arrangement of overlay images?

If a player keeps it up, they'll get this. all 4 directions filled up with animated icon_states, lol.
In response to Hulio-G
I'm like 98% sure this is a BYOND bug. I made a code problem about it before and I couldn't solve it. I'm doing additional tests and always get the same results. I have no idea why, or what is going on.