View Single Post
  #6  
Old 02-23-2018, 08:15 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

You can pass any information on to the external script via the use of @ARGV, as shown below.

Code:
my $player = "YoMomma";
my $zonesn = "butcher";

# current full working directory
( my $cwd = $0 ) =~ s/(?:(?!\\|\/)\S)+$//;

# you'll want to add some sanity checks to make sure you have valid data here
sub EVENT_ENTERZONE
{

	# hash with zonesn as keys and external scripts to run for the zone
	my %signal_zone = (
		butcher => "signal_butcher.pl",
		cauldron => "signal_cauldron.pl"
	);

	{
		local @ARGV = ($player);
		do "$cwd$signal_zone{$zonesn}";
	}
}

EVENT_ENTERZONE();
Above code calls the following (signal_butcher.pl located in the same folder):
Code:
print $ARGV[0];
Printed result:
Code:
YoMomma
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;

Last edited by c0ncrete; 02-23-2018 at 08:15 PM.. Reason: typo
Reply With Quote