ID:142086
 
Code:
obj/MagikPlates
var/obj/Cooldown/C
var/cooldown=100
New()
..()

src.overlays+=C
C.ontop=src
obj/Cooldown
icon='Cooldown.dmi'
var/cframe=124
var/ontop
New()
spawn for()
cframe=124/ontop.cooldown//this is line 182
icon_state="[cframe]"

Casting Procs.dm:182:error:ontop.cooldown:undefined var

Problem description:
My god this is confusing... I'm trying to make it so "magikplates" overlays "cooldown"and "cooldown" changes iconstate depending on "magikplates" cooldown var

I just can't get my brain to work right through this any help would be appreciated.
You simply declared the variable "ontop", you did not typecast it (unlike for the cooldown variable... there's your hint)

var/obj/MagikPlates/ontop
In response to GhostAnime
Thanks again.
In response to Nategrant
obj/MagikPlates
var/obj/Cooldown/C
var/cooldown=50
New()
..()
C = new()
src.overlays+=C
C.ontop=src

obj/Cooldown
icon='Cooldown.dmi'
var/cframe=124
var/obj/MagikPlates/ontop
icon_state="124"
New()
..()
spawn(5)
for()
cframe=round(124/ontop.cooldown)
src.icon_state="[src.cframe]"
sleep(10)

Sorry for double post but now the iconstate isn't changing.
In response to Nategrant
spawn(5)
for()

makes no sense :S.

        spawn(5)
cframe=round(124/ontop.cooldown)
src.icon_state="[src.cframe]"
sleep(10)
In response to A.T.H.K
for(), with no argument, is actually an infinite loop. It's processing should be slightly more faster then while(1) but I doubt that the difference between the two would make a significant difference.
In response to A.T.H.K
Your "improved" code makes even less sense (why sleep() at the end of the procedure there?), so I doubt you used enough sense when considering the OP's original code doesn't make sense... if that makes sense.
In response to Kaioken
If you knew anything that's not even my problem, I found out what was wrong simply because I was changing the icon_state of a overlay and didn't replace it
In response to Nategrant
I'm afraid my post was not quite directed at you or your specific code.
In response to Kaioken
Oh my bad