scrom / Experiments

a NodeJS text adventure - deliberately coded badly to re-experience the pain of legacy code
http://mvta.herokuapp.com/
2 stars 0 forks source link

improve "customAction" to offer additional results - and potentially much greater extensibility. #415

Open scrom opened 8 years ago

scrom commented 8 years ago

at the moment customAction is simply an array of supported custom action words. Any match on these redirects to "defaultResult".

Whilst this should continue to work, artefact and creature both have a method "getCustomActionResult" that should handle alternate results on custom actions.

we'd also need to change "getCustomAction" to alter behaviour depending on whether customAction was an object or array. (and ideally update our data).

This is all pretty viable but will need a couple of hours focus time and lots of testing.

2 further extensions of this:

I'd probably also include a +script cheat option that allows during play testing the ability to execute a preloaded script file (although this is a potential security hole if left in)

the main thing is that scripts are only executed engine-side

scrom commented 8 years ago

a good test example is the atrium guitar. it has strings that can be broken and a customAction "play". Play always returns the same result. Ideally this needs logic that checks if the strings are broken and returns a different result either way.