Print and Broadcast do not work in this method.

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Print and Broadcast do not work in this method.

Post by Yukiko »

i have been trying to get the following method to print to the console or possibly broadcast in game. It doesn't. I tested Printing from a simple method that just Prints and that worked fine. I need help with this issue. I have already consulted withe Turley and he couldn't figure it out. So here is the function. If anyone has any idea why the TurnOn() method will not send any output (Print or Broadcast), please let me know.

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
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Print and Broadcast do not work in this method.

Post by Yukiko »

Problem solved. It was a cfg file error.
Post Reply