Being Stupid
So Im writing a new interface for launching fighters and retrieving fighters (as well as other things).
I'm using the HTTP interface and working well (ish) so far. (bear in mind my programming skills are limited).
$.ajax({
url:"/exec.lua",
method: "POST",
data: "ECHO1 = PlayerSpaceship():setCallSign('ECHO-1'):setFaction('Human Navy'):setTemplate('Player Fighter'):setPosition(-8000, 15000)"
}).then(function (data) {
//success callback
console.log(data)
})
Is the command to spawn a new fighter in a set posistion.
But for some reason I cannot work out how I destroy the same fighter.
$.ajax({
url:"/exec.lua",
method: "POST",
data: "ECHO1:destroy"
}).then(function (data) {
//success callback
console.log(data)
})
Is the code but its not working, Ive tried not just destroying but changing any attribute.
Now Im pretty sure Im missing the obvious since the guide says
_OBJECT_=someObjectGetter()
to select a different object rather than the active player. OK but how would that work in this instance? Could someone give an example?
I'm using the HTTP interface and working well (ish) so far. (bear in mind my programming skills are limited).
$.ajax({
url:"/exec.lua",
method: "POST",
data: "ECHO1 = PlayerSpaceship():setCallSign('ECHO-1'):setFaction('Human Navy'):setTemplate('Player Fighter'):setPosition(-8000, 15000)"
}).then(function (data) {
//success callback
console.log(data)
})
Is the command to spawn a new fighter in a set posistion.
But for some reason I cannot work out how I destroy the same fighter.
$.ajax({
url:"/exec.lua",
method: "POST",
data: "ECHO1:destroy"
}).then(function (data) {
//success callback
console.log(data)
})
Is the code but its not working, Ive tried not just destroying but changing any attribute.
Now Im pretty sure Im missing the obvious since the guide says
_OBJECT_=someObjectGetter()
to select a different object rather than the active player. OK but how would that work in this instance? Could someone give an example?
Comments
There is no perfect solution for this yet. But you can set custom values on any object. And then use that custom value to find your ship again.
So you could:
Course having a Screen just for Custom Script buttons would be best so you can have someone who's responsibility is to handle Launching and Docking of Fighters.
Hence HTML is what Im using as I know it best. But open to ideas
The issue would be you'd have to use one of the existing stations to do this right now.
One of the benefits with the HTML code you could use it with any scenario; custom or not. I'm running functions for convention play that allows us to fix/break the ship as well as other settings for beginner or advanced crews. That being said you are trying to do is a little more advanced than us. You would have to query the game more with your scripts to make sure things exist and get information on them before firing off commands.
If a new custom (empty) screen was added to the code in the game itself you could have it in your scenario and make a custom station in the LUA code with the buttons kicking off what you want to do. That would require a bit more work, but not impossible as I was playing with this a while back, but never did anything with it.
$.ajax({
url:"/get.lua",
method: "POST",
data: "hull=getHull()",
datatype: "text",
success:function(result){
document.getElementById("test").innerHTML = result;
//for pumping to a popup -- alert (data)
}
});
I get a {} result. Which obviously Is not what I expect. All help welcome otherwise Ill have to ponder till Thursday.
Marvelous another thing sorted.