Register Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
ryleyra

Registered:
Posts: 2,099
Reply with quote  #1 

In another thread we were talking about scripting techniques that can be used as player feedback, without having to use console keybinds, which are problematic. A lot of these techniques, or a combination of them, are used in the TSN Sandbox and other missions for special features. However, I don't think anyone has collected all these techniques in one place, so I thought I would try to list those I can think of.

If anyone wants to add to this list, please do. Maybe this list can be collected and posted to the wiki.

Anyway, here's the list, divided by console (or consoles) responsible for that function.

Helm
 - Shields up/down - read value of property "shieldsOn" (shared with Weapons)
 - Turning left/right - read value of property "steering"
 - Not moving or Half/Full Speed - read value of property "throttle"
 - Not at Warp or Warp 1-4 - test value of "warpState"
 - Heading - read value of property "angle" (in radians, not degrees)
 - Location - test if inside or outside sphere or box
 - Range to object - test "if_distance"
 - Docked with base station - test "if_docked" (can't use with multiship)

Weapons

 - Shields up/down - read value of property "shieldsOn" (shared with Weapons)
 - Targeting object - test "if_player_is_targeting" (can't use with multiship)
 - Torpedo loaded - save count<Type> in start event, test if count<Type> decreases
 - Torp to Ene or reverse - somewhat tricky, save countHoming as above and continually save energy
       if countHoming changes, see if energy changed by proper amount

Engineering

 - Impulse Power Level - read value of property "currentRealSpeed" and compare to property
       "topSpeed", if power level 200%, real speed should be 2 * top speed. Helm will have to set
       throttle to 100% for this to work.
 - Shield Power Level - read value of property "shieldStateFront" (or Back) and compare to property
       "shieldStateMaxFront" as above. Shields will have to be undamaged. (either up or down)
 - Warp Power Level - read value of properties "currentRealSpeed", "warpState" and "topSpeed".
       currentRealSpeed = warpState*topSpeed*10*(Warp Power Level in %)+topSpeed*(ImpulsePL)
       Helm will have to be at Warp, obviously.

Comms 

 - Direct a friendly ship to heading - read value of property "angle" for friendly ship
 - Specify Torpedo for manufacture - this will take some time - read value of "missileStores<Type>"
       from base. Wait until value changes. Type that changed is what Comms selected. (Or default)
 - Tell enemy to surrender - read value of property "hasSurrendered" (enemy must surrender)

Science

nothing

Runekyndig

Registered:
Posts: 28
Reply with quote  #2 
This is really sweet, althogh I am struggling to get the weapons count to work. Never thought of using the shield status to trigger events
Dave Thaler

Registered:
Posts: 250
Reply with quote  #3 
Quote:
Originally Posted by ryleyra
- Shield Power Level - read value of property "shieldStateFront" (or Back) and compare to property

       "shieldStateMaxFront" as above. Shields will have to be undamaged. (either up or down) 



I tried this with 2.5.101 and couldn't get it to work.  Have you gotten this to work?   As far as I can tell, the power level to shields doesn't affect the shieldStateFront property.
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 1,410
Reply with quote  #4 
Artemis Armada III: Aces and Outlaws is less than three weeks away. At that time Thom will have the final version of Artemis 2.6 debugged and ready for release. I am not allowed to spoil the surprises by telling you what's included in Artemis 2.6, but I can tell you it adds significant ways for players to communicate with a mission script and vice versa.

Also, in one of the scripts I'll be releasing at that time, I successfully used currentRealSpeed to trigger script actions. It does work exactly as Ryleyra described but it takes some research. I wrote myself a special "Speedometer" mission script that could send dozens of pre-scripted messages to the main view screen based on the condition like (if 15<currentRealSpeed<17) then (send BigMessage="Speed=16"). I don't have that script any more, but it occurs to me that script writers would probably like a pack of utility scripts that helps you find that sort of data.

Ryleyra, have you had much success saving properties like Energy level or ShieldState to a variable?

__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
ryleyra

Registered:
Posts: 2,099
Reply with quote  #5 
Not really. I'd need to check my StrikeForceSeven script, but I think I may check Energy and SheildState properties. The main code snippet I find myself using constantly, though, is a position variable (x, y, and z) that "shadows" the ship as it moves around the sector. I use this for creating things that don't have the copy object functions, such as minefields.

And Dave, again I'll have to check my script but I think I used ShieldStateMax. ShieldState doesn't change with power level, it increments or decrements as ShieldStateMax changes. (Unless you set it manually)
Dave Thaler

Registered:
Posts: 250
Reply with quote  #6 
I was looking for any way to read some action from Engineering on a particular ship (in a multi-ship mission), when that ship is not moving.  So far I have not found any way that works with 2.5.101.
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 1,410
Reply with quote  #7 
There isn't really a good way for a script to read directly from Engineering. You might be able to tell the rate at which the ship is burning through energy by periodically checking the level and using a timer.
__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
Previous Topic | Next Topic
Print
Reply

Quick Navigation: