in reply to Adding script to this base script?
Your script cannot compile as you posted/pasted it. In the fifth line, you are missing a closing parenthesis:
$value = int(rand(100 ) +1);
Also, without knowing the mud environment you use, the seventh line is really quoted weird. I'm sure that the unbalanced quotes there are an error too:
&tellRoom($objects[$me]{"location:},$me,$objects[$me]{"name"} "rolled +$value."); # ^ Quote missing? # ^ Quote missing? or ^ Comma +missing?
Please consider whether your target environment really tells you compilation errors and how you can find out about them if not.
If your target environment silently swallows errors, consider developing for a different target environment or consider testing your code on a local Perl installation. You will have to fake some stuff like tellRoom then, but that's actually not too hard:
#!/usr/bin/perl -w use strict; my @objects = (); my $me = 1; $objects[$me] = { name = 'merrie' }; sub tellRoom { my ($room,$user,@msg) = @_; print "In $room: @msg\n"; }; sub hello { my ($me,) = @_; tellRoom("Here",$me,"$objects[$me]{name} says 'hello'." ); }; hello();
But you should learn much about Perl's syntax. Counter to your expectations, whitespace is important to Perl, for example, it makes little sense in Perl to write subdice100 and to expect Perl to know that you meant sub dice100. Get a good book on Perl (via http://books.perl.org) and/or read the Perl syntax description (perlsyn).
|
|---|