Page 1 of 1
Orion Script help
Posted: Fri Oct 06, 2023 7:36 pm
by Alibaster
I need help from the expert scripters out there. I'm trying to improve my bandage script and I made a small change to it. After I made that small change, I started blowing through 2,000 bandages in a few seconds fighting a Halloween shadow boss. Before I know it i wasted 12k bandages and die. Below is the original script and below that is the new version. What did I do wrong?
function Auto_Heal_Bandages_three()
{
var Timer, Msg = "You put the bloody bandage|failed";
while (!Player.Dead() && Orion.Count("bandage"))
{
if (Player.Hits() < 425)//Player.MaxHits() - 1) //change this if you want to heal at a different HP level.
{
Orion.ClearJournal(Msg);
Orion.BandageSelf();
Timer = Orion.Now();
while (!Orion.InJournal(Msg) && Orion.Now() < Timer)
{
Orion.Wait(1);
}
}
else
{
Orion.Wait(1);
}
}
}
New script (I highlighted the change)
function Auto_Heal_Bandages_three()
{
var Timer, Msg = "You put the bloody bandage|failed";
while (!Player.Dead() && Orion.Count("bandage"))
{
if (Player.Hits() < 425)//Player.MaxHits() - 1) //change this if you want to heal at a different HP level.
{
Orion.ClearJournal(Msg);
Orion.Say('[bandself');
Timer = Orion.Now();
while (!Orion.InJournal(Msg) && Orion.Now() < Timer)
{
Orion.Wait(1);
}
}
else
{
Orion.Wait(1);
}
}
}
Re: Orion Script help
Posted: Sat Oct 07, 2023 12:26 am
by Wil
How long is a Wait? 1 Second? 1 millisecond?
Re: Orion Script help
Posted: Sat Oct 07, 2023 12:30 am
by Wil
Alibaster wrote: Fri Oct 06, 2023 7:36 pm
Timer = Orion.Now();
while (!Orion.InJournal(Msg) && Orion.Now() < Timer)
Note that it's impossible for Orion.Now() to ever be less than Timer so the while() condition always evaluates false. This means that the script
as running is:
function Auto_Heal_Bandages_three()
{
var Timer, Msg = "You put the bloody bandage|failed";
while (!Player.Dead() && Orion.Count("bandage"))
{
if (Player.Hits() < 425)//Player.MaxHits() - 1) //change this if you want to heal at a different HP level.
{
Orion.ClearJournal(Msg);
Orion.Say('[bandself');
Orion.Wait(1);
}
}
Re: Orion Script help
Posted: Sat Oct 07, 2023 12:46 am
by Wil
Hey +C:
How about enforcing a 10ms delay between executed player inputs and a disconnect after queue depth 100 is reached? With the exception of folks making errors with Orion scripts, that should basically be impossible to reach. And the sudden disconnects upon running a script would warn Orion users that they've made a mistake with their script before the input flood can lag the server for everybody else.
Regads,
Wil
Re: Orion Script help
Posted: Sat Oct 07, 2023 12:56 am
by Alibaster
What would be a better script to use that will not lag the server? I want a fast heal but not at the expense of everyone else. Any suggestions on how to correct the scrip is appreciated. I have no idea what I'm doing. i just found something on line that worked and was trying to make a tweak.
Re: Orion Script help
Posted: Sat Oct 07, 2023 1:05 am
by Alibaster
Wil wrote: Sat Oct 07, 2023 12:30 am
Alibaster wrote: Fri Oct 06, 2023 7:36 pm
Timer = Orion.Now();
while (!Orion.InJournal(Msg) && Orion.Now() < Timer)
Note that it's impossible for Orion.Now() to ever be less than Timer so the while() condition always evaluates false. This means that the script
as running is:
function Auto_Heal_Bandages_three()
{
var Timer, Msg = "You put the bloody bandage|failed";
while (!Player.Dead() && Orion.Count("bandage"))
{
if (Player.Hits() < 425)//Player.MaxHits() - 1) //change this if you want to heal at a different HP level.
{
Orion.ClearJournal(Msg);
Orion.Say('[bandself');
Orion.Wait(1);
}
}
I tried this script and it was still burning through a ton of bandages really fast. Like one battle went through 1500 bandages. Much more then before. Any idea why that would be? My HP is around 445. I adjusted it to a threshold of 415 before healing but it seems to burn through a lot of bandages fast.
Re: Orion Script help
Posted: Sat Oct 07, 2023 1:34 am
by Wil
Alibaster wrote: Sat Oct 07, 2023 12:56 am
What would be a better script to use that will not lag the server? I want a fast heal but not at the expense of everyone else. Any suggestions on how to correct the scrip is appreciated. I have no idea what I'm doing. i just found something on line that worked and was trying to make a tweak.
Well, as you noticed the script is consuming hundreds of bandages per second. It's not even waiting to see what the last heal did before telling it to heal you again.
So, read through the script. How long have you programmed it to wait between telling the server to heal you again?
The old version used Orion.BandageSelf(); which double-clicks a bandage, -waits- for a target cursor to appear and then targets the character.
Re: Orion Script help
Posted: Sat Oct 07, 2023 1:54 am
by Alibaster
Thanks. The timer looks to be set for 1 millisecond. I'll work that up and find a happy medium. Thanks again for the help.