View Single Post
  #4  
Old 09-07-2016, 03:00 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Completely untested (including simply running a perl -c on the code), as I'm away from home atm:

Code:
# /quests/global/global_player.pl
use File::Copy qw(copy);

sub EVENT_SAY {
	@args = split(' ', $text); # Something I use for custom gm commands
	if ($text=~/#globalmarquee/i) {
		if ($args[1]) {
			$formattedstring = "";
			for ($count = 1; $count < scalar(@args); $count++) {
				$formattedstring = $formattedstring." ".$args[$count];
			}
			my $filename = "C:\EQEMU\QUESTS\GLOBAL\GlobalMarquee.txt";
			move $filename, $filename.".bak";
			open my $fh, '>', "output.txt"
				or die "Cannot open file: $!";
			print $fh "$formattedstring\n";
			close $fh;
			quest::crosszonesignalnpcbynpctypeid(10, 99999);
		}
	}
}


# /quests/global/zone_controller.pl
sub EVENT_SIGNAL {

	elsif ($signal == 99999) {
		$filename = "C:\EQEMU\QUESTS\GLOBAL\GlobalMarquee.txt";
		my @marqueemessage = do {
			open my $fh, "<", $filename
				or die "could not open $filename: $!";
			<$fh>;
		};		
		my @clist = $entity_list->GetClientList();
		foreach my $sclient (@clist) {
			$sclient->SendMarqueeMessage(15, 510, 1, 1, 3000, $marqueemessage);
		}
	}
}
When there is a will, there is a way (with Perl).

Last edited by ghanja; 09-07-2016 at 05:25 PM..
Reply With Quote