i am very new to programming, so pardon all that comes with that please.
I am creating a sample game based off of a basic house design, more to explore design and proper coding than make a functional game at this point. i am having problems making an NPC cat. i would like the player to be able to pet the cat but cannot figure out how to do that since it is not a predefined action. I was able to define it, place it in a room and give it a HermitActorState as well as a noResponse property. But instead of âtalk to catâ i would like to be able to input the command âpet catâ or âpet the catâ.
Here is the code i am working with:
sara : Actor 'calico cat' 'cat' @kitchen
"The cat is a rather large female calico, the tag on her collar says her name is Sara. "
;
+ HermitActorState
specialDesc = "a calico cat lies on the ground by the food bowl, her tail thwacking loudly on the floor. "
noResponse = "The cat is busy ignoring you right now. She licks her paw while keeping an eye on you. "
isInitState = true
;
i do not think i know enough about programming to do this on my own. does anyone have any details they could share?
Hi! I was new to programming too, when I started TADS. However, if you hope to do anything with TADS at all, youâll really want to read through some of the helpful documentation (not sure if youâve already tried). There are whole sections in the Technical Manual, Getting Started, and Learning TADS 3 that talk about creating new verbs. Hereâs a quick bit of code though:
DefineTAction(Pet) ;
VerbRule(Pet) 'pet' singleDobj: PetAction
verbPhrase = 'pet/petting (what)' ;
modify Thing
dobjFor(Pet) { verify() { illogical('It\'s kind of weird to be petting that. '); } }
;
cat: Actor 'cat' 'cat' "The cat's description. "
// other cat properties...
dobjFor(Pet) { verify() { } // an empty 'verify' means it won't be immediately disallowed
action() { "You pet the cat, who subsequently considers you one of the finest people around. ";
// and potentially other stuff like...
// cat.setCurState(catHappy);
// cat.hasBeenPetted = true;
} }
Thank you. I have all the documentation and am reading through all of them as i go. i even used the library to see if it was already defined. I honestly donât think I could have figured out how to make my own verb on my own⌠not at this stage. But knowing that, going forward, I can use this snippit as a baseboard for future needs. I really appreciate it.
problem is, all the material assumes you are already a programmer and you decided to learn TADS as well. I am not much of one and this assumption in all the documentation leave gaps i need to fill with guesses. so again, thank you.
Learning TADS 3 may be the best first read. There are sections in there called âCoding Excursusâ which are geared more for people like you and me⌠but I grant, even so, thereâs a lot new to learn and think throughâŚ