How best to resolve scripts that cause issues with reticles?

Howdy all !!!! 🙂

I recently got a new server-side weapon to work with clients. However, FrostyAutoRepair.cs & hiderifle.cs cause the added weapon's reticle to be invisible when the 2 scripts are loaded. I load them last, and the issue is still there.

Here is Frosty's code:

// #autoload

// #name = FrostyAutoRepair

// #version = 1.1B

// #date = December 03, 2001

// #author = Frosty

// #email = [email protected]

// #description = Automatically starts repairing object on Repairgun mount, stops repairing and mounts previous weapon when done

// #credit = Halide, helped me fix some bugs and clean up code

// #status = Working


if(!isObject(FrostyAR))

{

  new ScriptObject(FrostyAR)

  {

    class = FrostyAR;

    // this delay is how long to keep repairing if they lose the target

    delay = 1000;

  };

}


package  FrostyAutoRepair

{

// ----------- Override mouseFire() function -----------

  function mouseFire(%val)

  {

    if(!FrostyAR.active)

      parent::mouseFire(%val);

  }


//  ------------- Starts and stop repairs ---------------

  function FrostyAR::repair(%this, %val)

  {

    // cancel if we lost a target and we found a new one...

    cancel(%this.schedule);


    %this.active = %val;

    $mvTriggerCount0 = %val;


    if(!%val)

      schedule(200, 0, use, %this.prevWeapon);

  }

//  -----------------------------------------------------

//  ---- Check to see if repairs done or any errors -----

  function defaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)

  {

    if(StrStr(%msgString, "Repair pack activated") != -1 || StrStr(%msgString, "Repairing") != -1)

      FrostyAR.repair(true);

    else if(StrStr(%msgString, "Repairs completed") != -1 || StrStr(%msgString, "Target is not damaged") != -1)

      FrostyAR.repair(false);

    else if(StrStr(%msgString, "No target to repair") != -1)

      FrostyAR.schedule = FrostyAR.schedule(FrostyAR.delay, repair, false);


    parent::defaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);

  }

//  -----------------------------------------------------

//  --- Called when user unmounts Repairgun (Icon off) --

  function clientCmdsetRepairPackIconOff()

  {

    FrostyAR.repair(false);


    parent::clientCmdsetRepairPackIconOff();

  }

//  -----------------------------------------------------

//  -------- Convert slot numbers to weapon names -------

  function clientCmdSetWeaponsHudBitmap(%slot, %name, %bitmap)

  {

    FrostyAR.weaponName[%slot] = %name;


    parent::clientCmdSetWeaponsHudBitmap(%slot, %name, %bitmap);

  }


  function clientCmdSetWeaponsHudActive(%slot)

  {

    FrostyAR.setWeapons(%slot);


    parent::clientCmdSetWeaponsHudActive(%slot);

  }


  function FrostyAR::setWeapons(%this, %slot)

  {

    if(%slot != -1)

      %this.prevWeapon = %this.weaponName[%slot];

  }

//  -----------------------------------------------------

//  ---------- Just checks to prevent errors ------------


// ####### dont know if you need this ?? ########

  function clientCmdTogglePlayHuds(%val)

  {

    parent::clientCmdTogglePlayHuds(%val);


    if(FrostyAR.active)

      FrostyAR.repair(false);

  }

//  -----------------------------------------------------

};

activatePackage(FrostyAutoRepair);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

And here is hiderfile.cs:

// #autoload

// #name = HideRifle

// #version = 1.0

// #date = May 15, 2001

// #author = |eX|DEbig3-RIP

// #warrior = DEbig3

// #email = [email protected]

// #web = http://scripts.tribalwar.com/debig3

// #description = hides the sniper rifle when its mounted

// #status = finished

// #readme =


package hidesniper {


function clientCmdSetWeaponsHudActive(%slot) {

  if ($WeaponNames[%slot] != "SniperRifle") {

    $pref::Player::renderMyItems = "1";

  }

  else if ($WeaponNames[%slot] $= "SniperRifle") {

    $pref::Player::renderMyItems = "0";

  }

  else {

    $pref::Player::renderMyItems = "1";

  }

  parent::clientCmdSetWeaponsHudActive(%slot);

}


function clientCmdSetRepairReticle() {

  $pref::Player::renderMyItems = "1";

}


};


activatePackage(hidesniper);


Both are packages. What should I pursue in an effort to get those scripts compatible & working with my mod? The relevant files I modified are as follows:

 \scripts\ directory:

    deathmessages.cs

    hud.cs

    inventory.cs

    inventoryHud.cs

    OptionsDlg.cs

    player.cs

    weapons.cs

Comments

  • For troubleshooting old client script packages that predate some of the base scripts, you'll generally want to start by verifying the function signatures match. In this case, if you look in each of these scripts you'll see function clientCmdSetWeaponsHudActive(%slot) which isn't a match - it's missing the %ret and %vis args, so any client commands going through these packages will discard the input on them as sent over the network.

    To fix them, you should just be able to change that to function clientCmdSetWeaponsHudActive(%slot, %ret, %vis) and make sure that it calls Parent::clientCmdSetWeaponsHudActive(%slot, %ret, %vis);


    The forum also has a "code block" mode if you hit the little paragraph icon to the left of the text box and open the sub-menu with the quote mark. I guess it's kind of a convoluted way to change the formatting, but doing it makes code much easier to read than the default paragraph mode that adds extra spacing on newlines.

Sign In or Register to comment.