[Script] LocalSpam

User avatar
Jegue
Posts: 345
Joined: Fri Dec 09, 2011 2:55 pm
Location: Sao Luis, Maranhao, Brazil

[Script] LocalSpam

Post by Jegue »

This is my localspam set in 1.30, it makes you keep saying "retarded, retarded, retarded". The enable/disable key is set to numpad - but you can change it. Just add exec("LocalSpam.cs"); to your autoexec.cs and have these 2 files in your config:

LocalSpam.cs

Code: Select all

///check's Local Spam v1.0
//copyright ||.:.||check    www.drinksomecoffee.com/files

exec("voiceList.cs");
EditActionMap("playMap.sae");
bindCommand(keyboard0, make, "numpad-", TO, "LSStatus();");
$LSstat = 0;     //turn it off to start w/
$LSnum = 2;
$LScount = 2;

$LSspeed = 0.16;

function LSStatus()
{
  if($LSstat == 1)
	$LSstat = 0;
  else if($LSstat == 0) {
	$LSstat = 1;
	startLS();
  }
}

function startLS()
{
  %LSfle = $voiceList[$LSnum];
  if($LSstat == 1) {
	localMessage(%LSfle);
	$LSnum = $LSnum + 5;
	if($LSnum > 2) {
		$LSnum = $LScount;
		$LScount = $LScount + 1;
	if($LScount > 4)
		$LScount = 1;
	}
	schedule("startLS();", $LSspeed);
  }
}
voiceList.cs

Code: Select all

$voiceList[1] = "retreat";
$voiceList[2] = "tgtacq";
- <!>Tariq^
Image
User avatar
DaJ4ck3L
Crow{OZ}
Posts: 3375
Joined: Thu Jul 22, 2010 11:51 pm
Contact:

Re: LocalSpam

Post by DaJ4ck3L »

:trolol:
Image
User avatar
S_hift
Posts: 1963
Joined: Fri Dec 23, 2011 1:42 pm

Re: LocalSpam

Post by S_hift »

$voiceList[1] = "retreat";
$voiceList[2] = "tgtacq";

lolz :dunce:
Image <--Click here to subscribe to S_hift's youtube
Click here for full access to all my tribes downloads
perrinoia
Site Admin
Posts: 3732
Joined: Sun Jul 01, 2012 7:18 pm

Re: LocalSpam

Post by perrinoia »

Why would you want to spam retarded over and over again?

I tried it out, and the timing is a bit off... It sounded like it was saying "Target acRetreTarget acRetreTarget acRetreat!"

Also, the code is hella confusing.

Your keybind calls a toggle function (LSstatus), which calls the spam function (startLS).
You could replace that whole first function with the following key command:

Code: Select all

bindCommand(keyboard0, make, "numpad-", TO, "$LSstat = !$LSstat; startLS();");
Also, you should use incrementer operators, instead of addition. For instance, instead of $LSnum = $LSnum + 5; you could write $LSnum += 5;

And, instead of $LScount = $LScount + 1; you could write $LScount++;

In fact, you can combine those lines of code with the if statements that follow them... For instance,
if(2 < $LSnum += 5), and if(4 < $LScount++)

But more importantly, all of that (except the keybind code) is a waste of space, too, since you are using the LS count to count from 1 to 4 over and over again, and I think LSnum is supposed to toggle between 1 and 2.

So, what you should be using, instead of all of that crap, is the modulus operator.

For example:

Code: Select all

//Perrinoia's overhaul of check's Local Spam v1.0
//Opensource, freeware, annoying script, please don't use it around me.

EditActionMap("playMap.sae");
bindCommand(keyboard0, make, "numpad-", TO, "$retard = !$retard; retard(0);");	// Toggle built into keybind.

function retard(%i)	// Counter passed locally instead of using global variables.
{
	localMessage(getWord("retreat tgtacq", %i % 2));	// voice list is hard coded, using modulus of counter to cycle through the word list.
	schedule("if($retard) retard("@ %i++ @");", 0.19);	// Toggle check and counter incremented in the recursive scheduler, and the timing is fixed.
}
It just occured to me that different character voices have different audio durations for the same voice command... So thats probably why the timing was off...

I'm rewriting this to be a little more versatile, but it's going to take some research, because I need to come up with multiple phrases to test out to make sure it works, and I've gotta get the timing down right for each syllable...
Image
perrinoia
Site Admin
Posts: 3732
Joined: Sun Jul 01, 2012 7:18 pm

Re: LocalSpam

Post by perrinoia »

OK, I think I perfected it, now.

Code: Select all

EditActionMap("playMap.sae");
bindCommand(keyboard0, make, "numpad-", TO, "if($Toggle::VoiceSpam = !$Toggle::VoiceSpam) VoiceSpam(\"0 dsgst2 0.5 basetkn 0.25 retreat 0.2 tgtout 0.5 dsgst5 2\");");	// "You Our Re Target!" *sigh* -perrinoia

// Example: "VoiceSpam(\"<delay> <voice> <delay> <voice> <delay> <voice> <delay> <voice> <delay>\");" -perrinoia
function VoiceSpam(%arg)
{
	for(%num = 1; getWord(%arg, %num) != -1; %num += 2)
		schedule("localMessage(\""@ getWord(%arg, %num) @"\");", %sec += getWord(%arg, %num - 1));
	schedule("if($Toggle::VoiceSpam) VoiceSpam(\""@ %arg @"\");", %sec += getWord(%arg, %num - 1));
}
You must list the voice filenames and delay durations separated by spaces (starting and ending with delays).
The function waits for the delay, then plays the voice, then waits for the next delay, and plays the next voice, etc until the end of the sentence, at which point it waits for the final delay before repeating the whole process.
Image
User avatar
DaJ4ck3L
Crow{OZ}
Posts: 3375
Joined: Thu Jul 22, 2010 11:51 pm
Contact:

Re: LocalSpam

Post by DaJ4ck3L »

perrinoia wrote:OK, I think I perfected it, now.

Code: Select all

EditActionMap("playMap.sae");
bindCommand(keyboard0, make, "numpad-", TO, "if($Toggle::VoiceSpam = !$Toggle::VoiceSpam) VoiceSpam(\"0 dsgst2 0.5 basetkn 0.25 retreat 0.2 tgtout 0.5 dsgst5 2\");");	// "You Our Re Target!" *sigh* -perrinoia

// Example: "VoiceSpam(\"<delay> <voice> <delay> <voice> <delay> <voice> <delay> <voice> <delay>\");" -perrinoia
function VoiceSpam(%arg)
{
	for(%num = 1; getWord(%arg, %num) != -1; %num += 2)
		schedule("localMessage(\""@ getWord(%arg, %num) @"\");", %sec += getWord(%arg, %num - 1));
	schedule("if($Toggle::VoiceSpam) VoiceSpam(\""@ %arg @"\");", %sec += getWord(%arg, %num - 1));
}
You must list the voice filenames and delay durations separated by spaces (starting and ending with delays).
The function waits for the delay, then plays the voice, then waits for the next delay, and plays the next voice, etc until the end of the sentence, at which point it waits for the final delay before repeating the whole process.
for 1.4 id use this bind method, giving you the method to bind it in options

Code: Select all

function LocalRetardSpam::addBindsToMenu() after GameBinds::Init
{
	GameBinds::SetMapNoClearBinds( "playMap.sae" );
	GameBinds::addBindCommand( "Local Retard Spam", "if($Toggle::VoiceSpam = !$Toggle::VoiceSpam) VoiceSpam(\"0 dsgst2 0.5 basetkn 0.25 retreat 0.2 tgtout 0.5 dsgst5 2\" ); // "You Our Re Target!" *sigh* -perrinoia
}

// Example: "VoiceSpam(\"<delay> <voice> <delay> <voice> <delay> <voice> <delay> <voice> <delay>\");" -perrinoia
function VoiceSpam(%arg)
{
	for(%num = 1; getWord(%arg, %num) != -1; %num += 2)
		schedule("localMessage(\""@ getWord(%arg, %num) @"\");", %sec += getWord(%arg, %num - 1));
	schedule("if($Toggle::VoiceSpam) VoiceSpam(\""@ %arg @"\");", %sec += getWord(%arg, %num - 1));
}
Image
perrinoia
Site Admin
Posts: 3732
Joined: Sun Jul 01, 2012 7:18 pm

Re: LocalSpam

Post by perrinoia »

Image
Image
User avatar
Jegue
Posts: 345
Joined: Fri Dec 09, 2011 2:55 pm
Location: Sao Luis, Maranhao, Brazil

Re: LocalSpam

Post by Jegue »

whatever, that script isnt made by me anyways
- <!>Tariq^
Image
perrinoia
Site Admin
Posts: 3732
Joined: Sun Jul 01, 2012 7:18 pm

Re: LocalSpam

Post by perrinoia »

Yes, I see that it was made by "check"?

I've never heard of that player.

Anyways, you've got a better script to work with, now... If you want.
Image
User avatar
Jegue
Posts: 345
Joined: Fri Dec 09, 2011 2:55 pm
Location: Sao Luis, Maranhao, Brazil

Re: [Script] LocalSpam

Post by Jegue »

Set it to keep saying "retarded retarded" over and over plssss?
- <!>Tariq^
Image
Post Reply