Author Topic: AutoEnergy  (Read 5149 times)

0 Members and 1 Guest are viewing this topic.

Sinister

  • Uber Menace
  • *******
  • Posts: 1,125
  • Reputation: +0/-0
    • http://www.stormpages.com/snowmann69
AutoEnergy
« on: August 3, 2004 10:22 pm CDT »
Can anyone tell me why this wont work.????? It recognizes that i have vials, but wont actually use them.


////////////////////////////////////
// Auto-Energy standalone version //
////////////////////////////////////
////////////////////////////////////
//
// This script will automatically
// use Crystal Energy Vials or
// Energy Vials to boost your energy
// when it drops below 100%.
//
// INSTALLATION: Place this file
// in your /Tribes/config/
// folder (that's it.)
//
// Then to turn it on, simply type
// exec(autovial); in your console
//
// To turn it off, type
// exec(autovial); in your console
// again. :)
//
//
// ADVANCED OPTIONS:
// You can define how much damage
// you'd like to take before the
// script kicks in and uses a potion.
// The default is 10 damage points.
//
$TakeThisDamage = 10;
//
// You can set the speed at which
// the script checks your MP. The
// default is every 0.3 seconds.
// If that causes your Tribes to
// lag, try increasing the number.
//
$MPCheckInterval = 0.3;
//
////////////////////////////////////






// This toggles the script on or off every time you exec() it
if ($UsingVials == "") {
$UsingVials = "1";
$NoVialAlert = "";
   $StartupNumCVials = getItemCount("Crystal Energy Vial");
   $StartupNumVials = getItemCount("Energy Vial");
      if ($StartupNumCVials == "0" && $StartupNumVials == "0") {
      $StartupNumMsg = "<f1>You do not have any vials.";
      } else {
      $StartupNumMsg = "<f3>You have <f1>" @ $StartupNumCVials @ " Crystal Energy

Vials<f3> and <f1>" @ $StartupNumVials @ " Energy Vials";
      }
   Client::centerPrint("<jc><f3>Auto-Energy script is now: <f1>on \n " @ $StartupNumMsg, 1);
   schedule("Client::centerPrint(\"\", 1);", 5);
} else if ($UsingVials == "1") {
$UsingVials = "";
$NoVialAlert = "";
   Client::centerPrint("<jc><f3>Auto-Energy script is now: <f1>off", 1);
   schedule("Client::centerPrint(\"\", 1);", 5);
}



// This determines whether or not to run the VialLoop() function
if ($UsingVials == "1") {
   if ($FunctionRunning == "") {
   VialLoop();
   }
} else {
   $FunctionRunning = "";
}




// This gets the MP every 0.3 seconds
function VialLoop () {
$FunctionRunning = "1";

remoteEval(2048, fetchData, "MP");
remoteEval(2048, fetchData, "MaxMP");
schedule("$MyMP = $RPGdata[MP];", $MPCheckInterval);
schedule("$MyMaxMP = $RPGdata[MaxMP];", $MPCheckInterval);
schedule("VialDecide();", $MPCheckInterval);

   if ($UsingVials == "") {
   $FunctionRunning = "";
   } else {
   schedule("VialLoop();", $MPCheckInterval);
   }

} // End VialLoop




// This decides whether or not to use a potion
function VialDecide () {

   $MPDownBy = $MyMaxMP - $MyMP;
   if ($MPDownBy > $TakeThisDamage) {
      if (getItemCount("Crystal Energy Vial")) {
         use("Crystal Energy Vial");
         $NoVialAlert = "";
      } else if (getItemCount("Energy Vial")) {
         use("Energy Vial");
         $NoVialAlert = "";
      } else {
         if ($NoVialAlert == "") {
         AlertNoVial();
         }
      }
   }

} // End VialDecide




function AlertNoVial () {

$NoVialAlert = 1;
schedule("Client::centerPrint(\"<jc><f2>YOU ARE OUT OF VIALS\", 1);", 0);
schedule("Client::centerPrint(\"<jc><f2> \", 1);", 0.5);
schedule("Client::centerPrint(\"<jc><f2>YOU ARE OUT OF VIALS\", 1);", 1.0);
schedule("Client::centerPrint(\"<jc><f2> \", 1);", 1.5);
schedule("Client::centerPrint(\"<jc><f2>YOU ARE OUT OF VIALS\", 1);", 2.0);
schedule("Client::centerPrint(\"<jc><f2> \", 1);", 2.5);
schedule("Client::centerPrint(\"<jc><f2>YOU ARE OUT OF VIALS\", 1);", 3.0);
schedule("Client::centerPrint(\"\", 1);", 4.0);

} // End AlertNoVial




// This function is necessary if the user doesn't have Deus RPG Pack
function remoteSetRPGdata(%server, %data, %type) {
   if (%server == 2048) {
      $MyInfo[%type] = %data;
      $RPGdata[%type] = %data;
   }
} // End remoteSetRPGdata
« Last Edit: December 31, 1969 06:00 pm CST by Sinister »

Corona

  • Elvin Legion
  • *****
  • Posts: 486
  • Reputation: +6/-1
    • http://www.Linneberg.com
(No subject)
« Reply #1 on: August 3, 2004 11:12 pm CDT »
You're using [MP] and [MaxMP] when you should be using [MANA] and [MaxMANA]

recommended change:

remoteEval(2048, fetchData, "MANA");
remoteEval(2048, fetchData, "MaxMANA");
schedule("$MyMP = $RPGdata[MANA];", $MPCheckInterval);
schedule("$MyMaxMP = $RPGdata[MaxMANA];", $MPCheckInterval);
schedule("VialDecide();", $MPCheckInterval);
« Last Edit: December 31, 1969 06:00 pm CST by Corona »

Lidge Farkley

  • Uber Menace
  • *******
  • Posts: 1,357
  • Reputation: +2/-3
    • http://www.angelfire.com/ca2/psychosworld2/
(No subject)
« Reply #2 on: August 4, 2004 01:42 pm CDT »
You also should redefine all those global variables so that they are confined just to the functions they are being used in.  Global varibles tend to use more CPU cycles... of course... this isn't a very complex script and the ammoudt of data being used would suggest that redefining the variables would actually yield no performance increase.

Maybe I am just rambling again...
« Last Edit: December 31, 1969 06:00 pm CST by Lidge Farkley »
Lend your heart unto the divine mineral TOPAZ;
from which our reverent hearts and minds sprang.
Also Known As:  Alcoholic 007
My Page of tribes Tools and Helpful "FAQ" Stuff

Sinister

  • Uber Menace
  • *******
  • Posts: 1,125
  • Reputation: +0/-0
    • http://www.stormpages.com/snowmann69
(No subject)
« Reply #3 on: August 4, 2004 06:00 pm CDT »
It's pretty funny...it will function properly with the changes you suggested Taurik, but only at my job, not a home, or at my mom's house.  It keeps popping up syntax error line 55 at my home locations.  Weird eh?  Any ideas why?  The tribes install at work is the same as i have at my mom's house.  Exactly.
« Last Edit: December 31, 1969 06:00 pm CST by Sinister »

Lidge Farkley

  • Uber Menace
  • *******
  • Posts: 1,357
  • Reputation: +2/-3
    • http://www.angelfire.com/ca2/psychosworld2/
(No subject)
« Reply #4 on: August 4, 2004 09:41 pm CDT »
Is the script at home and office the same exact script?

Some times I send unmodified/unfinished versions of things through the e-mail and forget that when I try them later... doh!

Check your line 55 at home :-)
//you might have just forgotten a ; ...that's my most common mistake.... the version of the weapons scripter that I published a couple years back had that problem! :-)  I fixed it and uploaded it 2 months a go... but I didn't re-test anything.  THis all happened because I had saved the wrong version to my uploads foler and didn't update it.... doh!  eh?
« Last Edit: December 31, 1969 06:00 pm CST by Lidge Farkley »
Lend your heart unto the divine mineral TOPAZ;
from which our reverent hearts and minds sprang.
Also Known As:  Alcoholic 007
My Page of tribes Tools and Helpful "FAQ" Stuff

Corona

  • Elvin Legion
  • *****
  • Posts: 486
  • Reputation: +6/-1
    • http://www.Linneberg.com
(No subject)
« Reply #5 on: August 4, 2004 10:03 pm CDT »
Quote from: "Lidge Farkley"
You also should redefine all those global variables so that they are confined just to the functions they are being used in.  Global varibles tend to use more CPU cycles... of course... this isn't a very complex script and the ammoudt of data being used would suggest that redefining the variables would actually yield no performance increase.

I wrote the script this one is based on (the original one auto-used heal potions instead of energy potions) so you can blame all inefficient code on me. :) I'm used to Perl, which I'm pretty sure only has global variables. It kind of carries over to my tribes code out of habit.. lol

Quote from: "Sinister"
It's pretty funny...it will function properly with the changes you suggested Taurik, but only at my job, not a home, or at my mom's house.  It keeps popping up syntax error line 55 at my home locations.  Weird eh?  Any ideas why?  The tribes install at work is the same as i have at my mom's house.  Exactly.


I checked line 55, which for some reason you've actually divided into two lines:

$StartupNumMsg = "<f3>You have <f1>" @ $StartupNumCVials @ " Crystal Energy

Vials<f3> and <f1>" @ $StartupNumVials @ " Energy Vials";


That would probably cause a syntax error...
« Last Edit: December 31, 1969 06:00 pm CST by Corona »

Sinister

  • Uber Menace
  • *******
  • Posts: 1,125
  • Reputation: +0/-0
    • http://www.stormpages.com/snowmann69
(No subject)
« Reply #6 on: August 4, 2004 10:52 pm CDT »
I'll just put the working copy on disk and check it when i get home tonight.  If it doesn't work, then there must be a conflict with something that I have at home that I dont have at work.
« Last Edit: December 31, 1969 06:00 pm CST by Sinister »

Lidge Farkley

  • Uber Menace
  • *******
  • Posts: 1,357
  • Reputation: +2/-3
    • http://www.angelfire.com/ca2/psychosworld2/
(No subject)
« Reply #7 on: August 5, 2004 01:20 am CDT »
Yeah I've only really formally worked with HTML and JavaScript... which are extreemly easy compared to some thing like C, Java, C++, etc...

But... I am decent at theory so I can think of ways to solve problems using functions and variables... usually.  I don't blame you! :-)

Anyway... looking in my Perl book...

Hmm.. I wish I hadn't loaned my C/C++ books to my neighbour... doh!


Looking through the Perl book quickly I find no reference to any kinds of variables in Perl ofther than:
$
and
@  (which has some special conditions it seems)

Interesting... I would think internal data types would allow for a larger body of code to be written while taking up less active memory... of course... Perl is not C.
;-p

Peace.
« Last Edit: December 31, 1969 06:00 pm CST by Lidge Farkley »
Lend your heart unto the divine mineral TOPAZ;
from which our reverent hearts and minds sprang.
Also Known As:  Alcoholic 007
My Page of tribes Tools and Helpful "FAQ" Stuff

Scrizaks

  • Undead Hero
  • ****
  • Posts: 347
  • Reputation: +0/-0
(No subject)
« Reply #8 on: August 7, 2004 01:23 am CDT »
*Tries to read topic*

*sees coding*

*..............(blank stare) ..........*

uh,  :shock:
« Last Edit: December 31, 1969 06:00 pm CST by Scrizaks »

-eViL-

  • Minotaur Rager
  • ******
  • Posts: 880
  • Reputation: +0/-0
(No subject)
« Reply #9 on: August 7, 2004 01:38 am CDT »
the broken line may or may not cause an error.  I have written stuff before where i did that, and tribes read over it just fine, and other times tribes would catch it and give errors.  so the copies he has may be the same, but 2 different tribes executables may read the file 2 different ways.
« Last Edit: December 31, 1969 06:00 pm CST by -eViL- »
There's nothing ever wrong but nothing's ever right
Such a cruel contradiction

neil

  • Elvin Legion
  • *****
  • Posts: 511
  • Reputation: +0/-0
    • http://www.google.com
(No subject)
« Reply #10 on: August 7, 2004 04:43 am CDT »
geez who would care anyways...

its on deus chat already... everytime your MP reaches bellow 100% a timer starts when to use a energy vial you can set the timer between 1 second - 2 mins i think
« Last Edit: December 31, 1969 06:00 pm CST by neil »


Sinister

  • Uber Menace
  • *******
  • Posts: 1,125
  • Reputation: +0/-0
    • http://www.stormpages.com/snowmann69
(No subject)
« Reply #11 on: August 7, 2004 10:45 am CDT »
Quote from: "neil"
geez who would care anyways...

its on deus chat already... everytime your MP reaches bellow 100% a timer starts when to use a energy vial you can set the timer between 1 second - 2 mins i think


I care, that's why.  I want to put specific scripts on my website and for my personal use.  If you dont have anything important to say, then don't post!
« Last Edit: December 31, 1969 06:00 pm CST by Sinister »