Helper Script

OK, so using the new comands "disable" i made a quick little scipt thing that you can just paste onto the top of your script. I think i may have added a few extra "{}"'s and "return"'s. So do help me modify it! ...please.

How to use it:
Once run it will prompt you to set values for int(s). If you place the value of it at "1" it will dissable the said action. (ie. define int eat. 1. disable eat)

Code:
void main(int eat, int use, int buy, int drink)
{
	if(eat = 1)
	{
		cli_execute("disable eat");
		return;
	}
	if(use = 1)
	{
		cli_execute("disable use");
		return;
	}
	if(buy = 1)
		cli_execute("disable buy");
		return;
	}
	if(drink = 1)
	{
		cli_execute("disable drink");
		return;
	}
}

Have fun!
I keep getting an error that states
Code:
")" expected at line 3.

Or something of the sort. Any ideas?

Also is it possible to define variables with letters? (ie. "y" and "n")

Also i modified the code to
Code:
void main(int eat, int use, int buy, int drink)
{
	if( eat => 0 );
	{
		cli_execute("disable eat");
	}
	if( use => 0 );
	{
		cli_execute("disable use");
	}
	if( buy => 1 );
		cli_execute("disable buy");
	}
	if( drink => 1 );
	{
		cli_execute("disable drink");
		return;
	}
}
 
Code:
void main(int eat, int use, int buy, int drink)
{
	if( eat => 0 )
	{
		cli_execute("disable eat");
	}
	if( use => 0 )
	{
		cli_execute("disable use");
	}
	if( buy => 1 )
		cli_execute("disable buy");
	}
	if( drink => 1 )
	{
		cli_execute("disable drink");
		return;
	}
}

Better?
 

Nightmist

Member
You sort of need to use "==" when your trying to use a "=" (Debug says it expects a ")" but its really since "=" doesn't actually work.)

And when your using "=> 0", that means we need to insert a negative number to not disable it? Why not make it also "=> 1" so its just a simple 0 to keep it enabled?

PS. Your missing a "{" after the if buy.
 
Code:
void main(int eat, int use, int buy, int drink)
{
	if( eat == 0 )
	{
		cli_execute("disable eat");
	}
	if( use == 0 )
	{
		cli_execute("disable use");
	}
	if( buy == 1 )
    {
        cli_execute("disable buy");
	}
	if( drink == 1 )
	{
		cli_execute("disable drink");
		return;
	}
}

Better now?
 

Nightmist

Member
If your going to use == then change the number to needs to equal to the same for each disable. Easier to remember "All 1 to disable all and all 0 to enable" rather than "The first 2 are 0 to disable and then the next 2 are 1 to disable".
 
Code:
void main(int eat, int use, int buy, int drink)
{
	if( eat == 0 )
	{
		cli_execute("disable eat");
    else
        cli_execute("enable eat");
	}
	if( use == 0 )
	{
		cli_execute("disable use");
    else
        cli_execute("enable use");
	}
	if( buy == 0 )
    {
        cli_execute("disable buy");
    else
        cli_execute("enable buy");
	}
	if( drink == 0 )
	{
		cli_execute("disable drink");
    else
        cli_execute("enable drink");
		return;
	}
}

Now?

This time it is setup to if it =0 it is disabled if it is anything else it is enabled!
 

Nightmist

Member
If your going to use "else" while using "{" and "}"
Code:
if( condition)
{
}
else
{
}

Edit: But if your sticking it in void main, doesn't that make it automatically assume enabled unless told otherwise? Or do the disable settings carry on even after the scripts ended?
 

Nightmist

Member
Uhh in the last example, by your "else" stick a "}" before it and a "{" after it.

PS. Whats the return for? (in the drink one)
 
NOW? ;D

Code:
void main(int eat, int use, int buy, int drink)
{
	if( eat == 0 )
	{
		cli_execute("disable eat");
    }
    else
    {
        cli_execute("enable eat");
	}
	if( use == 0 )
	{
		cli_execute("disable use");
     }
    else
     {
        cli_execute("enable use");
	}
	if( buy == 0 )
    {
        cli_execute("disable buy");
    }
    else
    {
        cli_execute("enable buy");
	}
	if( drink == 0 )
	{
		cli_execute("disable drink");
    }
    else
    {
        cli_execute("enable drink");
	}
}
 
Not sure... I think that the settings stay until the session is closed (just like if you manually type into the gCli disable ___)
 

Nightmist

Member
Hmm true if it can be used directly from the GCLI it's probably session based (I doubt it would be "permanent setting until enabled manually" since that would end up with a heap of bug reports saying "x function" isn't working when they happened to disable it a few days ago and forgot... but then thats just a guess.)
 
Top