How to change obj's icon_state with a proc. in Developer Help
obj Titlescreen icon='Titlescreen.dmi' CHANGETITLESCREENICON() Click() var/mob/Loginscreen/M = usr M.CHECKSAVE()obj/proc CHANGETITLESCREENICON() src.icon_state="" sleep(5) src.icon_state="Text" src.CHANGETITLESCREENICON()
obj/X New() // This is called after /obj/X is created icon_state = Randomize()
Wow, it's working now, thanks. But now this runtime errors pops up and then the proc doesn't work anymore, is it any way to disable the safety check only for that proc?
runtime error: Maximum recursion level reached (perhaps there is an infinite loop)
To avoid this safety check, set world.loop_checks=0.
proc name: CHANGETITLESCREENICON (/obj/proc/CHANGETITLESCREENICON)
src: Titlescreen (/obj/Titlescreen)
while(1) src.icon_state="" sleep(5) src.icon_state="Text" sleep(5)// The above will always reoccur due to the while()
While that is true, you should just use a while loop as opposed to constantly calling the proc, I don't see anything wrong with setting the world.loop_checks to 0. If you have an infinite loop, it is intentional, accidentally having one is damn near impossible.