Forums Index >> Modding >> TMO's Tank Toggler script



Page : <1> :



 

//Tanktoggler script by Master TMO
//Load this script into your main.cs file.
//this script will only work on servers that have the tankchanger code enabled, such as Dash's Modserver.
function handleMouseWheel(%val)
{
// Check if the wheel scrolled up or down
if( %val > 0 )
{
//scroll up
$TankSize = $TankSize++;
if ($TankSize > 5)
{
$TankSize = 1;
}
commandToServer('messageSent',$Tanks[$TankSize]); //Mwheel Up
} else {
//scroll down
$TankSize = $TankSize--;
if ($TankSize < 1)
{
$TankSize = 5;
}
commandToServer('messageSent',$Tanks[$TankSize]); //Mwheel Down
}
}

$TankSize = "2"; //set to whatever type of tank you normally use
$Tanks[1] = "/ufo";
$Tanks[2] = "/light";
$Tanks[3] = "/med";
$Tanks[4] = "/heavy";
$Tanks[5] = "/boss";

MoveMap.bind(mouse, zaxis, handleMouseWheel);

 

 

Last edited: Tuesday, November 09, 2004 at 1:43:09 AM

Tuesday, November 09, 2004 at 1:21:38 AM

Rather obviously, it will also only work if you have a scrollwheel on your mouse. XD

Tuesday, November 09, 2004 at 1:22:43 AM

Very nice!

Tuesday, November 09, 2004 at 11:53:58 AM

NICE WORK!! Hey I've updated my version so I can enable/disable the changers by right clicking and it wont go through all the tanks as fast as the light.
It will wait 0,2 seconds till it changes again the tank. If you want I could post it (don't forget u get 90% of the credit! I didnt know how to get that scrollwheel working with TT!!)
Else I could just send it to you
Oh well I must say again, CONGRATS for the work!

PS: How many time did it take to find that out?


Last edited: Tuesday, November 09, 2004 at 1:18:20 PM

Tuesday, November 09, 2004 at 12:28:43 PM

It really only took me a day or so to finally get the script working the way I wanted. The hardest part was determining the code for the wheel. Many Google/Yahoo searches were needed before I finally found a page that gave me what I needed. XD

I use my right mouse button for other tasks, but it might not be a bad idea to assign the enable/disable to clicking the mousewheel. Although I personally don't have any problems with accidentally scrolling while playing.

 

//Tanktoggler script by Master TMO
//Load this script into your main.cs file.
//this script will only work on servers that have the tankchanger code enabled, such as Dash's Modserver.
function TankChgControl(%val)
{
if($TankChg==0)
{
$TankChg=1;
MoveMap.bind(mouse, zaxis, handleMouseWheel);
} else {
$TankChg=0;
MoveMap.bind(mouse, zaxis, "");
}
}

Function handleMouseWheel(%val)
{
// Check if the wheel scrolled up or down
if( %val > 0 )
{
//scroll up
$TankSize = $TankSize++;
if ($TankSize > 5)
{
$TankSize = 1;
}
commandToServer('messageSent',$Tanks[$TankSize]); //Mwheel Up
} else {
//scroll down
$TankSize = $TankSize--;
if ($TankSize < 1)
{
$TankSize = 5;
}
commandToServer('messageSent',$Tanks[$TankSize]); //Mwheel Down
}
}

$TankSize = "2"; //set to whatever type of tank you normally use
$TankChg = 0; //0 = Disabled (default), 1 = Enabled
$Tanks[1] = "/ufo";
$Tanks[2] = "/light";
$Tanks[3] = "/med";
$Tanks[4] = "/heavy";
$Tanks[5] = "/boss";

MoveMap.bind(mouse. Button2, TankChgControl);

 

That's off the top of my head. I'll check it tonight, but I think it should work.

Tuesday, November 09, 2004 at 2:30:07 PM

I know but I tried button 2 and it stopped working lol

Use my version (working completly):

 

//Tanktoggler script by Master TMO ------ Upgraded by ArtCrazy
//Load this script into your main.cs file.
//this script will only work on servers that have the tankchanger code enabled, such as Dash's Modserver.
function handleMouseWheel(%val)
{
if($tankchangerenabled)
{
// Check if the wheel scrolled up or down
if( %val > 0 )
{
//scroll up
$TankSize = $TankSize++;
if ($TankSize > 5)
{
$TankSize = 1;
}
commandToServer('messageSent',$Tanks[$TankSize]); //Mwheel Up
}
else
{
//scroll down
$TankSize = $TankSize--;
if ($TankSize < 1)
{
$TankSize = 5;
}
commandToServer('messageSent',$Tanks[$TankSize]); //Mwheel Down
}
$tankchangerenabled = false;
schedule(200,false,"enablechanger");
}
else
{

}
}

$TankSize = "2"; //set to whatever type of tank you normally use
$Tanks[1] = "/ufo";
$Tanks[2] = "/light";
$Tanks[3] = "/med";
$Tanks[4] = "/heavy";
$Tanks[5] = "/boss";

MoveMap.bind(mouse, zaxis, handleMouseWheel);
moveMap.bind(mouse, button1, enablechanger);

Function enablechanger()
{
$tankchangerenabled = true;
}

 

 


Last edited: Tuesday, November 09, 2004 at 5:05:59 PM

Tuesday, November 09, 2004 at 5:01:45 PM

I'll take a look at it and see if I can't work out a compromise. I do like your version a bit better, just setting the variable rather than mapping and remapping the scrollwheel.

Tuesday, November 09, 2004 at 6:26:41 PM

Where do you put it? I dought that I will get a response though :[

 

Thursday, June 08, 2006 at 1:07:03 PM

1. Learn to spell
2. Main.cs
3. Why am I telling you this?

Thursday, June 08, 2006 at 1:18:55 PM

4. Dont bump old topics... This is old as... My grandmother?


Thursday, June 08, 2006 at 2:12:18 PM

It's a cool script though, I think I'll try it :P

Friday, June 09, 2006 at 4:29:55 AM

It work in shockwave?

my blaster will destroy u!

Friday, June 09, 2006 at 2:50:42 PM

Probaly...try it and find out! %)

 

Friday, June 09, 2006 at 4:58:22 PM

It only works on servers with the Tank Toggle codes enabled.

Friday, June 09, 2006 at 8:12:03 PM

Well..... All u should have to do is /light /med /heavy /ufo /boss and not be lazy.

my blaster will destroy u!

Saturday, June 10, 2006 at 2:51:28 AM

Page : <1> :

insert quote insert url insert email insert image bold italic underline superscript subscript horizontal rule : : Help on using forum codes

Add comment:

HTML is disabled within comments, but ZBB Code is enabled.

Back to the top

Web site designed, maintained and funded by -z- and Dan MacDonald