Particle's Custom RPG

Assistance => Assistance & Feedback => Topic started by: Newbie on May 18, 2004 08:38 pm CDT

Title: Need help making a simple script.
Post by: Newbie on May 18, 2004 08:38 pm CDT
Ok.. I need a script that makes me swing my weapon every ten seconds.. (aka backstab training. It's a differnt mod from tRPG so please don't say "AWW why don't you just use auto swing?!?!?")

I need a script that I can run through console on server. All I need it to do is to simply swing every ten seconds.. anyone help me? Please?
Title:
Post by: UnderGod on May 18, 2004 09:55 pm CDT
Try this for starters..

Code: [Select]
function fire()
{
postAction(2048, IDACTION_FIRE1);
schedule("postAction(2048, IDACTION_BREAK1);", 0.2);

schedule("fire()", 10);
}
Title:
Post by: -eViL- on May 18, 2004 10:10 pm CDT
actually oz.. it is simpler to just do

function BST()
{
postAction(2048, IDACTION_BREAK1, 0);
schedule("BST();", 10);
}

because sometimes if you do fire and then break, the break will actually cause you to swing... and therefore offsets whatever it is trying to do, or in some cases, the break just won't do anything at all and fire will be left on.  so what i have above is by far more efficient and safer.
Title:
Post by: Newbie on May 19, 2004 02:54 pm CDT
Thanks guys. :D
Title:
Post by: Newbie on May 19, 2004 04:01 pm CDT
Uhh.. actually neither of them work..

I saved it in notepad as "Backstab.cs" and ran it in console and neither of them do anything.. it just says it's executing backstab.cs and then nothing happens. :/
Title:
Post by: UnderGod on May 19, 2004 04:59 pm CDT
You need to call the function once to start the loop.

so type fire(); in my case BST(); in eViL's.
Title:
Post by: Newbie on May 19, 2004 08:23 pm CDT
Kickass, thanks guys. :)
Title:
Post by: Xanth on May 20, 2004 09:54 am CDT
put the first one on a keybind so you dont have to type it in every time you want to instaciate it.
Just a thought.
Title:
Post by: Sinister on May 20, 2004 11:54 pm CDT
Let us know if you got it to work.
Title:
Post by: UnderGod on May 21, 2004 09:22 am CDT
Quote from: "Newbie"
Kickass, thanks guys. :)


Yes he did.
Title:
Post by: Newbie on May 31, 2004 06:20 pm CDT
Also.. anyone know how to make a script to #meditate every 15 seconds or so?

Any help would be appreciated, thanks.
Title:
Post by: Lidge Farkley on May 31, 2004 07:44 pm CDT
Quote from: "Newbie"
Also.. anyone know how to make a script to #meditate every 15 seconds or so?

Any help would be appreciated, thanks.


You'd need it to #wake too, and you'd need to determine when to do those things.

Some more scheduling......
Title:
Post by: Sinister on May 31, 2004 07:47 pm CDT
Well, i will work on it when i get home....seems pretty simple, but probably by the time i get to it, someone else will have already answered it.  Btw why do you want a script that does that?  I may have some stuff you might like instead.  Just let me know what it's for.
Title:
Post by: Newbie on May 31, 2004 08:32 pm CDT
Well it's for TVT and you can't use deuspack because energy involes stamina and walking.. so it doesn't work for some reason..

I just need a script to #meditate to full energy/stamina then #wake and wait about 15 seconds before repeating the process over again.
Title:
Post by: Newbie on June 3, 2004 05:49 pm CDT
*Bump*   :wink:
Title:
Post by: -eViL- on June 3, 2004 06:51 pm CDT
Code: [Select]
$Train1 = false;
$Train2 = false;
$T = true;

function Train(%Opt)
{
if($T)
{
if(Fetch("MANA") == 0)
{
echo("Meditate");
say(0, "#meditate");
schedule::Add("say(0, \"#meditate\");", 3, SayMed);
Train::Meditate();
schedule::Add("Train::Meditate();", 3, TrainMeditate);
}

if(%Opt == 0)
{
schedule::Cancel(TrainWeapon);
schedule::Cancel(TrainWeight);
return;
}
else if(%Opt == 1)
{
$Action = 1;
schedule::Cancel(TrainMedWeapon);
$Train1 = true;
postAction(2048, IDACTION_BREAK1, 0);
schedule::Add("Train(1);", 1.8, TrainWeapon);
}
else if(%Opt == 2)
{
$Action = 1;
schedule::Cancel(TrainMedWeight);
$Train2 = true;
postAction(2048, IDACTION_MOVEUP, 1);
schedule::Add("Train(2);", 0.1, TrainWeight);
}
}
}

function Train::Meditate()
{
$Action = 2;
$T = false;
schedule::Add("Train::Meditate();", 2, TrainMeditate);

if(Fetch("MANA") == 100)
{
echo("Wake Up.");
say(0, "#wake");
schedule::Add("say(0, \"#wake\");", 3, SayWake);
schedule::Cancel(TrainMeditate);
$T = true;

if($Train1)
{
Train(1);
schedule::Add("Train(1);", 3, TrainMedWeapon);
}

if($Train2)
{
Train(2);
schedule::Add("Train(2);", 3, TrainMedWeight);
}
}
}

function TrainOff()
{
$T = false;
schedule::Cancel(TrainWeapon);
schedule::Cancel(TrainWeight);
}
Title:
Post by: Newbie on June 3, 2004 07:27 pm CDT
Thanks, but..

how exactly do I run this command through console?

exec("NameOfFile");  ?
Title:
Post by: UnderGod on June 3, 2004 10:18 pm CDT
Put it all in a CS file.. exec the CS file

either bind a command or type Train(%Opt) in console.

If you type 1 in place of %Opt it will swing your weapon while you are meditating.

If you type 2 it will jump while meditating.

If you type 0 it will cancel the above. You will wake when your mana is full.
Title:
Post by: Sinister on June 4, 2004 12:33 pm CDT
Wow, i wish my autogrouping post would have been answered like that.  All i got was a vague referece to GUI's (which i have no idea how to do).  The topic is still open if anyone else would like to help in this.  This is probably the last big thing left before my bot is fully capable of playing the server without a person behind the keyboard.  Wait, no, he cant be summoned directly to a person, so i guess i still have to work on that too.  The script I'm writing is open source.  You can view it on my website.  Http://www.stormpages.com/snowmann69 (http://Http://www.stormpages.com/snowmann69).  Enjoy.
Title:
Post by: Newbie on June 7, 2004 03:31 pm CDT
Hey Ozz.. it didn't work all the way for me :/

I did everything you told me to.. but once I typed "Train(%Opt)" my character started meditating and wouldn't stop.
Title:
Post by: UnderGod on June 7, 2004 03:43 pm CDT
You need to type Train(0); or Train(1); or Train(2); for the options described above.
Title:
Post by: -eViL- on June 7, 2004 03:59 pm CDT
no oz.. i forgot to stick in a function.... so it is doing Fetch("MANA") and getting a blank.. which would cause that.


Code: [Select]
function RPGfetchData(%type)
{
if(String::findSubStr($ServerMod, "rpg") != -1)
return remoteEval(2048, fetchData, %type);
}

function remoteSetRPGdata(%server, %data, %type)
{
if(%server == 2048)
$RPGdata[%type] = %data;
}

function fetch(%type)
{
rpgfetchdata(%type);
return $RPGdata[%type];
}


sorry psycho.
Title:
Post by: UnderGod on June 7, 2004 10:52 pm CDT
This is true, but since he said he had deuspack =/