[Script] Weapons hud

User avatar
DaJ4ck3L
Crow{OZ}
Posts: 3375
Joined: Thu Jul 22, 2010 11:51 pm
Contact:

[Script] Weapons hud

Post by DaJ4ck3L »

it's telling me this, and im not seeing it. what am i missing?
Executing Modules/ScriptGL/vWeaponHud.acs.cs.
Modules/ScriptGL/vWeaponHud.acs.cs Line: 85 - syntax error, unexpected ')', expecting ',' or ']'
this is line 85.

Code: Select all

     if(GetItemdesc(GetMountedItem(0)) == "Grappling Hook") //  "target
this is the whole function.

Code: Select all

function vhud::WeaponHud::onrender()
{
	if(!Control::getVisible("ScriptGL::vWeaponHud"))
		return;

	if($Scriptgl::CurrentGui != "playGui")
		return;
	
	%pos = Control::getPosition("ScriptGL::vWeaponHud");
	%x = getWord(%pos, 0);
	%y = getWord(%pos, 1);
	
	glSetFont( "Jet Set", 16, 0, 9 );

	if($ServerMod == "Annihilation")
	{
		if(GetItemdesc(GetMountedItem(0)) == "Targeting Laser") //dont think i ever defined this one. neat.
			WeaponHud::Draw(%x + 0,%y, $WeaponHud::Texture["target"], "~");
	
		//if(GetItemdesc(GetMountedItem(0)) == "Disc Launcher")
		//	WeaponHud::Draw(%x + 0,%y, $WeaponHud::Texture["disc"], GetItemCount("Disc"));
		//
		//if(GetItemdesc(GetMountedItem(0)) == "Grenade Launcher")
		//	WeaponHud::Draw(%x + 0,%y, $WeaponHud::Texture["grenade"], GetItemCount("Grenade Ammo"));
		//
		//if(GetItemdesc(GetMountedItem(0)) == "Chaingun")
		//	WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["chaingun"], GetItemCount("Bullet"));
		//
		//if(GetItemdesc(GetMountedItem(0)) == "Laser Rifle")
		//	WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sniper"], "~");
		//
		//if(GetItemdesc(GetMountedItem(0)) == "Mortar")
		//	WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Mortar Ammo"));
		//
		//if(GetItemdesc(GetMountedItem(0)) == "Blaster")
		//	WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["blaster"], "~");
		//
		//if(GetItemdesc(GetMountedItem(0)) == "ELF Gun")
		//	WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], "~");
		//
		//if(GetItemdesc(GetMountedItem(0)) == "Plasma Gun")
		//	WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasma"], GetItemCount("Plasma Bolt"));
			
		//Weapons
		if(GetItemdesc(GetMountedItem(0)) == "Grenade Launcher X") // , "grenade", "Grenade Ammo X
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("Grenade Ammo X"));

		if(GetItemdesc(GetMountedItem(0)) == "Plasma Gun X") //  "plasma") //  "PlasmaBolt X
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasma"], GetItemCount("PlasmaBolt X"));

		if(GetItemdesc(GetMountedItem(0)) == "Disc Launcher X") //  "disc") //  "Disc X
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["disc"], GetItemCount("Disc X"));//shiat wish i freaking changed the weapon name now lol
		
	//New Arena Guns
		if(GetItemdesc(GetMountedItem(0)) == "Plasma Gun Elite") //  "plasma") //  "PlasmaBolt Elite
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasma"], GetItemCount("PlasmaBolt Elite"));

		if(GetItemdesc(GetMountedItem(0)) == "Disc Launcher Elite") //  "disc") //  "Disc Elite
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["disc"], GetItemCount("Disc Elite"));

		if(GetItemdesc(GetMountedItem(0)) == "Plasma Gun Base") //  "plasma") //  "PlasmaBolt Base
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasma"], GetItemCount("PlasmaBolt Base"));

		if(GetItemdesc(GetMountedItem(0)) == "Disc Launcher Base") //  "disc") //  "Disc Base
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["disc"], GetItemCount("Disc Base"));

	//end
		if(GetItemdesc(GetMountedItem(0)) == "Plasma Gun") //  "plasma") //  "PlasmaBolt
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasma"], GetItemCount("PlasmaBolt"));

		if(GetItemdesc(GetMountedItem(0)) == "Grappling Hook") //  "target
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["target"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Buckler") //  "shieldimgx
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["shieldimg"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "X72 Gravity Gun") //  "target
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["target"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Builder Gun") //  "mortar
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Blaster") // "blaster
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["blaster"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "ChainGun") //  "chaingun") //  "Bullet
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["chaingun"], GetItemCount("Bullet"));

		if(GetItemdesc(GetMountedItem(0)) == "Disc Launcher") //  "disc") //  "Disc
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["disc"], GetItemCount("Disc"));

		if(GetItemdesc(GetMountedItem(0)) == "Elf Gun") //  "elf
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Grenade Launcher") //  "grenade") //  "Grenade Ammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("Grenade Ammo"));

		if(GetItemdesc(GetMountedItem(0)) == "Laser Rifle") //  "sniper
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sniper"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Minigun") //  "minigun
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["chaingun"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Thumper") //  "thumper") //  "Thumper Ammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["thumper"], GetItemCount("Thumper Ammo"));

		if(GetItemdesc(GetMountedItem(0)) == "Mortar") //  "mortar") //  "Mortar Ammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Mortar Ammo"));

		if(GetItemdesc(GetMountedItem(0)) == "Angel Fire") //  "energyshot
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["energyshot"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Bio Feedback Beam") //  "target
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["target/."));

		if(GetItemdesc(GetMountedItem(0)) == "Baby Nuke Launcher") //  "mortar") //  "Nuclear Device
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Nuclear Device"));

		if(GetItemdesc(GetMountedItem(0)) == "Cutting Laser") //  "blaster
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["target"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Builder Repair-Gun") //  "repairpack
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["repairpack"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Flamer") //  "elf") //  "FlamerAmmo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], GetItemCount("FlamerAmmo"));

		if(GetItemdesc(GetMountedItem(0)) == "Flame Thrower") //  "mortarammo") //  "Flame Cartridges
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortarammo"], GetItemCount("Flame Cartridges"));

		if(GetItemdesc(GetMountedItem(0)) == "Mini Bomber") //  "grenade") //  "Mini Ammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("Mini Ammo"));

		if(GetItemdesc(GetMountedItem(0)) == "Lucifers Hammer") //  "mortarammo") //  "Hammer Ammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortarammo"], GetItemCount("Hammer Ammo"));

		if(GetItemdesc(GetMountedItem(0)) == "Hyper Spinfusor") //  "disc") //  "Hyper Disc
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["disc"], GetItemCount("Hyper Disc"));

		if(GetItemdesc(GetMountedItem(0)) == "Heavens Gate") //  "target
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["target"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Heaven's Fury") //  "elf
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Jailers Gun") //  "elf
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], "~");
 //Clay Pigeon Launcher
		if(GetItemdesc(GetMountedItem(0)) == "Clay Pigeon Launcher") //  "grenade") //  "ClayPigeon Can
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("ClayPigeon Can"));
 //new/old gun doh -DaJ4ck3L
		if(GetItemdesc(GetMountedItem(0)) == "OS Launcher") //  "grenade") //  "OS Rockets
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("OS Rockets"));

		if(GetItemdesc(GetMountedItem(0)) == "OS Laucher") //  "grenade") //  "OS Rockets
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("OS Rockets"));
 //lol wonder who miss spelled this -DaJ4ck3L
		if(GetItemdesc(GetMountedItem(0)) == "Particle Beam") //  "sexypbeam
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sexypbeam"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Phase Disrupter") //  "blaster") //  "Disrupter Ammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["blaster"], GetItemCount("Disrupter Ammo"));

		if(GetItemdesc(GetMountedItem(0)) == "Pitchfork") //  "mortar
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Railgun") //  "sniper") //  "Railgun Bolt
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sniper"], GetItemCount("Railgun Bolt"));

		if(GetItemdesc(GetMountedItem(0)) == "Rocket Launcher") //  "mortar") //  "Rockets
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Rockets"));

		if(GetItemdesc(GetMountedItem(0)) == "Rocket Pod") //  "mortar") //  "Pod Rockets
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Pod Rockets"));

		if(GetItemdesc(GetMountedItem(0)) == "Rubbery Mortar") //  "mortar") //  "R Mortar Ammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("R Mortar Ammo"));

		if(GetItemdesc(GetMountedItem(0)) == "Shockwave Cannon") //  "elf
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Shotgun") //  "elf") //  "Shotgun Shells
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], GetItemCount("Shotgun Shells"));

		if(GetItemdesc(GetMountedItem(0)) == "Sniper Rifle") //  "sniper") //   "Sniper Ammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sniper"], GetItemCount("Sniper Ammo"));

		if(GetItemdesc(GetMountedItem(0)) == "Soul Grabber") //  "mortarammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortarammo"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Spell: Death Ray") //  "plasmaturret
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasmaturret"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Spell: Disarm") //  "mortartrail
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortartrail"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Spell: Flame Strike") //  "plasmaammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasmaammo"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Spell: Flame Thrower") //  "plasmaammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasmaammo"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Spell: Shocking Grasp") //  "plant
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plant"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Spell: Stasis") //  "energyshot
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["energyshot"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Stinger Missle") //  "grenade") //  "Stinger Ammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("Stinger Ammo"));

		if(GetItemdesc(GetMountedItem(0)) == "Tank Blast Cannon") //  "mortar") //  "Blast Cannon Shots
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Blast Cannon Shots"));

		if(GetItemdesc(GetMountedItem(0)) == "Tank Rocketgun") //  "mortar") //  "TRocketLauncher Ammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("TRocketLauncher Ammo"));

		if(GetItemdesc(GetMountedItem(0)) == "Tank RPG") //  "mortar") //  "RPG Ammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("RPG Ammo"));

		if(GetItemdesc(GetMountedItem(0)) == "Tank Shredder") //  "chaingun") //  "Tank Shredder Ammo
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["chaingun"], GetItemCount("Tank Shredder Ammo"));

		if(GetItemdesc(GetMountedItem(0)) == "Vulcan") //  "chaingun") //  "Vulcan Bullet
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["chaingun"], GetItemCount("Vulcan Bullet"));

		if(GetItemdesc(GetMountedItem(0)) == "Slapper") //  "sniper
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sniper"], "~");

		if(GetItemdesc(GetMountedItem(0)) == "Energy Blade") //  "energyshot
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["energyshot"], "~");

	}
	
	if($ServerMod == "base")
	{
		if(GetItemdesc(GetMountedItem(0)) == "Targeting Laser") 
			WeaponHud::Draw(%x + 0,%y, $WeaponHud::Texture["target"], "~");
	
		if(GetItemdesc(GetMountedItem(0)) == "Disc Launcher")
			WeaponHud::Draw(%x + 0,%y, $WeaponHud::Texture["disc"], GetItemCount("Disc"));
		
		if(GetItemdesc(GetMountedItem(0)) == "Grenade Launcher")
			WeaponHud::Draw(%x + 0,%y, $WeaponHud::Texture["grenade"], GetItemCount("Grenade Ammo"));
		
		if(GetItemdesc(GetMountedItem(0)) == "Chaingun")
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["chaingun"], GetItemCount("Bullet"));
		
		if(GetItemdesc(GetMountedItem(0)) == "Laser Rifle")
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sniper"], "~");
		
		if(GetItemdesc(GetMountedItem(0)) == "Mortar")
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Mortar Ammo"));
		
		if(GetItemdesc(GetMountedItem(0)) == "Blaster")
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["blaster"], "~");
		
		if(GetItemdesc(GetMountedItem(0)) == "ELF Gun")
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], "~");
		
		if(GetItemdesc(GetMountedItem(0)) == "Plasma Gun")
			WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasma"], GetItemCount("Plasma Bolt"));
	}
}
Image
perrinoia
Site Admin
Posts: 3732
Joined: Sun Jul 01, 2012 7:18 pm

Re: [Script] Weapons hud

Post by perrinoia »

Code: Select all

WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["target/."));
There's your syntax error, right after "Bio Feedback Beam"

PS: GetItemdesc(GetMountedItem(0)) is called 70 something times... Your script would run more efficiently if you replace all instances of that with a variable, and put that code once in the top of the function.

For instance:

Code: Select all

function vhud::WeaponHud::onrender()
{
   if(!Control::getVisible("ScriptGL::vWeaponHud"))
      return;

   if($Scriptgl::CurrentGui != "playGui")
      return;
   
   %pos = Control::getPosition("ScriptGL::vWeaponHud");
   %x = getWord(%pos, 0);
   %y = getWord(%pos, 1);
   %w = GetItemdesc(GetMountedItem(0));
   glSetFont( "Jet Set", 16, 0, 9 );

   if(0 < String::findSubStr($ServerMod, "nnihilation"))	// == "Annihilation") will not work with classic "annihilation base" (v1.x) 
   {
      if(%w == "Targeting Laser") //dont think i ever defined this one. neat.
         WeaponHud::Draw(%x + 0,%y, $WeaponHud::Texture["target"], "~");
      if(%w == "Grenade Launcher X") // , "grenade", "Grenade Ammo X
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("Grenade Ammo X"));
      if(%w == "Plasma Gun X") //  "plasma") //  "PlasmaBolt X
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasma"], GetItemCount("PlasmaBolt X"));
      if(%w == "Disc Launcher X") //  "disc") //  "Disc X
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["disc"], GetItemCount("Disc X"));//shiat wish i freaking changed the weapon name now lol
      if(%w == "Plasma Gun Elite") //  "plasma") //  "PlasmaBolt Elite
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasma"], GetItemCount("PlasmaBolt Elite"));
      if(%w == "Disc Launcher Elite") //  "disc") //  "Disc Elite
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["disc"], GetItemCount("Disc Elite"));
      if(%w == "Plasma Gun Base") //  "plasma") //  "PlasmaBolt Base
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasma"], GetItemCount("PlasmaBolt Base"));
      if(%w == "Disc Launcher Base") //  "disc") //  "Disc Base
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["disc"], GetItemCount("Disc Base"));
      if(%w == "Plasma Gun") //  "plasma") //  "PlasmaBolt
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasma"], GetItemCount("PlasmaBolt"));
      if(%w == "Grappling Hook") //  "target
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["target"], "~");
      if(%w == "Buckler") //  "shieldimgx
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["shieldimg"], "~");
      if(%w == "X72 Gravity Gun") //  "target
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["target"], "~");
      if(%w == "Builder Gun") //  "mortar
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], "~");
      if(%w == "Blaster") // "blaster
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["blaster"], "~");
      if(%w == "ChainGun") //  "chaingun") //  "Bullet
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["chaingun"], GetItemCount("Bullet"));
      if(%w == "Disc Launcher") //  "disc") //  "Disc
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["disc"], GetItemCount("Disc"));
      if(%w == "Elf Gun") //  "elf
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], "~");
      if(%w == "Grenade Launcher") //  "grenade") //  "Grenade Ammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("Grenade Ammo"));
      if(%w == "Laser Rifle") //  "sniper
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sniper"], "~");
      if(%w == "Minigun") //  "minigun
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["chaingun"], "~");
      if(%w == "Thumper") //  "thumper") //  "Thumper Ammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["thumper"], GetItemCount("Thumper Ammo"));
      if(%w == "Mortar") //  "mortar") //  "Mortar Ammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Mortar Ammo"));
      if(%w == "Angel Fire") //  "energyshot
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["energyshot"], "~");
      if(%w == "Bio Feedback Beam") //  "target
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["target"], "~");
      if(%w == "Baby Nuke Launcher") //  "mortar") //  "Nuclear Device
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Nuclear Device"));
      if(%w == "Cutting Laser") //  "blaster
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["target"], "~");
      if(%w == "Builder Repair-Gun") //  "repairpack
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["repairpack"], "~");
      if(%w == "Flamer") //  "elf") //  "FlamerAmmo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], GetItemCount("FlamerAmmo"));
      if(%w == "Flame Thrower") //  "mortarammo") //  "Flame Cartridges
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortarammo"], GetItemCount("Flame Cartridges"));
      if(%w == "Mini Bomber") //  "grenade") //  "Mini Ammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("Mini Ammo"));
      if(%w == "Lucifers Hammer") //  "mortarammo") //  "Hammer Ammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortarammo"], GetItemCount("Hammer Ammo"));
      if(%w == "Hyper Spinfusor") //  "disc") //  "Hyper Disc
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["disc"], GetItemCount("Hyper Disc"));
      if(%w == "Heavens Gate") //  "target
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["target"], "~");
      if(%w == "Heaven's Fury") //  "elf
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], "~");
      if(%w == "Jailers Gun") //  "elf
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], "~");
      if(%w == "Clay Pigeon Launcher") //  "grenade") //  "ClayPigeon Can
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("ClayPigeon Can"));
      if(%w == "OS Launcher") //  "grenade") //  "OS Rockets
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("OS Rockets"));
      if(%w == "OS Laucher") //  "grenade") //  "OS Rockets
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("OS Rockets"));
      if(%w == "Particle Beam") //  "sexypbeam
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sexypbeam"], "~");
      if(%w == "Phase Disrupter") //  "blaster") //  "Disrupter Ammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["blaster"], GetItemCount("Disrupter Ammo"));
      if(%w == "Pitchfork") //  "mortar
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], "~");
      if(%w == "Railgun") //  "sniper") //  "Railgun Bolt
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sniper"], GetItemCount("Railgun Bolt"));
      if(%w == "Rocket Launcher") //  "mortar") //  "Rockets
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Rockets"));
      if(%w == "Rocket Pod") //  "mortar") //  "Pod Rockets
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Pod Rockets"));
      if(%w == "Rubbery Mortar") //  "mortar") //  "R Mortar Ammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("R Mortar Ammo"));
      if(%w == "Shockwave Cannon") //  "elf
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], "~");
      if(%w == "Shotgun") //  "elf") //  "Shotgun Shells
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], GetItemCount("Shotgun Shells"));
      if(%w == "Sniper Rifle") //  "sniper") //   "Sniper Ammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sniper"], GetItemCount("Sniper Ammo"));
      if(%w == "Soul Grabber") //  "mortarammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortarammo"], "~");
      if(%w == "Spell: Death Ray") //  "plasmaturret
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasmaturret"], "~");
      if(%w == "Spell: Disarm") //  "mortartrail
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortartrail"], "~");
      if(%w == "Spell: Flame Strike") //  "plasmaammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasmaammo"], "~");
      if(%w == "Spell: Flame Thrower") //  "plasmaammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasmaammo"], "~");
      if(%w == "Spell: Shocking Grasp") //  "plant
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plant"], "~");
      if(%w == "Spell: Stasis") //  "energyshot
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["energyshot"], "~");
      if(%w == "Stinger Missle") //  "grenade") //  "Stinger Ammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["grenade"], GetItemCount("Stinger Ammo"));
      if(%w == "Tank Blast Cannon") //  "mortar") //  "Blast Cannon Shots
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Blast Cannon Shots"));
      if(%w == "Tank Rocketgun") //  "mortar") //  "TRocketLauncher Ammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("TRocketLauncher Ammo"));
      if(%w == "Tank RPG") //  "mortar") //  "RPG Ammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("RPG Ammo"));
      if(%w == "Tank Shredder") //  "chaingun") //  "Tank Shredder Ammo
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["chaingun"], GetItemCount("Tank Shredder Ammo"));
      if(%w == "Vulcan") //  "chaingun") //  "Vulcan Bullet
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["chaingun"], GetItemCount("Vulcan Bullet"));
      if(%w == "Slapper") //  "sniper
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sniper"], "~");
      if(%w == "Energy Blade") //  "energyshot
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["energyshot"], "~");
   }
   else //if($ServerMod == "base") Use base weapon huds for any other mod.
   {
      if(%w == "Targeting Laser") 
         WeaponHud::Draw(%x + 0,%y, $WeaponHud::Texture["target"], "~");
      if(%w == "Disc Launcher")
         WeaponHud::Draw(%x + 0,%y, $WeaponHud::Texture["disc"], GetItemCount("Disc"));
      if(%w == "Grenade Launcher")
         WeaponHud::Draw(%x + 0,%y, $WeaponHud::Texture["grenade"], GetItemCount("Grenade Ammo"));
      if(%w == "Chaingun")
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["chaingun"], GetItemCount("Bullet"));
      if(%w == "Laser Rifle")
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["sniper"], "~");
      if(%w == "Mortar")
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["mortar"], GetItemCount("Mortar Ammo"));
      if(%w == "Blaster")
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["blaster"], "~");
      if(%w == "ELF Gun")
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["elf"], "~");
      if(%w == "Plasma Gun")
         WeaponHud::Draw(%x + 0,%y + 0, $WeaponHud::Texture["plasma"], GetItemCount("Plasma Bolt"));
   }
}
Image
Groove
Posts: 218
Joined: Thu Apr 17, 2014 10:36 pm

Re: [Script] Weapons hud

Post by Groove »

thanks for workin' on this guys, there's so many weaps in other mods i could never bring myself to do this :P

p.s. is there really any more overhead checking the value of %w rather than the result of the getmounteditem? is checking a var all that different from getting the result of a command? i thought a var would be checked with the eval command so its a function too, dont really understand the difference
User avatar
DaJ4ck3L
Crow{OZ}
Posts: 3375
Joined: Thu Jul 22, 2010 11:51 pm
Contact:

Re: [Script] Weapons hud

Post by DaJ4ck3L »

it wont make the script run smoother, as it still has to eval for each check, but it makes it look more simple.

also keeping the

Code: Select all

if($ServerMod == "Annihilation")

if($ServerMod == "base")
is how i like to do it. because i dont like broken scripts, and if u enter another mod, then it breaks. this way i just disable it all together for mods that dont have support for it. also, not all anni mods are the same.

normally when i play off beat mods ill just able the stock weapons hud.
Image
Groove
Posts: 218
Joined: Thu Apr 17, 2014 10:36 pm

Re: [Script] Weapons hud

Post by Groove »

hey while i've got u smart coders here

i found this old 'fonted.exe' .pft font editor - looks different from pftedit.exe, seems to have more functions maybe even importing windows fonts??

but to get it to run i had to put it it win98 and even then it seems to crash whenever i click any buttons

anyone smart enough to make it work?

Image

http://iateyourbaby.com/twdemos/Groove/tools/fonted.zip
perrinoia
Site Admin
Posts: 3732
Joined: Sun Jul 01, 2012 7:18 pm

Re: [Script] Weapons hud

Post by perrinoia »

DaJ4ck3L wrote:it wont make the script run smoother, as it still has to eval for each check, but it makes it look more simple.
No, each time the command is repeated, the function is called, the processes are processed, etc.. By storing the information in a variable, your script will run better. However, to make it even more efficient, you could use a variable array. Screw it, I'm gonna rewrite this script when I get home...
DaJ4ck3L wrote:also keeping the

Code: Select all

if($ServerMod == "Annihilation")

if($ServerMod == "base")
is how i like to do it. because i dont like broken scripts, and if u enter another mod, then it breaks. this way i just disable it all together for mods that dont have support for it. also, not all anni mods are the same.

normally when i play off beat mods ill just able the stock weapons hud.
That's a good point, however, you should modify the script so it automatically enables the basic weapon hud for unrecognized mods.

For instance, if annihilation do this, ELSE if base, do that, ELSE do basic shit.
Image
Groove
Posts: 218
Joined: Thu Apr 17, 2014 10:36 pm

Re: [Script] Weapons hud

Post by Groove »

with 1.40 u can also do switch (%w) and have a default case setting c++ styles
perrinoia
Site Admin
Posts: 3732
Joined: Sun Jul 01, 2012 7:18 pm

Re: [Script] Weapons hud

Post by perrinoia »

Oh yeah, I forgot about switch cases.
Image
User avatar
DaJ4ck3L
Crow{OZ}
Posts: 3375
Joined: Thu Jul 22, 2010 11:51 pm
Contact:

Re: [Script] Weapons hud

Post by DaJ4ck3L »

perrinoia wrote:However, to make it even more efficient, you could use a variable array.
i thought about doing that, but i got lazy.

and old software can be such a bitch groove.
Image
perrinoia
Site Admin
Posts: 3732
Joined: Sun Jul 01, 2012 7:18 pm

Re: [Script] Weapons hud

Post by perrinoia »

I've figured out why this script isn't working on my installation.. I don't have the flipping images... LOL

Can you remind me the URL to download the latest version?

PS: My plan for rewriting the script, was to make a separate function per mod, and execute them based on which server mod you connect to. That way the variable array will take up as little memory as possible, and it will be most efficient using a variable array.

Not that the difference in efficiency will be noticeable to the human perception of time, but what'evs.

Edit: I found it at http://www.thelandofoz.net/downloads/TR ... 1.40/HUDs/

Reading through the scripts, I'm amazed it even works. Gonna rewrite the fuck out of this bitch.

First it loads a variable array in order of, well, whatever order you (or whoever) scripted it... Then it bubble sorts the array in order of item number, except the bubble sort function wasn't written properly, so its more like a plinko sort than a bubble sort.

Here's a better method:

Code: Select all

function WH::AddItem(%item, %file, %ammo)
{
	%i = getItemType(%item);
	if(%i < 0)
		return;
	
	$Weapon::name[%i] = %item;
	$Weapon::file[%i] = %file;
	$Weapon::ammo[%i] = %ammo;
}
PS: This is the full list of items in Annihilation BR, at the moment:
  • Type Desc
    0 Repair Kit
    1 Repair Patch
    2 Flag
    3 Arena Flag
    4 Race Flag
    5 Ammo
    6 Item
    7 Item
    8 Item
    9 Item
    10 Item
    11 Rogue Angel
    12 Chameleon Assassin
    13 Necromancer
    14 Warrior
    15 Builder
    16 Troll
    17 Tank
    18 Titan
    19 Commando
    20 Weapon
    21 Tool
    22 Angel Fire
    23 Bio Feedback Beam
    24 Nuclear Device
    25 Baby Nuke Launcher
    26 Item
    27 Blaster
    28 Bullet
    29 Chaingun
    30 Bullet
    31 Chaingun
    32 Cutting Laser
    33 Disc
    34 Disc Launcher
    35 Disc Base
    36 Disc Launcher Base
    37 Disc Elite
    38 Disc Launcher Elite
    39 Builder Repair-Gun
    40 Builder's Repair-Gun
    41 FlamerAmmo
    42 Flamer
    43 Flame Cartridges
    44 Flame Thrower
    45 Mini ammo
    46 Mini Bomber
    47 Grenade Ammo
    48 Grenade Launcher
    49 Hammer Ammo
    50 Lucifers Hammer
    51 Heaven's Fury
    52 Jailers Gun
    53 Mortar Ammo
    54 Mortar
    55 OS Rockets
    56 OS Laucher
    57 Particle Beam
    58 Item
    59 Item
    60 Item
    61 Item
    62 Disrupter Ammo
    63 Phase Disrupter
    64 Pitchfork
    65 Pitchfork
    66 PlasmaBolt
    67 Plasma Gun
    68 PlasmaBolt Base
    69 Plasma Gun Base
    70 Railgun Bolt
    71 Railgun
    72 Rockets
    73 Rocket Launcher
    74 Rocket Launcher
    75 Grappling Hook
    76 RopeCan
    77 R Mortar Ammo
    78 Rubbery Mortar
    79 Shockwave Cannon
    80 Sweeper
    81 Shotgun Shells
    82 Shotgun
    83 Laser Rifle
    84 Sniper Ammo
    85 Sniper Rifle
    86 Soul Grabber
    87 Item
    88 Item
    89 Item
    90 Spell: Death Ray
    91 Spell: Death Ray
    92 Spell: Disarm
    93 Spell: Flame Strike
    94 Spell: Flame Thrower
    95 Spell: Shocking Grasp
    96 Spell: Shocking Grasp
    97 Spell: Stasis
    98 Stinger Ammo
    99 Stinger Missle
    100 Blast Cannon Shots
    101 Tank Blast Cannon
    102 TRocketLauncher Ammo
    103 Tank Rocketgun
    104 Tank Rocketgun
    105 Tank Rocketgun
    106 Tank Rocketgun
    107 RPG Ammo
    108 Tank RPG
    109 Tank RPG
    110 Tank RPG
    111 Tank RPG
    112 Tank Shredder Ammo
    113 Tank Shredder
    114 Tank Shredder
    115 Tank Shredder
    116 Tank Shredder
    117 Targeting Laser
    118 Vulcan Bullet
    119 Vulcan
    120 Ejector
    121 Minigun
    122 Minigun2
    123 Minigun3
    124 Thumper ammo
    125 Thumper
    126 X72 Gravity Gun
    127 Backpack
    128 Ammo Pack
    129 Chameleon Pack
    130 Laptop
    131 Energy Pack
    132 Ghosting
    133 Ghost Pack
    134 gpack
    135 Ghost Pack
    136 Sensor Jammer Pack
    137 Nova Pack
    138 Phase Shifter
    139 Troll Pack
    140 Repair Gun
    141 Repair Pack
    142 Shield Pack
    143 StealthShield Pack
    144 Suicide DetPack
    145 Flame Turret
    146 Fusion Turret
    147 Ion Turret
    148 Irradiation Cannon
    149 Laser Turret
    150 Missile Turret
    151 Mortar Turret
    152 Neuro Basher
    153 Nuclear Turret
    154 Plasma Turret
    155 Shock Turret
    156 Vortex Turret
    157 Fighter
    158 Interceptor
    159 Bomber
    160 Transport
    161 Air Base
    162 Big Crate
    163 Blast Wall
    164 Deployable Bunker
    165 Camera
    166 Control Jammer
    167 Transport Vehicle
    168 Fighter Vehicle Pack
    169 Force Field
    170 Force Field Door
    171 Jail Tower
    172 Jump Pad
    173 Large Force Field
    174 Large Force Field Door
    175 Mobile Inventory
    176 Motion Sensor
    177 Plasma Floor
    178 Deployable Platform
    179 Portable Generator
    180 Inventory Station
    181 Portable Solar Panel
    182 Pulse Sensor
    183 Deployable Cat
    184 Sensor Jammer
    185 Teleport Pad
    186 Beacon
    187 Grenade
    188 Mine
    189 Flag
And This is the full list of items in Base (correction: my test mod):
  • Type Desc
    0 Weapon
    1 Tool
    2 Ammo
    3 Backpack
    4 Blaster
    5 Bullet
    6 Chaingun
    7 Disc
    8 Disc Launcher
    9 ELF Gun
    10 Grenade Ammo
    11 Grenade Launcher
    12 Laser Rifle
    13 Dart Gun
    14 Mortar Ammo
    15 Mortar
    16 Plasma Bolt
    17 Plasma Gun
    18 Repair Gun
    19 Targeting Laser
    20 Beacon
    21 Flag
    22 Race Flag
    23 Grenade
    24 Mine
    25 Repair Kit
    26 Repair Patch
    27 Light Armor
    28 Medium Armor
    29 Heavy Armor
    30 Ammo Pack
    31 Camera
    32 Ammo Station
    33 Inventory Station
    34 Sensor Jammer
    35 Energy Pack
    36 Motion Sensor
    37 Pulse Sensor
    38 Repair Pack
    39 Sensor Jammer Pack
    40 Shield Pack
    41 Turret
    42 HPC
    43 LPC
    44 Scout
PSS: Does anyone know how to create a hud with a rotating shapefile, like how the inventory station has a spinning item, or the main menu when you first launch tribes has the spinning Tribes logo at the bottom?
Last edited by perrinoia on Mon Feb 23, 2015 9:27 pm, edited 1 time in total.
Image
Post Reply