Code: Select all
use uo;
use os;
include ":itemutils:itemdesc";
program Install()
return 1;
endprogram
exported function IsLight( light )
light := light;
return 1;
endfunction
exported function IsOn( light )
return GetItemDescInfo( light.graphic ).IsOn;
endfunction
exported function TurnOn( light )
Broadcast("I want to broadcast this as a test.");
if( IsOn( light ))
Broadcast("There was an error");
return error{"errortext":="Light is already turned on."};
endif
var cfg_info := GetItemDescInfo( light.graphic );
light.graphic := CInt( cfg_info.ChangeTo );
cfg_info := GetItemDescInfo( light.graphic );
light.facing := CInt(cfg_info.Facing);
Print("Facing " + light.facing);
return 1;
endfunction
exported function TurnOff( light )
if( !IsOn( light ))
return error{"errortext":="Light is already turned off."};
endif
var cfg_info := GetItemDescInfo( light.graphic );
light.graphic := CInt( cfg_info.ChangeTo );
return "Done";
endfunction
exported function Toggle( light )
if( IsOn( light ))
return TurnOff( light );
else
return TurnOn( light );
endif
endfunction