How to remove departure message from NPC leaving a NominalPlatform

i’m totally stuck. the things i’ve tried…

so i have an NPC on a nominal platform, which describes him as leaning against a table. now when i tell him to go and sit on a chair, i’m always presented with the message that he’s getting off of the table first.
i’d really like to get rid of that, but so far no luck.
the examples i’ve read, and even the official references gave me the impression that this was a standard use case for nominal platforms, but i’m currently having my doubts. i really hope i’ve missed something obvious.
thanks!

I was just getting ready to look into that for one of my own NPCs. I’ll let you know what
I find this evening if you haven’t already got it solved…

Hi cvs… this should work. You can do a couple of things:

+ myNomPlatform: NominalPlatform
okayNotStandingOnMsg = ‘’
;

or:

myNomPlatform: NominalPlatform 
	dobjFor(GetOutOf) { action() {     
		gActor.travelWithin(exitDestination);
		gActor.makePosture(gActor.location.defaultPosture);
			 /* comment out this default report or make it do what you want*/
		 //   defaultReport(&okayNotStandingOnMsg);
        }  }
;

so there we have the missing obvious solution i was hoping for :slight_smile:
i just switched from inform 6 to TADS, and am delighted with all the new and exciting possibilities the latter has to offer, but my god - finding the correct way to do some seemingly simple things can be quite the chore. on the other hand, it’s very rewarding when i then do find the solution i’m looking for.
really appreciate your reply! thanks!

I’ve been working with TADS for about 8-10 months now, and I can’t deny, in order to go beyond a very out-of-the-box type of game, there is quite a bit of reference reading (and personal experimentation) to be done. Personally, I find it very rewarding and completely worth it, as TADS is also my first programming language of any kind, and it’s like exploring a new world for me, learning how to tweak things and make them do what you want. My own game areas are getting more and more complex programming-wise compared to the first few locations I started with, as the adv3 library and the TADS language become more natural to me.
Don’t know how in-depth you’re planning to get with TADS, but I’ve come across a number of little tricks for troubleshooting, if you’re going to be spending a lot of with it. (I’m working on a Mac, therefore without the Workbench program, so I don’t even know what kind of troubleshooting and debugging features are standard with that…)
Have you read ‘Learning TADS 3’ by Eric Eve (available as download from tads.org)? I found that invaluable in getting started. Granted, it’s not a sit-down-once-and-read kind of document…

i’ve only been using it for about two weeks now, but since my day job is programming, the language itself is no hurdle. coming to TADS with no prior coding knowledge must have been daunting, to say the least.
i’m constantly switching between all the manuals (and the library reference) on the tads-docs page, after having worked my way through the “getting started” book. i’ve already achieved things that would have been unthinkable, or at least a tremendous amount of work with inform, so i’m totally fine with getting stuck multiple times per coding session.
i’m using linux, so no workbench for me either. debugging is still a bit painful for me. i’m mostly just using the valToSymbol() method from reflect.t
i haven’t searched very hard yet, but do you know of a way to execute code directly from inside the interpreter? or is there some other debugging feature that i’m unaware of?

Ha ha, I never even noticed the valToSymbol function! I went through all the trouble to create a similar function myself called srcName (I also made a ‘srcName’ verb, so that while playing the game I could type “srcName strange object”, and it would display the source symbol for it).

As for executing code from inside the interpreter, I am not exactly sure what you mean… can you give me an example of what you’d like to try to do? After reading your post, I experimented with the DynamicFunction class and came up with this:

#include <dynfunc.h>
#include <dynfunc.t>

DefineLiteralAction(Execute)
	execAction() { local dynfunc = Compiler.compile(gLiteral); dynfunc(); } ;
	verbRule(Execute) 'execute' singleLiteral : ExecuteAction ;

Now, while playing your game in the interpreter you can type:

> execute ‘function {me.moveInto(creepyValley); me.lookAround(true); }’

and it will happen. Thanks for putting the idea in my head, I think I will find this useful as well!

It may be primitive, I don’t know, but I use the call stack line numbers whenever I get a run-time error that I can’t figure out. I have a dozen or so of the primary library files (action.t, actor.t, objects.t, thing.t, travel.t, etc…) on my desktop and I look up the line number in them to see what library method called what until the problem happened. Sometimes if I have a property or method that I wish to know what methods actually call it, I will insert a statement with an out-of-range list index or something similar, so that the runtime error pops up and I can see what library method called it…
I don’t even know what a proper “debugger” does, again, this is my first programming language and I don’t have the Workbench debugger…

Hmm, my dynamic function verb is having problems if you try to execute code that has single-quoted strings in it. I think the parser is interpreting the quote-marks as the end of your literal on the command line. Might need to mess with the parser if that became important?

that method is awesome, and exactly what i meant! such a shame that i don’t have much free time the next few days, or i’d try and fix the single quote problem myself :cry:

btw, have you ever thought of running windows in a virutal machine on your mac, so that you can use workbench? i also have a windows pc for gaming, but i’ve never had the urge to check out workbench. i think i’ll do so just to see what i’m missing out on.

btw, a quick fix for the single quote problem is to just use double quotes to surround your function. but then of course you can’t use those inside the function, though i can live with changing the surrounding quotes to what they need to be for the current command.

I think I’ve fixed the string problem, and improved this idea overall. With the new format, at the prompt you type “code” (or “exec”, or whatever you like), then it will show three dots, and all you have to type is the code statements themselves (and any nested brackets), you don’t need to type “function” or use the outermost braces… here it is:

VerbRule(Exec) ( 'exec' | 'code') : IAction execAction { 
	"..."; local str = inputManager.getInputLine(nil,nil); 
	local dynfunc = Compiler.compile('function() {' + str + '}'); 
	dynfunc(); } 
	;

> exec
… me.moveInto(creepyValley); me.lookAround(true);

You can also do

> exec
…dogBone.name = ‘dog biscuit’;

awesome idea using getInputLine() for this!

in case you don’t know already, since we’re not doing anything with the dynfunc variable here, we can just as well swap the last two lines for this one, calling the new method directly:

Compiler.compile('function() {' + str + '}')();

Thanks! I haven’t really had a game-making session since I experimented with the DynamicFunction class, so I’m looking forward to using this as well!
You’re right the combined code is more concise… when I started doing a little dabbling in Python, that was one of the things I noticed, that people’s code lines were written really compact like that… it seems that in the adv3 library code things are broken down into steps more often, maybe so that it’s clearer what’s going on?

Have you used Workbench yet? I actually downloaded VirtualBox about a week ago, then the Workbench .exe a few days ago, but do I also need to install a full version of Windows itself on my Mac? I’m on a laptop, with only about 60 gigs or so free. Is there an extremely light version of Windows to use that can just run a basic application (and is also free? :slight_smile:)?

yeah, there are lots of things to consider regarding how you write your code, but you usually don’t want to declare variables that you don’t really use. an exception would be if the method or function call returning the value is so illegible that it’s not clear what it’s returning, so that a well named temporary variable can bring you some clarity. normally you’d want to avoid that situation altogether though, and always have your code so readable that you wouldn’t need that. but when dealing with third party code like TADS, it’s of course not up to you how the internal methods and functions are called.

i haven’t gotten around to testing workbench yet.
60GB is more than enough to install windows. here’s an official iso for windows 10, that you can mount in virtualbox, and install from:
https://www.microsoft.com/software-download/windows10
you should be able to use it for a while before having to enter a key.

maybe we should switch to private messages, since we’ve strayed far from the original topic :slight_smile:

hey,
about this

Compiler.compile('function() {' + str + '}')();

i’ve found that entering something like thing.desc = "my description" will not work.
the string “my description” just gets printed, and the desc property seems to be nil.
any ideas about this?

cheers

I’m going to reply now and then go check myself, but I think I read about this situation in the manuals.
Try

myThing.setMethod(&desc, 'new description string')
1 Like

I think that will work… setMethod is what you need to use if you are going to “assign” a new double-quoted string to a property (which is not really an assignment but re-writing a method…)
You could glance at sections 4.2 and 19.8.5 in Learning TADS 3 for more info…

myThing.setMethod(&desc, 'new description string')

awesome - that does it! Thanks!