Page 1 of 1

NTSL Scripts

Posted: Fri May 09, 2014 10:42 am
by kosmos
A while back I saw a discussion about NTSL scripts and people were talking about how some of the wiki's scripts don't work anymore and such. I'd like to update them.
So someone said they would do a thread where they would go through which scripts work... but I've not seen the thread. Is it somewhere?

If no, maybe this could be the thread where everyone dumps their awesome scripts for helping out when being an AI / killing your target / goofing around / fucking up the round and other foolery.

Re: NTSL Scripts

Posted: Fri May 09, 2014 11:22 am
by Stickymayhem
I was part of this discussion. I wasn't going to post the thread until I'd had an oppurtunity to go through every known NTSL script on the wiki and the dump thread back on NTstation to see which still worked, along with the errors they gave back.

For now I can say that the advanced job script on the wiki doesn't work, and neither do the mutes. I'll keep working on it and post here when I'm done.

Re: NTSL Scripts

Posted: Fri May 09, 2014 5:42 pm
by kosmos
Stickymayhem wrote:For now I can say that the advanced job script on the wiki doesn't work, and neither do the mutes. I'll keep working on it and post here when I'm done.
Thanks, they are removed. Maybe I'll try to learn how these things work and test them out as well.

Re: NTSL Scripts

Posted: Fri May 09, 2014 6:20 pm
by AseaHeru
Did you atleast save an archived version? Some servers still use the old system as a secret...

Re: NTSL Scripts

Posted: Fri May 09, 2014 6:42 pm
by kosmos
AseaHeru wrote:Did you atleast save an archived version? Some servers still use the old system as a secret...
They are always available through View History on the NTSL Scipts -page. But sure, I can make an additional archive.

Re: NTSL Scripts

Posted: Sat May 10, 2014 5:43 pm
by Gun Hog
The scripts do not work because of the 'function inside a parameter' error.
Example:

Code: Select all

broadcast ( replace ( "I AM ROGUE", "ROGUE" , "HELP" ) );
This would throw an error, as the replace() function is inside broadcast(). To fix it, simply set the output of the functions to a variable, then use it instead.
Example:

Code: Select all

$holder = replace ( "AI ROGUE", "ROGUE", "HELP" );
broadcast ( $holder );
You do not need to simply purge the current scripts; Fix them instead!

Re: NTSL Scripts

Posted: Sun May 11, 2014 9:39 pm
by Cavoglave
Gun Hog wrote:The scripts do not work because of the 'function inside a parameter' error.
Example:

Code: Select all

broadcast ( replace ( "I AM ROGUE", "ROGUE" , "HELP" ) );
This would throw an error, as the replace() function is inside broadcast(). To fix it, simply set the output of the functions to a variable, then use it instead.
Example:

Code: Select all

$holder = replace ( "AI ROGUE", "ROGUE", "HELP" );
broadcast ( $holder );
You do not need to simply purge the current scripts; Fix them instead!
I don't understand why that's considered an error.
Why was it ever changed? What purpose does preventing function calls in arguments serve aside from slowing down development?
What's next, recursive functions being erroneous?

Re: NTSL Scripts

Posted: Mon May 12, 2014 12:23 am
by Gun Hog
It was done to reduce lag or some such thing. Anyway, that is how you get around it.

Re: NTSL Scripts

Posted: Mon May 12, 2014 5:42 am
by kosmos
Gun Hog wrote:You do not need to simply purge the current scripts; Fix them instead!
Shit. I tried, but can't figure out a situation like this in the Less Annoying Job Indicator script... Could you help out (or anyone who understands the code)? I cannot into code. The only ones reported not working thus far are "Less Annoying Job Indicator", "Selective Mute" and "Cleaner Selective Mute" scripts.

Re: NTSL Scripts

Posted: Mon May 12, 2014 6:05 am
by Gun Hog
I have repaired them for you. Here is the job one:

Code: Select all

def Initialize() {
$words = vector(
    "Assistant", "Assnt",
    "Captain", "Capt",
    "Head of Personnel", "HoP",
    "Bartender", "Bar",
    "Chef", "Chef",
    "Botanist", "Hydro",
    "Quartermaster", "QM",
    "Cargo Technician", "Cargo",
    "Shaft Miner", "Miner",
    "Clown", "Clown",
    "Mime", "Mime",
    "Janitor", "Jan-r",
    "Librarian", "Lib-n",
    "Lawyer", "Law",
    "Chaplain", "Chapl",
    "Chief Engineer", "CE",
    "Station Engineer", "Engi",
    "Atmospheric Technician", "Atmos",
    "Chief Medical Officer", "CMO",
    "Medical Doctor", "MD",
    "Chemist", "Chem",
    "Geneticist", "G-tic",
    "Virologist", "Viro",
    "Research Director", "RD",
    "Scientist", "Sci",
    "Roboticist", "Robo",
    "Head of Security", "HoS",
    "Warden", "Ward",
    "Detective", "D-tiv",
    "Security Officer", "Sec",
    "AI", "AI",
    "Cyborg", "Borg",
    "Personal AI", "pAI",
    );
    
    $index = 1;
  while($index <= length($words))
 {
	$key = at($words, $index);
	$value = at($words, $index+1);
  mem($key,$value);
  $index += 2;
 }
}

if(mem("initialized") != 1)
{
 Initialize();
 mem("initialized", 1);
}

$foo = "";

if(mem($job)) { $foo = mem($job); }
else { $foo = substr($job, 1, 6); }

if (!find($source, "Unknown") && $job != "No id" && !find($source, " (as ")) {
$source = $source + " (" + $foo + ")"; }
And here is the Cleaner Selective Mute one:

Code: Select all

//recursive implode function, takes a vector and
//combines each member into a string with a space to separate
//by perogi
def implode($vector)
{
	$str = at($vector, 1);
	remove($vector, $str);
	if(length($vector) > 0) 
	{
		$str += " ";
		$str += implode($vector);
	}
	return $str;
}
//mute and unmute function
//use: type /mute or /unmute then the name of the person exactly as it is spelled
//by perogi

$exp = explode($content, " ");

if($source == "YOUR NAME HERE") //only the name in this line can use script
{

	if(at($exp, 1) == "/mute")
	{
		remove($exp, "/mute");
		$name = implode($exp);
		$pass = 0;
		mem($name,$name);
	}
	
	if(at($exp,1) == "/unmute")
	{
		$pass = 0;
		remove($exp, "/unmute");
		$muteremove = implode($exp);
		mem($muteremove, 0);
	}
}
//checks if source is muted
//possible to get around mute by taking off ID and being unknown, hence why unknowns are all blocked
if($source == mem($source) || $source == "Unknown")
{
	$pass = 0;
}
I am not touching the Selective Mute one, as that thing is a beast, and we have a mute script already.

Re: NTSL Scripts

Posted: Wed May 21, 2014 12:04 am
by paprika
I wonder if there's a way to put that job one in there by default. It really shouldn't not be in NTSL every round.