Adding words to the NLP
Now the girl only responds to you by saying you should be quiet. We want the girl to open the cell when you give her a compliment.
A good fitting compliment would be "You have nice spots".
In this tutorial we will add some extra talking to the story. We will also add a word to the NLP.
- Open the
'/ai/nlp/nlp_object.txt'
file.
Add the following code at the end of the#object_body
values:This will make spots to be allowed in sentences that describe the body.#object_body = <spot> : spot #object_body = <spots> : spot
- No lets see what happens when you talk to the alien girl using the new words.
She does not react on these sentences but the brain results will be traced to the 'trace.txt' file because we are running in debug mode.
Start the abducted story and when the alien girl is in sight speak the following sentences:- "You have lovely spots"
- "I like your spots"
- "Beautiful spots"
'trace.txt'
file. Scroll down and you should see afterCTALK: "you have lovely spots"
the brain results for that sentence namely:[state.code.ref.state.RUN0.]present.spot.pretty.you.info [state.code.ref.state.RUN0.]present.spot.pretty.you.if [state.code.ref.state.RUN0.]present.spot.pretty.you.get [state.code.ref.state.RUN0.]spot.pretty.you.info [state.code.ref.state.RUN0.]spot.pretty.you.if [state.code.ref.state.RUN0.]spot.pretty.you.get [state.code.ref.state.RUN0.]spot.pretty.you.info [state.code.ref.state.RUN0.]spot.pretty.you.if [state.code.ref.state.RUN0.]spot.pretty.you.get [state.code.ref.state.RUN0.]object.pretty.you.info [state.code.ref.state.RUN0.]object.pretty.you.if [state.code.ref.state.RUN0.]object.pretty.you.get [state.code.ref.state.RUN0.]value.pretty.you.info [state.code.ref.state.RUN0.]value.pretty.you.if [state.code.ref.state.RUN0.]value.pretty.you.get [state.code.ref.state.RUN0.]object.adj.you.info [state.code.ref.state.RUN0.]object.adj.you.if [state.code.ref.state.RUN0.]object.adj.you.get [state.code.ref.state.RUN0.]object.adj.actor.info [state.code.ref.state.RUN0.]object.adj.actor.if [state.code.ref.state.RUN0.]object.adj.actor.get [state.code.ref.state.RUN0.]object.adj.value.info [state.code.ref.state.RUN0.]object.adj.value.if [state.code.ref.state.RUN0.]object.adj.value.get [state.code.ref.state.RUN0.]info.get
The top result is the most detailed one. It says "present.spot.pretty.you.info".
If you read this backwards its meaning becomes more clear namely: 'Information: you (have) pretty spot (present time).
The bottom result says: 'You get information'. This is the most generalized result.The prefix
So lets add some code to allow the alien girl respond to the compliment.state.code.ref.state.RUN0
shows that this ref callback function is called if it exists.
- Open the
/init/story/alien/brain/ref.dat
file that contains the callbacks for the sentences. Add the following code:spot.pretty.you.get = { loc.state.pose_type = STAND; loc.state.waypoint = "waypoint2"; loc.state.speed = 0; loc.state.exact = 0; SetPose(loc.state); state.dyn.me.do.prev_state = state.dyn.me.do.state2; state.dyn.me.do.state2 = GET_COMPLIMENT; } spot.you.like.me.get = spot.pretty.you.get;
This will let the alien walk to your cell and go into the the
COMPLIMENT
state.
Add this code to the/init/story/alien/brain/run.dat
:[GET_COMPLIMENT] { [state.dyn.me.pose.result == NONE] return; // Reply to compliment talk.s = "Hmm, thank you."; talk.dur = 4.0; talk.rem.s = "I am not part of the dissection crew, but am curious how the human physiology works."; talk.rem.delay = 3.0; talk.rem.dur = 5.0; do_set_timer(12); state.dyn.me.do.state2 = GET_COMPLIMENT2; } [GET_COMPLIMENT2] { loc.ts = GetTs(); [loc.ts < state.dyn.me.do.ts] return; [state.dyn.me.do.prev_state == WALK1] state.dyn.me.do.state2 = WALK2; else state.dyn.me.do.state2 = WALK1; }
This will let the alien girl respond to your compliment.
- You have now seen most of the basic elements used when modding.
The next chapter contains the finished 'Adbucted story'.