Ithere a way to make an atom have an effect when a var is changed? Example: (I know this doesn't work but it's for an idea.)
turf/door_step
Enter(mob/M)
objectvar = "open" // when it is entered, obj/automatic_door changes.
obj/automatic_door
if(objectvar == "locked")
icon = 'icon.dmi'
icon_state = "locked"
density = 1
if(objectvar == "open")
icon = 'icon.dmi'
icon_state = "open"
density = 0
ID:172062
Jul 2 2004, 3:42 pm
|
|
Jul 2 2004, 5:21 pm
|
|
It would be better to just have a proc be called instead of having to check the variable within a loop, which is the way you would have to do it otherwise.
|
In response to Kunark
|
|
So as soon as the action required to activate it is taken. The icon or whatever will change?
And im meaning this too. ex: joe steps on a turf at 1,5,1. The turf at 1,1,1 becomes dense. What goes on the arg: Dowhat? |
In response to ZLegend
|
|
If want to do that, then you do this:
turf/door_step1 |
In response to Kunark
|
|
Ok. Know what do u do in the arg "DoWhat"?
Could you also tell me what if(O != null) does? I know what the ! operator does. But no idea what it has to do with the variable O. Runtime Error: runtime error: undefined proc or verb /turf/floor/Do Action(). proc name: Enter (/turf/door_step1/Enter) source file: turfs.dm,541 usr: Zlegend2 (/mob) src: the door step1 (19,5,1) (/turf/door_step1) call stack: the door step1 (19,5,1) (/turf/door_step1): Enter(Zlegend2 (/mob)) Zlegend2 (/client): Move(the door step1 (19,5,1) (/turf/door_step1), 2) |
In response to ZLegend
|
|
ZLegend wrote:
Ok. Know what do u do in the arg "DoWhat"? DoWhat is a variable. It would be the same as typing, (var/DoWhat)... Except you can define this variable elsewhere. If you need to close a door, just call Do_Action("Locked") because within the Do_Action proc, it checks what DoWhat is, and does the nessisary action. Could you also tell me what if(O != null) does? I know what the ! operator does. But no idea what it has to do with the variable O. != mean "Is not that of". So this statement would be, "If the variable, "O", is not that of null (or doesn't exist, in other words), then proceed." So, it checks if locate found anything on that turf... If it doesn't find anything, simply calling O.DoAction("Open") is only going to give you a "Cannot execute null.DoAction()" because nothing was there. |