The point in this case is to take input entered after the word 'say' (minus quotes) and randomly capitalize all letters in the string, then send string and ansi codes to world. I actually taught myself Perl scripting last night while writing this script, so it's probably bound to have errors, being my first script ever.
I also need help with actually getting the say alias to work. The name of the script is InsaneText.pl
Do I need to call a variable in the alias somehow? Like $new_str? (see code below for details)
-----------------------------------------------------------
Ex.
Input of the following:
say Hello there Nick Gammon.
Would be changed to something like:
say $2$I hELlo THerE NiCK gAMMon.
Then the ^ above would be sent to the world.
----------------------------------------------------------
Here's what I have right now. The first and last lines are just stuff I made up...I don't know the context for sending and recieving things from the world.
-----------------------------------------------------------
I also need help with actually getting the say alias to work. The name of the script is InsaneText.pl
Do I need to call a variable in the alias somehow? Like $new_str? (see code below for details)
-----------------------------------------------------------
Ex.
Input of the following:
say Hello there Nick Gammon.
Would be changed to something like:
say $2$I hELlo THerE NiCK gAMMon.
Then the ^ above would be sent to the world.
----------------------------------------------------------
Here's what I have right now. The first and last lines are just stuff I made up...I don't know the context for sending and recieving things from the world.
-----------------------------------------------------------
$input_str = world.input;
$top = 2;
$pos = 0;
$num = 0;
while ($pos < length $input_str){
$num = int(rand $top);
$char = substr($input_str, $pos, 1);
if ($num ==1) {
uc $char;
} elsif ($num ==2) {
lc $char;
}
$new_str .= $char;
$pos++;
}
world.send = $new_str;