hello.
I've seen in the file ai_qct_waitjump.py that there is a call for self.XMLScript on a script.
form what I understand, this file can guide the ship, right? if yes what is the syntax of the file?
xml for self.XMLScript
Moderator: Mod Contributor
-
- Bounty Hunter
- Posts: 138
- Joined: Thu May 22, 2008 8:53 am
Re: xml for self.XMLScript
another question, can I insert a xml string instead of the path?
-
- Lead Network Developer
- Posts: 2560
- Joined: Sun Jan 12, 2003 9:13 am
- Location: Palo Alto CA
- Contact:
Re: xml for self.XMLScript
I don't know much about AI scripts, but I suspect not.
Also, a lot of the AI is coded in C++.
There are python AI scripts, but I don't think they are used ever but rarely because it may be too slow for each ship to run it many times a second (think a hundred ships like exist in a normal VS system). It looks like the last time the AI script you referenced was modified was in 2003, so there's a chance it won't work entirely correctly.
But there are AI functions you should be able to call unit.LoadAIScript("somefile.py") if you want a python AI script.
if you describe in more detail what you are trying, you may get more forum responses.
Also, a lot of the AI is coded in C++.
There are python AI scripts, but I don't think they are used ever but rarely because it may be too slow for each ship to run it many times a second (think a hundred ships like exist in a normal VS system). It looks like the last time the AI script you referenced was modified was in 2003, so there's a chance it won't work entirely correctly.
But there are AI functions you should be able to call unit.LoadAIScript("somefile.py") if you want a python AI script.
if you describe in more detail what you are trying, you may get more forum responses.
-
- Bounty Hunter
- Posts: 138
- Joined: Thu May 22, 2008 8:53 am
Re: xml for self.XMLScript
I want to cause the ship to circle a planet.
OT, can you answer my previous post at http://vegastrike.sourceforge.net/forum ... 38&t=13193 ?
OT, can you answer my previous post at http://vegastrike.sourceforge.net/forum ... 38&t=13193 ?
-
- Lead Network Developer
- Posts: 2560
- Joined: Sun Jan 12, 2003 9:13 am
- Location: Palo Alto CA
- Contact:
Re: xml for self.XMLScript
There are a lot of hardcoded scripts you can choose from (the list is in src/cmd/ai/script.cpp). Also, the ai/script directory has a lot of XML ai scripts.
maybe you want "loop around" or have a XML file call "face perpendicular" and also have a speed.
Alternatively, it should be possible to use a PlanetaryOrbit which you can do by placing the unit in orbit in the system file. However planetaryOrbit actually sets the position to the correct place in the orbit so for non-massive units this may not be the best thing.
I believe python has a LoadAIScript (or an EnqueueAIScript) whcih takes a script name as an argument. This script name can either be something in ai/script or one of the hardcoded scripts.
maybe you want "loop around" or have a XML file call "face perpendicular" and also have a speed.
Alternatively, it should be possible to use a PlanetaryOrbit which you can do by placing the unit in orbit in the system file. However planetaryOrbit actually sets the position to the correct place in the orbit so for non-massive units this may not be the best thing.
I believe python has a LoadAIScript (or an EnqueueAIScript) whcih takes a script name as an argument. This script name can either be something in ai/script or one of the hardcoded scripts.
-
- Bounty Hunter
- Posts: 138
- Joined: Thu May 22, 2008 8:53 am
Re: xml for self.XMLScript
ok, I've looked into the file you've mentioned, there are usable scripts, the questions are,
1) can I set the object that the script will cause the ship to circle around?
2) how can I call this scripts? can they be linked to a specific key stroke? how?
1) can I set the object that the script will cause the ship to circle around?
2) how can I call this scripts? can they be linked to a specific key stroke? how?
-
- Bounty Hunter
- Posts: 138
- Joined: Thu May 22, 2008 8:53 am
Re: xml for self.XMLScript
sorry for bumping this topic up but I could really appriciate an answer on this issue
thanks
thanks
-
- Lead Network Developer
- Posts: 2560
- Joined: Sun Jan 12, 2003 9:13 am
- Location: Palo Alto CA
- Contact:
Re: xml for self.XMLScript
Not sure if it's possible to call the scripts directly with a keystroke (though you can send them certain commands like formation or attack my target, so it might be possible to override one of them to be "circle around my target".
It is possible to bind keys to commands that you can type while in flight, if that is good enough, like:
'[' (brings up prompt), "/mycommand", enter
These commands are defined in "custom.py" so you can try and copy one of those examples and make it just do something simple like:
VS.getPlayer().GetTarget().ExecuteAIScript("something");
which will execute something on the player's target. Or you can search for a specific unit.
To set the object that a ship circles around you set its target (I think that's the only thing it will look at but I'm not entirely sure. Kind of unintuitive and ships can only have one target. If you want AI scripts to do special things you may have to write them in Python by extending the PythonAI class, and then you should be able to do anything you want.
It is possible to bind keys to commands that you can type while in flight, if that is good enough, like:
'[' (brings up prompt), "/mycommand", enter
These commands are defined in "custom.py" so you can try and copy one of those examples and make it just do something simple like:
VS.getPlayer().GetTarget().ExecuteAIScript("something");
which will execute something on the player's target. Or you can search for a specific unit.
To set the object that a ship circles around you set its target (I think that's the only thing it will look at but I'm not entirely sure. Kind of unintuitive and ships can only have one target. If you want AI scripts to do special things you may have to write them in Python by extending the PythonAI class, and then you should be able to do anything you want.