Author Topic: [Answered] key pressed script hook.  (Read 2646 times)

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
[Answered] key pressed script hook.
« on: July 13, 2021, 08:54:58 am »
As written, it will be useful to have possibility to use script-based keyboard actions.

First, it was an idea of some kind of report about unit shield power. If it can not be done by some bar or number in stats/mine screen/inventory, then it must be done with flash messages.

But then i found it very potent in other cases.

What do you think?
« Last Edit: February 14, 2023, 12:11:36 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9077
    • View Profile
Re: [Request] key pressed script hook.
« Reply #1 on: July 20, 2021, 06:48:44 pm »
Scripts don't affect the game flow or the user interaction.

Scripts can only stop the game flow (at a very few specific predefined points), take the current game variables, modify the (small amount of) variables they are allowed to mess with and resume the game flow.

You can imagine the scripts as x-rays from space randomly changing some variables; or as parasites changing some specific (existing) function of an animal they have infected.
They can hack some values and change the damage of your weapon from 10 to 100... but they can't add a minesweeper easter egg when the user presses ctrl+alt+win+M during the opening cinematic :)

That's as good explanation as I can provide without writing a whole book about it.
Maybe it helps.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Request] key pressed script hook.
« Reply #2 on: July 20, 2021, 07:12:56 pm »
There are some ways that you can do this with existing scripts, assuming you only have one script tag on the BattleUnit to describe the current shield HP. Create an item that is built in to the unit's armor (maybe give it to every player unit in a special inventory slot made for the purpose?). You can then either:

  • Update the ammo quantity value on the item every turn/when the unit is hit to be equal to the shield HP value.
  • Draw a colored bar on the item that gets recolored/reshaded to represent the shield HP value.

It still requires opening the inventory to see the shield HP, but it doesn't require new engine code to function.

You could also create a "weapon" that only costs 1 TU to fire (maybe refund it on hitting something?), does no damage, and on hitting a unit flashes a message with the unit's shield HP.
« Last Edit: July 20, 2021, 07:14:55 pm by ohartenstein23 »

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [Request] key pressed script hook.
« Reply #3 on: July 20, 2021, 08:43:42 pm »
Heh, its sad that IS lacks UI for show the player what is under the hood. I just use mana as shield hit points ;)

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [Request] key pressed script hook.
« Reply #4 on: July 21, 2021, 03:47:31 am »
  • Update the ammo quantity value on the item every turn/when the unit is hit to be equal to the shield HP value.
  • Draw a colored bar on the item that gets recolored/reshaded to represent the shield HP value.
Interesting idea, i admit. I'll try it.

Heh, its sad that IS lacks UI for show the player what is under the hood. I just use mana as shield hit points ;)
Yes, i use it too. But not in all cases.