Anti AFK + Auto Accept Group.
Anti AFK + Auto Accept Group.
Hello guys, I wonder if there's a way to implement an anti-afk and auto accept party script (with or without white and black list) for AS, this could be pretty awesome for group holders, can somebody give me a hand or some tips about how to make it?, thank you.
Re: Anti AFK + Auto Accept Group.
True, but this requires a character botting all the time, in a way it will use more resources and also be more dangerous for the accounts.
The reason of why OfficialGrinderFramework accepts groups "automatically" is because it's always spamming Enter while doing the skill chains, thats why it accepts the pop up inmediately.
What I have in mind is to create a script that press the F8 key every 5 minutes, and also press the Enter key every 3 seconds. I know it sounds really simple, but I dont know how to code it into the script

- Diavolakos
- Posts: 114
- Joined: Thu Apr 20, 2017 5:05 am
- Has thanked: 31 times
- Been thanked: 13 times
Re: Anti AFK + Auto Accept Group.
Well I can write the algorithm for it, but I am missing TWO key things, first how to we command in lua to hit a button like F8 and what is the command to hit "enter"smaion40 wrote: ↑Sat Sep 23, 2017 11:18 pmTrue, but this requires a character botting all the time, in a way it will use more resources and also be more dangerous for the accounts.
The reason of why OfficialGrinderFramework accepts groups "automatically" is because it's always spamming Enter while doing the skill chains, thats why it accepts the pop up inmediately.
What I have in mind is to create a script that press the F8 key every 5 minutes, and also press the Enter key every 3 seconds. I know it sounds really simple, but I don't know how to code it into the script![]()
The below script will write a message in group chat every 3 seconds that it needs to enter (I wrote enter so you can see that this command needs to be replaced by the enter command when we find how to do it)
and every 5 minutes it will write "How do I hit F8 guys?" so to let you know that this is the command we need to replace in order to hit the F8 when we find how to do it.
So copy the below code, save it inside the scripting folder under the name "afk test.lua" and then load AS and run it. The char will spam this in group chat so before you run the script just put this guy into your own group to see the messages (otherwise if the character is not in a group the chat won't appear and you will get the ingame system message "you are not in a group")
The only thing we need here is some light from the admins that know lua commands how to replace those two specific lines. I think the fact it chats is enough to hit "enter" but we want to know the command for future usage as well.
Also to stay anti-AFK we can use the command
PlayerInput:Console( "/changeweaponset" );
which will toggle the weapons your char has, enough to make an action and keep him online. So if you remove the command where he says "how do I hit F8 guys" and you put this line you will get a toggle weapon action that will surely keep him anti-afk.
Code: Select all
-- this function is run once when the script is loaded and starts playing
function OnLoad()
Write( "Anti AFK test - by Diavolakos" )
-- This is a variable to test the time we have, timer1 is for 5 minutes and timer2 is for 3 seconds
timer1 = 0;
timer2 = 0;
end
--this function is run a few times per second, it is the main body
function OnRun()
--Check every 5 minutes (300.000 milliseconds) and hit the F8 you asked, but how do we hit a button in lua I do not know
if Time() > ( timer1 + 300000 ) then
--you asked to hit F8 so it selectes the nearrest target BUT I do not know how to do this command
PlayerInput:Console( "/g how do I hit F8 guys?" );
timer1 = Time();
end
--Check every 3 seconds (3000 millisecond) and hit Enter so as to accept all invitations
if Time() > ( timer2 + 3000 ) then
--we need to his Enter here, but I do not know the command to do so.
PlayerInput:Console( "/g I need to enter" );
timer2 = Time();
end
end
I play on NA Server Siel
Re: Anti AFK + Auto Accept Group.
Thank you so much for your help man, really, you are awesome.Diavolakos wrote: ↑Mon Sep 25, 2017 5:33 amWell I can write the algorithm for it, but I am missing TWO key things, first how to we command in lua to hit a button like F8 and what is the command to hit "enter"smaion40 wrote: ↑Sat Sep 23, 2017 11:18 pmTrue, but this requires a character botting all the time, in a way it will use more resources and also be more dangerous for the accounts.
The reason of why OfficialGrinderFramework accepts groups "automatically" is because it's always spamming Enter while doing the skill chains, thats why it accepts the pop up inmediately.
What I have in mind is to create a script that press the F8 key every 5 minutes, and also press the Enter key every 3 seconds. I know it sounds really simple, but I don't know how to code it into the script![]()
The below script will write a message in group chat every 3 seconds that it needs to enter (I wrote enter so you can see that this command needs to be replaced by the enter command when we find how to do it)
and every 5 minutes it will write "How do I hit F8 guys?" so to let you know that this is the command we need to replace in order to hit the F8 when we find how to do it.
So copy the below code, save it inside the scripting folder under the name "afk test.lua" and then load AS and run it. The char will spam this in group chat so before you run the script just put this guy into your own group to see the messages (otherwise if the character is not in a group the chat won't appear and you will get the ingame system message "you are not in a group")
The only thing we need here is some light from the admins that know lua commands how to replace those two specific lines. I think the fact it chats is enough to hit "enter" but we want to know the command for future usage as well.
Also to stay anti-AFK we can use the command
PlayerInput:Console( "/changeweaponset" );
which will toggle the weapons your char has, enough to make an action and keep him online. So if you remove the command where he says "how do I hit F8 guys" and you put this line you will get a toggle weapon action that will surely keep him anti-afk.
Code: Select all
-- this function is run once when the script is loaded and starts playing function OnLoad() Write( "Anti AFK test - by Diavolakos" ) -- This is a variable to test the time we have, timer1 is for 5 minutes and timer2 is for 3 seconds timer1 = 0; timer2 = 0; end --this function is run a few times per second, it is the main body function OnRun() --Check every 5 minutes (300.000 milliseconds) and hit the F8 you asked, but how do we hit a button in lua I do not know if Time() > ( timer1 + 300000 ) then --you asked to hit F8 so it selectes the nearrest target BUT I do not know how to do this command PlayerInput:Console( "/g how do I hit F8 guys?" ); timer1 = Time(); end --Check every 3 seconds (3000 millisecond) and hit Enter so as to accept all invitations if Time() > ( timer2 + 3000 ) then --we need to his Enter here, but I do not know the command to do so. PlayerInput:Console( "/g I need to enter" ); timer2 = Time(); end end
I followed your advice and replaced the lines with
"PlayerInput:Console( "/changeweaponset" );"
and also added a second one, since placing a skill will keep it spamming "Enter", as I said before, then I used
"PlayerInput:Console( "/skill Bandage Heal" );"
This end up with a pretty awesome anti-afk + group holder script, simple, but extremely functional.
PD: I'm still looking for a send KeyPress command for lua, it would be nice for future references.
PD2: There's place for a tweak on this script, we can set a default character name string and then compare it with the player who is inviting you to group, if it matches what you set previously then it continues using the "PlayerInput:Console( "/skill Bandage Heal" );", if not, then make a pause for about 10 - 15 seconds until the invite group pop up dissapears.
I remember @cooco added a similar function to his newly leveling characters project. It would be nice to add the essence of it to this.
cooco wrote: ↑Tue Aug 29, 2017 4:29 pm
Configure script if u run multiclient.Code: Select all
-- Configure party members local server = ""; -- If u are intraserver. For example server = "-Urtem" or server = "-Hellion" or server = "-Thor". Empty if are in normal server -- Comment this line if u solo instance FrameworkExp:AddMemberParty("YourCharName1"..server); FrameworkExp:AddMemberParty("YourCharName2"..server);
- Diavolakos
- Posts: 114
- Joined: Thu Apr 20, 2017 5:05 am
- Has thanked: 31 times
- Been thanked: 13 times
Re: Anti AFK + Auto Accept Group.
I am glad the script does the thing, yes I forgot that most commands also hit an enter, so I guess the script serves your purpose.
I wish there was documentation on everything in AS, I read the pdf with the command list, and that's it, a list of commands that I don't know how to use. I could make a ton of scripts if I knew how to write in lua and AS.
I wish there was documentation on everything in AS, I read the pdf with the command list, and that's it, a list of commands that I don't know how to use. I could make a ton of scripts if I knew how to write in lua and AS.
I play on NA Server Siel
Re: Anti AFK + Auto Accept Group.
Hello Diavolakos, I have a question about your timer functions. I noticed that right after the script is started all the instructions are executed inmediately and after that then the timer starts working according the seconds set.Diavolakos wrote: ↑Mon Oct 23, 2017 6:51 amI am glad the script does the thing, yes I forgot that most commands also hit an enter, so I guess the script serves your purpose.
I wish there was documentation on everything in AS, I read the pdf with the command list, and that's it, a list of commands that I don't know how to use. I could make a ton of scripts if I knew how to write in lua and AS.
Is there a way to execute all the lines in a sequential way right after the start?
In example:
Code: Select all
function OnLoad()
timer1 = 0;
timer2 = 0;
end
function OnRun()
if Time() > ( timer1 + 2000 ) then
Write( "Hello world 1" );
timer1 = Time();
end
if Time() > ( timer2 + 3000 ) then
Write( "Hello world 2" );
timer2 = Time();
end
end
- Hello world 1 <-- Inmediately after starting the script
- Hello world 2 <-- Inmediately after starting the script
- Hello world 1 <-- Message after 2 seconds
- Hello world 2 <-- Message after 3 seconds
So, in this case I need the output to start after the 2 seconds and not showing the first two lines that are not following the timer instructions. I would appreciate any help you can give me with this. Thank you

Re: Anti AFK + Auto Accept Group.
Code: Select all
function OnLoad()
timer1 = Time() + 2000;
timer2 = Time() + 2000;
end
- Diavolakos
- Posts: 114
- Joined: Thu Apr 20, 2017 5:05 am
- Has thanked: 31 times
- Been thanked: 13 times
Re: Anti AFK + Auto Accept Group.
Sorry I was away, and yes cooco gave a good solution. Another way would be to run the commands one time inside function OnLoad() command but it is not recommended only for consistency in coding issues, like a general way of writing scripts, don't have main code int he initialization of the script.
I play on NA Server Siel
Who is online
Users browsing this forum: No registered users and 1 guest