ID:147333
 
var/secbar = "closed"

proc
checksecbar1(var/turf/T)
if(secbar == "closed")
T.icon = 'icons2.dmi'
T.icon_state = "secbar"
T.density = 1
if(secbar == "open")
T.icon = 'icons2.dmi'
T.icon_state = "nosecbar"
T.density = 0

world
New()
..()
spawn() checksecbar1()

turf
proc
activate()
if(secbar == "closed")
return 0
if(secbar == "opened")
return

turf
securitybar
icon = 'icons2.dmi'
icon_state = "secbar"
Enter()
activate()

////////////////////////////////////////////////

I haven't created it yet where an npc modifies the var at runtime.

This coding creates run time errors constantly.

Im trying to create a coding that checks the proc every server tick so the second an npc activates the security bar. It will open or close, show the icon state and have the desired density.
proc
checksecbar1(var/turf/T) //you defined an argument but, you didn't input anything into it when you call the proc on world/New().
In response to Teh Governator
eh.. nevermind. The process is too complicated. The activation system by vortezz was diagramed too complex for the more rookie eye to scan and learn from it. Just for thinking sake.

Here's what I was trying to do.

  • Go up to the npc and eventually get the npc to open the security bar.
  • Have a proc that checks var/secbar to see wheater it is closed or open. If it is stated open, the bar would have an icon of an open bar, visversa is closed.
In response to ZLegend
Why can't you just do the opening and closing right in the NPC's proc?

I mean, why have the NPC change a var, and then have to check constantly to see if that var changed before opening/closing the security bar?