ScriptUO
Scripting Resources & Utilities => Stealth Client => Stealth scripts => Topic started by: Papang- on December 21, 2017, 11:33:52 AM
-
Hello again 8)
After a few hours of work (looking for tutorials), I finally managed to make a little mage trainer for EA Shards.
after a few tests on "Test Center", it works!
Only a little problem...
If i run the program from Visual Studio 2017 I have no crash.
But If i open the build release with Admin right, it will insta crash the Client.exe but continue working on stealth.
using System;
using StealthAPI;
using ScriptSDK.Mobiles;
using ScriptSDK.Targets;
namespace PapangTrainer
{
class Program
{
public static PlayerMobile Me = PlayerMobile.GetPlayer();
public static bool IsBusy = false;
public static void Main(string[] args)
{
Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.WriteLine("Press [1] for Magery");
string Select = Console.ReadLine();
switch (Select)
{
case "1":
IsBusy = true;
while (IsBusy)
{
var _MageMax = Stealth.Client.GetSkillCap(Skill.Magery);
var _CurMage = Stealth.Client.GetSkillValue(Skill.Magery);
var Target = new EntityTarget(1000);
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("\r " + "[magery @ " + _CurMage + "/" + _MageMax + "]");
if (Me.Mana < 25)
Medit();
if (_CurMage >= 0 && _CurMage < 34)
{
Me.Cast("Bless");
Stealth.Client.Wait(850);
Target.Action(Target.Entity);
}
else if (_CurMage >= 34 && _CurMage < 45)
{
Me.Cast("Greater Heal");
Me.Targeting.WaitForTarget(1000);
Target.Action(Target.Entity);
}
else if (_CurMage >= 45 && _CurMage < 67)
{
Me.Cast("Dispel Field");
Me.Targeting.WaitForTarget(1000);
Target.Action(Target.Entity);
}
else if (_CurMage >= 67 && _CurMage < 82)
{
Me.Cast("Invisibility");
Me.Targeting.WaitForTarget(1500);
Target.Action(Target.Entity);
}
else if (_CurMage >= 82 && _CurMage < 95)
{
Me.Cast("Mass Dispel");
Me.Targeting.WaitForTarget(2000);
Target.Action(Target.Entity);
}
else if (_CurMage >= 95 && _CurMage < 120)
{
Me.Cast("Earthquake");
Stealth.Client.Wait(1500);
}
else
{
Console.WriteLine("Magery Cap Raised ! Congratulation.");
IsBusy = false;
}
}
break;
}
}
public static void Medit()
{
do
{
Console.ForegroundColor = ConsoleColor.DarkCyan;
Console.Write("\r" + "Meditating ... MWaah !");
Stealth.Client.CancelTarget();
Stealth.Client.UseSkill(Skill.Meditation);
Stealth.Client.Wait(500);
} while (Me.Mana < Me.MaxMana);
}
}
}
Post Merge: December 21, 2017, 11:46:32 AM
If you are shocked by the code structure, all tips will be welcome, I have never done anything like this before.
My goal is to learn and share, each advice received will allow me to evolve and share my achievements on the forum.
-
Can you open up the client and see it working after it crashes?
-
yes, i can reoppen it just after without bug and see the work doing.
-
Hello again 8)
After a few hours of work (looking for tutorials), I finally managed to make a little mage trainer for EA Shards.
after a few tests on "Test Center", it works!
Only a little problem...
If i run the program from Visual Studio 2017 I have no crash.
But If i open the build release with Admin right, it will insta crash the Client.exe but continue working on stealth.
If you are shocked by the code structure, all tips will be welcome, I have never done anything like this before.
My goal is to learn and share, each advice received will allow me to evolve and share my achievements on the forum.
Should be reported to Vizit0r as best. He can prolly fix the issue. First i thought you mean an assembly issue, but that would crash the application not client.exe. I will check if i can reproduce it. Do you use the latest SDK-Build from my repo?
-
yes, i can reoppen it just after without bug and see the work doing.
Well your char doesnt disconnect, means it will still perform the script and all regardless if client.exe is running or not.
Edit : Finally found the Edit button...
Your code looks good, but did PlayerMobile.Skills.Magery.Value and PlayerMobile.Skills.Magery.Cap not working? SDK is designed that you can ignore all exposed Stealth.XXX functions at upmost.
Reminds me to work further on scriptsdk.com next year.. Job change will give 20 hours a week more freetime...
-
Crome969,
I'm using the latest ScriptSDK from the git and compiledit.
About PlayerMobile.Skills.Magery.Value and PlayerMobile.Skills.Magery.Cap, i switched to Me.Skills.Magery.Cap & Value and it's worked as intented :)
Maybe the crash is due of some corruptions with "UO files", maybe i must take a look or build an environment only dedicated for Ultima Online coding. I will work on this next week-end, have to prepair Xmas with family :)
By the way, Mery X-mas to the team hehe.
Post Merge: December 22, 2017, 04:51:01 AM
Another question, for medit i have to use Me.UseSkill(ScriptSDK.Data.SkillName.Meditation) instead Me.UseSkill("Meditation").
There is an missing info on SDK or i did something wrong?
-
if i remember properly me.skills.Meditation.use() should work. If there are any bugs in that way i need reports at github about and i can check if i can fix it.
-
me.skills.Meditation.use() should work.
:D