March 28, 2024, 09:48:35

Author Topic: Problem with new Command  (Read 14384 times)

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
Problem with new Command
« on: June 16, 2014, 00:36:56 »
Hi Folks,

Currently trying to write a new command and have run into a problem, was wondering if anyone could help while I'm banging my head against a brick wall.

The problem I've got is that when I adjust the power bar on the right to speed up or slow down the ship, the tick in my command gets stopped, I need to find a way of capturing the cause and either stopping it or reactivating the command afterwards.

Any ideas...
Better to look the fool by asking, then prove them right with ignorance.

Offline GeoModder

  • Chief Petty Officer
  • **
  • Posts: 279
  • Karma: 4
    • View Profile
    • http://
Re: Problem with new Command
« Reply #1 on: June 27, 2014, 22:21:15 »
You can't put a 'tick' check on your first 'tick' command if its still working?
What is the tick supposed to do? Monitoring speed of a ship's velocity?

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
Re: Problem with new Command
« Reply #2 on: June 28, 2014, 19:06:54 »
Hi Geo,

Been a while, hope things have been good for you. Getting down to business...

I've put a debug comment on the tick to see if it's running, but even without that, it's blatently obvious that the command stops working as soon as you adjust the power levels :(

As for the command itself; this part of it is for the 'defensive'  command behaviour. What the tick is supposed to do is check for any detected hostiles and if any are found, plot a new course based on vectors from the main ship to it's destination and from the main ship to the nearest hostile. This new course should take it around the hostile and towards the target (eventually) without engaging the hostile.

At this time, as soon the slider is adjusted, the main ship goes to the last plotted point and stops.

As a work around, I suppose I could use the command that marks when you reach your destination. If a certain variable is set, it could re-enable the tick...
Possibly a bit clunky, but I'll work on it. Would welcome further ideas though.
Better to look the fool by asking, then prove them right with ignorance.

Offline GeoModder

  • Chief Petty Officer
  • **
  • Posts: 279
  • Karma: 4
    • View Profile
    • http://
Re: Problem with new Command
« Reply #3 on: June 30, 2014, 20:33:07 »
All is well at my end, and I hope 't will be too at your end. ;)

If I read you correctly, you want a ship to stay simulteneously outside weapon range from a hostile while still moving towards a predetermined point. But once you give a manual command (like adjusting power levels), it stops working. Have you tested if the same happens when for instance charging weapons or shields or enabling/disabling support devices like ECM and Sensor?
I recon the game AI is designed to stop running 'automated' commands like your tick once input from the player is detected, if said ticks directly involve an action done by the object it keeps tabs on.

Does the command stops only if you manually adjust on the right side (by the engine tabs), or also on the more general commands on the left side where you can only adjust to 100-150-200% power output for the engines?

If only adjusting power levels causes your command to fail:
If changing power levels is something that need to happen, perhaps a few extra lines in the command under an 'if' tree to start the tick back/reset when certain power level conditions are met? But that could run up your machine by ten or so lines (one for each selectable power level).

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
Re: Problem with new Command
« Reply #4 on: July 11, 2014, 23:13:52 »
Good to hear Geo,

Apologies for the prolonged absence, my poor old laptop fell over in a rather major way so I had to get another :(
Then I ended up playing The Witcher 2 to test new machine (my old one stuggled, this beastie made it fun again).

Back to business at hand though, the general commands on the left (behaviour, how much power to assign to systems) don't affect the command, but all the manual commands along the centre (the bit to turn on specific devices or target weapons, etc) and those on the right interupt the tick so we proceed to the last set destination.
So I'd go along with your assumption of manual command interuption is correct.

So the question then becomes 'How to capture these manual events?' if it's at all possible.
Better to look the fool by asking, then prove them right with ignorance.

Offline GeoModder

  • Chief Petty Officer
  • **
  • Posts: 279
  • Karma: 4
    • View Profile
    • http://
Re: Problem with new Command
« Reply #5 on: July 12, 2014, 21:38:33 »
So the question then becomes 'How to capture these manual events?' if it's at all possible.

Well, for tutorial popup purposes they can be captured, so it should be possible.
I mean during the first few missions, there's a popup with marker line to point to the manual command the game wants the player to use/learn. And I believe it moves further to the next tutorial popup (just a new block of text in the same little window) if the correct manual button is clicked.

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
Re: Problem with new Command
« Reply #6 on: July 14, 2014, 23:29:39 »
Hmmm...

I've looked through the Tutorial command itself. Unfortunately, I don't think it'll help as it's initially called from an event as opposed to clicking on a command button. From there, it starts off a chain of called rule events.

Darn the manual command panel!! Doing anything with it appears to stop the command from running... or it takes it out of the current state...? Would explain why changing the tick to a timer doesn't work.

Off to experiment...
Better to look the fool by asking, then prove them right with ignorance.

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
Re: Problem with new Command
« Reply #7 on: July 29, 2014, 23:42:21 »
Well, that took some doing. But it now works with one ship in play, multiple ships could be a problem but I'll cross that bridge later...

As suspected, any input manual control bar doesn't just stop the 'tick' part of the command, but the entire command and any attached 'includes' as well. In order to get around that, I've got to make the new command record some variables at 'U' level, which a rule from another machine can then read and check against. If the rule in the second machine can't find either the expected value or the exit value, it re-issues the command.

In trials, my ship now approaches the intended target untill an enemy tries to get too close. In which case it'll try to fly around the enemy, and if fired upon will then engage said enemy. Finally, with the enemy neutralised, our ship proceeds to it's initial destination.

Still a few things to sort out, but it's promising...
Better to look the fool by asking, then prove them right with ignorance.

Offline GeoModder

  • Chief Petty Officer
  • **
  • Posts: 279
  • Karma: 4
    • View Profile
    • http://
Re: Problem with new Command
« Reply #8 on: July 30, 2014, 11:28:45 »
You know, all that explains an inconstant problem I encountered years ago.

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
Re: Problem with new Command
« Reply #9 on: July 30, 2014, 23:54:50 »
Hmmm, I'm a little intrigued. Would you care to share any more?
Better to look the fool by asking, then prove them right with ignorance.

Offline GeoModder

  • Chief Petty Officer
  • **
  • Posts: 279
  • Karma: 4
    • View Profile
    • http://
Re: Problem with new Command
« Reply #10 on: July 31, 2014, 18:15:07 »
Simple. I was in the process of creating a mission that involved "silent running" by the player ship through manually keeping your velocity below a certain treshold. The coding involved a tick. It often worked, sometimes not, and IIRC there was no consistency in when or why it didn't work.