AAO25.com

America's Army => General Chat => Topic started by: ronski on Monday, September 07, 2015, 04:43:10 AM

Title: Admin forceclassing with scripts
Post by: ronski on Monday, September 07, 2015, 04:43:10 AM
I have a few questions about executing script files in game. I have few scripts and I would be interested to create some too. 

1) Im running intel mac, am I able to run these scripts from my computer? To which folder I need to add my scripts? All I can find is ~/Library/Application Support/25Assist/ and that doesn't seem to be the right place. I know where to put these on windows.

2) Am I able to run scripts from the game-server if I upload them over there, so all serveradmins could use same scripts without downloading them to their own computer?

3) Forceclassing someone "randomly" seems to be happening by players id, is there a way to forceclass some decent slot? Is there a way to exec some uscript function which sorts out slots and returns id's of players from slots that I want to know? Some might already figure out what Im trying to search for..
Title: Re: Admin forceclassing with scripts
Post by: teddy_grizzly_bear on Monday, September 07, 2015, 05:06:38 AM
1)
While I don't have a mac, according to this (http://aao25.com/support/#faq), the address is correct. You should have an armyops folder in there where the AA files are.

2)
I'm unaware as to how this would work. As far as I know, most of the time people run the scripts from their own computer.

3)
Yes, all of it does happen through the player ID usually.
I'm pretty sure ELiZ made this work already. Try "afc random". I'm fairly certain I saw the code for this somewhere, but can't find it explicitly so I'm not sure if it works, ELiZ can comment I suppose.
If it doesn't this is a good suggestion:
If you place an executable in the System folder, it's the job of the assist client to make it disappear.

Making an app that would create random.txt regularly without being itself in the System folder is childplay. and average coder could do that in 5 minutes.
You can make an extremely easy piece of code that makes a new random.txt every now and then (a minute or two to make sure you get a new set every round) where everyone gets a random weapon. The only problem with this would be that it would still rely on the IDs and spam all the IDs which makes the server and/or client freeze for a second or so.
Title: Re: Admin forceclassing with scripts
Post by: ronski on Monday, September 07, 2015, 05:24:39 AM
1)
While I don't have a mac, according to this (http://aao25.com/support/#faq), the address is correct. You should have an armyops folder in there where the AA files are.

2)
I'm unaware as to how this would work. As far as I know, most of the time people run the scripts from their own computer.

3)
Yes, all of it does happen through the player ID usually.
I'm pretty sure ELiZ made this work already. Try "afc random". I'm fairly certain I saw the code for this somewhere, but can't find it explicitly so I'm not sure if it works, ELiZ can comment I suppose.
If it doesn't this is a good suggestion:You can make an extremely easy piece of code that makes a new random.txt every now and then (a minute or two to make sure you get a new set every round) where everyone gets a random weapon. The only problem with this would be that it would still rely on the IDs and spam all the IDs which makes the server and/or client freeze for a second or so.

Thank you Teddy for all of these. So it's technically impossible to check out what player-id is on which slot?
Title: Re: Admin forceclassing with scripts
Post by: teddy_grizzly_bear on Monday, September 07, 2015, 06:38:48 AM
No, it's not technically impossible, I do believe the afc script does just that.
I'm not 100% sure whether the "afc random" works, though.
Title: Re: Admin forceclassing with scripts
Post by: ronski on Monday, September 07, 2015, 06:50:22 AM
No, it's not technically impossible, I do believe the afc script does just that.
I'm not 100% sure whether the "afc random" works, though.
Im interested in to sneak out the player id's and force class random or certain weapon for everyone except one slot, which would be the VIP :) So technically I need the player id of VIP and just leave that id out of the loop :)
Title: Re: Admin forceclassing with scripts
Post by: Bart! on Monday, September 07, 2015, 11:51:49 AM
type playerlist in console

see their slot nr.
However, this slot nr changes for every new connection to the server
1st player on the server is slot 1
but when he reconnects, he will be slot2.
When another joins, he will be slot 3

If the server is running for weeks, you might be slot 7692...
Title: Re: Admin forceclassing with scripts
Post by: ronski on Monday, September 07, 2015, 11:57:41 AM
Let's try this way: Is it possible to read which player id is playing on certain slot. For example am I able to find player id of Vip automatically with uscript? Then I could iterate through all id's from 1 to 2000 and give all id's some weapon except the id who is playing as vip.
Title: Re: Admin forceclassing with scripts
Post by: teddy_grizzly_bear on Monday, September 07, 2015, 15:58:31 PM
I'm fairly certain it's possible with uscript, but I don't know how easy it would be and I'm not sure we have someone who would be willing to work on it.

Another possibility is that you know what the ID of the VIP is (having someone trusted on VIP who is always VIP) and just manually skip that ID (i.e make a program that I quoted about with this little addition).
Title: Re: Admin forceclassing with scripts
Post by: ronski on Monday, September 07, 2015, 16:30:28 PM
I'm fairly certain it's possible with uscript, but I don't know how easy it would be and I'm not sure we have someone who would be willing to work on it.

Another possibility is that you know what the ID of the VIP is (having someone trusted on VIP who is always VIP) and just manually skip that ID (i.e make a program that I quoted about with this little addition).

Oooh thats clever! Shit that's worth of trying!
Title: Re: Admin forceclassing with scripts
Post by: teddy_grizzly_bear on Monday, September 07, 2015, 18:05:06 PM
And since you need to give manual input anyway, you could also add the minimum and maximum value for the ID to skip a lot of the lines the script would have. The max should be a couple dozens higher than the current, just in case, though.
Title: Re: Admin forceclassing with scripts
Post by: ronski on Tuesday, September 08, 2015, 06:54:47 AM
I made a AFC Generator, that allows you to write totally random forceclass scripts or you can give every player the same weapon and if you want you can leave VIP out of the loop:

AFC Generator (http://susirajavolley.com/randomizer/)

To be able to use the script: type playerlist on console in game. Check out what is the lowest Player ID and if you don't want to force class VIP, check his PLayer ID too. The generator makes 2000 rows of afc rules. We need to know what is the lowest player ID on server, then we can generate enough rows starting from his ID, so it doesn't matter will server be restarted once a day / week / month / year etc. It still works. 

Now it's quite clumsy since it's made with .php, you need to generate the script in browser and copy paste the script to your .txt file. Im looking forward to do the same with javascript so all you'd need to do is save afc-generator.html file to armyops/System -folder, run the file in browser and the generator would update your .txt which includes generated scripts.
Title: Re: Admin forceclassing with scripts
Post by: teddy_grizzly_bear on Tuesday, September 08, 2015, 07:07:11 AM
You could do the same with any programming language, I imagine it's no more than a dozen or 2 lines if code.
Title: Re: Admin forceclassing with scripts
Post by: ronski on Tuesday, September 08, 2015, 07:13:03 AM
You could do the same with any programming language, I imagine it's no more than a dozen or 2 lines if code.
Yea it could be done, internet-world is the one Im familiar with, so that's why I chose php to create the first version of it.
Title: Re: Admin forceclassing with scripts
Post by: teddy_grizzly_bear on Tuesday, September 08, 2015, 08:01:22 AM
A simple (or simple enough I suppose) python version that can be run from the terminal using python:
Code: [Select]
import random
classes=["r", "m", "m4a1auto","ar", "g","at4",
         "s82", "s24", "spr", "m9","b","sf","ak",
         "ak74su", "gp", "rpg","rpk", "svd","mos",
         "v", "sl", "ft", "rct", "d", "bdm"]

try:
vipID=int(float(raw_input("VIP ID\n")))
except ValueError:
vipID=0
to_fc=raw_input("Which class would you like?\n")
if to_fc in classes:
classes=[to_fc]
else:
print "Random of classes:", classes
try:
minID=int(float(raw_input("Minimum ID\n")))
except ValueError:
minID=0

writestr=""
for id in range(minID, minID+250):
    if id != vipID:
writestr+="admin forceclass "+str(id)+" "+classes[random.randint(0,len(classes)-1)]+"\n"
f=open("now.txt",'w')
f.write(writestr)
f.close()
Title: Re: Admin forceclassing with scripts
Post by: ronski on Tuesday, September 08, 2015, 08:20:24 AM
A simple (or simple enough I suppose) python version that can be run from the terminal using python:
Code: [Select]
import random
classes=["r", "m", "m4a1auto","ar", "g","at4",
         "s82", "s24", "spr", "m9","b","sf","ak",
         "ak74su", "gp", "rpg","rpk", "svd","mos",
         "v", "sl", "ft", "rct", "d", "bdm"]

try:
vipID=int(float(raw_input("VIP ID\n")))
except ValueError:
vipID=0
to_fc=raw_input("Which class would you like?\n")
if to_fc in classes:
classes=[to_fc]
else:
print "Random of classes:", classes
try:
minID=int(float(raw_input("Minimum ID\n")))
except ValueError:
minID=0

writestr=""
for id in range(minID, minID+250):
    if id != vipID:
writestr+="admin forceclass "+str(id)+" "+classes[random.randint(0,len(classes)-1)]+"\n"
f=open("now.txt",'w')
f.write(writestr)
f.close()
Which is easier then, run python in terminal or just copy paste the code from browser to .txt file :)
Didn't think at all that writing to .txt file with javascript is not going to work. Javascript inside browser can't access to filesystem, it's a security risk. It could be done with Microsofts activeXobjects but since Im on mac, I hate even thinking about doing windows-only stuff :D

With HTML5 Blob object you'd be able to create downloadable .txt files, but it'd be still too clumsy. With PHP it would be so easy to open - read - write and save files, but to be able to handle .php you'd need to run apache on your computer..
Title: Re: Admin forceclassing with scripts
Post by: teddy_grizzly_bear on Tuesday, September 08, 2015, 09:25:20 AM
For me, python is easier at this point, but I suppose it's personal preference.

By the way, some of those don't end with anything in your version, like:
admin forceclass 114

I don't know if that's deliberate...
Title: Re: Admin forceclassing with scripts
Post by: ronski on Tuesday, September 08, 2015, 09:57:19 AM
For me, python is easier at this point, but I suppose it's personal preference.

By the way, some of those don't end with anything in your version, like:
admin forceclass 114

I don't know if that's deliberate...
Oh of course. Im reading weapons from array, which has 25 weapons on it. And Im using rand(1,25) :)) So the  first value of array (0) is never used at all and value 25 is empty, the range must be 0-24.
Title: Re: Admin forceclassing with scripts
Post by: ronski on Wednesday, September 09, 2015, 05:16:58 AM
Okay "afc" and "admin forceclass" are not the same, first one forceclasses everyone on server, another one together with player id forceclasses only one player, but I found another difference between these two rules. Spectator Admin can forceclass with "admin forceclass" -rule only these guns : m9, m, r, m4a1auto, ar, g, at4, sf, ak, ak74su, gp, rpg, rpk, rct, d, bdm. Playeradmin can forceclass any gun with the same rule.
Title: Re: Admin forceclassing with scripts
Post by: ronski on Thursday, September 10, 2015, 05:44:04 AM
I updated the generator, it has now a few weapon selections, from where you can draw your own random weapon set with player id's you want. Weapon sets are: "All Guns", "Snipers", "Guns With No Nades", Guns With Lots Of Nades" and "MASS DESTRUCTION" :D which have the rest of the guns that have G, rockets etc. To get totally random weapons make sure you generate new script for every use. Also you can generate numerous amount of "random" scripts to be ready to be used, but remember that VIP can't be force classed, on VIP maps to be able to use force classes you can't use on beforehand generated scripts because VIP's playerID will most likely not be the same anymore.   

Spectator admin can't forceclass all weapons, but spectating- or playing serveradmin can.

admin forceclass generator (http://susirajavolley.com/randomizer/)