New Scripts: tnhScript 2.1 [final] Public Scripts 2.1 [second test] - by Telliamed
R Soul on 7/3/2009 at 00:24
It seems that OnScreenText will crash if there is no design note. It can be empty, but it must be there.
I've also encountered something strange. In my FM I have a couple of convs for which OnScreen text is being used to display subtitles. As each line is said, the actor frobs an object.
To save objects, I combined NVRelayTrap and OnScreenText, so that the former sent TurnOn to itself each time it was frobbed. With the previous version of tnhScript this worked as expected: each frob would show the correct page. With the current version it would only show the first page. I fixed it by separating OnScreenText and NVRelayTrap, so that two objects are now used. I just thought I'd mention this in case it turns out to be connected to something more significant.
Telliamed on 8/3/2009 at 16:11
Quote Posted by R Soul
It seems that OnScreenText will crash if there is no design note. It can be empty, but it must be there.
Quote Posted by me
Found a nasty bug that affects
OnScreenText.
I can't do any testing for a week. I'll have to look at the deal with NVRelay when I get back. If this is a developing mission, I have my own Frob->TurnOn trap that's a bit simpler than that. Or you should be able to do something with ScriptControl instead of frobbing.
R Soul on 8/3/2009 at 20:36
I've read the instructions several times but I still haven't a clue how to use ScriptController.
I want to have a conversation AI to send TurnOn to a trap (let's pretend I haven't just remembered NVConvEnhancer). So you're saying I can use ScriptController to send the TurnOn message? This is where I'm stuck.
I have a conv action which is ScriptMessage: TurnOn
The AI has the script ScriptController, and design note on="TurnOn", and a CD link to a trap (OnScreenText). The trap is receiving the ScriptControl message, but I don't know how to configure it to respond to it.
I thought I could put on="ScriptControl" in the design note, but it still wouldn't activate it.
Telliamed on 9/3/2009 at 19:18
You've got it backwards. ScriptControl is an alternative to TurnOn. The on parameter tells the script what to do when the trap is turned on. ScriptControl activates the script directly. A TurnOn with ''on=3'' is the same as sending ScriptControl with the message argument ''3''.
To control OnScreenText you put ScriptController on the AI. Instead of the frob action do a script message action. Message name (argument 1) is ''ScriptControl''. Message data (argument 2) is ''#1'' to display page 1. Other message data (argument 3) is the OnScreenText trap name or object ID.
NVRelay can be translate the ScriptControl for traps that only understand TurnOn. (But then, you can use any message you want, like "JustWorkDammit".)
When you get the hang of it, it would be nice to fix up the wiki so it's more understandable. I also need to add a page to explain inheritance. It's second-nature to a programmer, but you mere mortals seem to have trouble with it. :angel: (Short lesson: See that box that says "Inherits: ..."? Click it.)
R Soul on 10/3/2009 at 16:18
I think I understand the principle.
The ScriptControl message can be sent to allow greater control over how the target object responds, if the target object uses something from tnhScript.
The message can be sent from conv, thus:
Action: ScriptMessage
Argument 1: ScriptControl
Argument 2: message data - depends on the target object
Argument 3: name/ID of target object
If argument 3 is empty, the message will be sent along outgoing ControlDevice links.
The conversation actor must have the script ScriptController.
To have it sent from an ordinary object, give it the ScriptController script, and use the design note to specify the argument:
on="message data"
I know I can then make a CD link to the target object, but out of curiosity, could another design note parameter be used to set the target object?
Which other scripts can respond to ScriptControl?
Telliamed on 11/3/2009 at 13:56
Would a target parameter be that more useful than a CD link?
(Yes, so you could type "^guard" or whatever ... I'll think about it but may decline. And it's not going to be in this release in any case.)
Remember also that you can put the target script directly on the AI instead of using ScriptController. But there are often side-effects (AI become frobbable when dead, etc.).
R Soul on 11/3/2009 at 15:48
Quote Posted by Telliamed
Would a target parameter be that more useful than a CD link?
Probably not, I was just curious.
Telliamed on 20/3/2009 at 20:51
I've uploaded a new version that, as far as I know, works perfectly.
And the issue with OnScreenText, I was being really dumb about. Forget what I said earlier, NV. I forgot the "!" in if (!pProp->IsSimplyRelevant(iObj)) so of course it wasn't working. Check your copy of the source for that.
Nameless Voice on 20/3/2009 at 21:30
Right, that makes sense. And it looks like I just put in the version you sent me, so I'd gained that bug, too. Fixed.
Zontik on 8/4/2009 at 11:31
New version seems work fine under Windows 98! I had problems with ver 1.5.4 - DromEd crashed after exiting game mode. Now everything is OK.
(I'm working under XP, but have Win98 and DromEd on another machine.)
How do you think, will it be wise to drop Tnhscript 1.5.4 from the mission I'm building and load new module version instead?