ID:2015556
 
(See the best response by Lige.)
Code:


mob/proc
Flying()
if(ShipStateNum==0)
ShipState="Rest"
if(ShipStateNum==1)
ShipState="Hover"
if(ShipStateNum==2)
ShipState="Flying"
Speed()
if(ShipSpeed==0)
ShipSpeedStat="Stop"
if(ShipSpeed==1)
ShipSpeedStat="Slow"
if(ShipSpeed==2)
ShipSpeedStat="Medium"
if(ShipSpeed==3)
ShipSpeedStat="Fast"
mob
verb //make hidden??
EnterShip() //FIX LATER
CheckShip()
Flying()
Speed()
usr<<"You are at [ShipSpeedStat] speed and [ShipState] state."
Stop()
ShipSpeed=0
ShipStateNum=0
Flying()
usr<<"EMERGENCY STOP EMERGENCY STOP EMERGENCY STOP. You are now at [ShipState] at [ShipSpeedStat] :[ShipSpeed]!"


Problem description: The result I get from using CheckShip(), CheckShip(), Stop(), Stop(), CheckShip(), Stop():
You are at speed and state.
You are at speed and state.
EMERGENCY STOP EMERGENCY STOP EMERGENCY STOP. You are now at Rest at :0!
EMERGENCY STOP EMERGENCY STOP EMERGENCY STOP. You are now at Rest at :0!
You are at Stop speed and Rest state.
EMERGENCY STOP EMERGENCY STOP EMERGENCY STOP. You are now at Rest at Stop :0!


However I'm suppose to be able to see Stop:0 instead of just 0 in the third and fourth line. What is causing this?
Best response
You're not calling your Speed() proc after changing the ShipSpeed var in the Stop verb.
Ah, lol I see what I did now. Ugh, I confused myself by switching the flying to different purposes while building it. It should have been CheckShip() instead of Flying(). While we're at it. I have a CheckParking var just above that. I'm trying to make CheckParking=1 below turf/Space/landingzone. However it keep saying reestablishing var as global or duplication of var. How do I fix this?
I'd need to see a code snippet to help you out. A few ideas come to mind, but I'm not sure how you're approaching this or what it is you're trying to do, exactly.
[in CoS.dm]
mob/var
ShipParking=0

[in Vehicles.dm]
obj
FlagCruiser
Inside
landingLevel
ShipParking=1
icon='FCIlandingLevel.dmi'
Alter the mob's var under the turf/object's behavior.

Example:

mob
var
my_var = 0

turf
special_turf
Entered(atom/movable/a)
if(ismob(a))
var/mob/m = a
m.my_var = 1

Exited(atom/movable/a)
if(ismob(a))
var/mob/m = a
m.my_var = 0

obj
neato
proc
change_mob_var(mob/m)
m.my_var = !m.my_var
Click()
change_mob_var(usr)
Well this particular var was going to be used for if the ship is able to slow down to a hover. As for example if it's in outer space, low enough on a planet or in a flagship. I suppose I might be able to change it. However I don't understand why that var wouldn't work. A density var would, albeit it's a built-in var.
However I don't understand why that var wouldn't work.

There's nothing wrong with the variable. It's that you are trying to apply the variable to the wrong object prototype.