Reset Password
Existing players used to logging in with their character name and moo password must signup for a website account.
- QueenZombean 1s
- BigLammo 6m youtu.be/NZR4EeTkRqk
- zxq 2m
a Mench 11m Doing a bit of everything.
- SmokePotion 16m
- Ameliorative 5s
- connorf88 12h
And 29 more hiding and/or disguised

Part 2: Situtation-Centric Scripting
Now you can live vicariously through the NPCs!

Well ladies and gents, it's been a while, but I'm finally back with Part 2: Situtation-Centric Scripting.

Up until now you've always written scripts based upon the assumption that you have to start from scratch, and build up your script; creating, naming, describing and moving your rooms, npc, items, and forcing people to do things.

The point of Situtation-Centric Scripting is you can make assumptions about the 'context' in which the script is running, greatly reducing the ammount of work that accualy has to go into your script.

Let's start with an example:

Normally to make a NPC do something you'de have to create, or find the npc, and basically set him up. Well, there's accualy a way to run a script in the 'context' of a existing NPC doing something in response to a player. This is called an NPC-Centric Script. This allows us to basically do away with the work necessary to create or find the NPC, and force him to do things. We can simply assume that were running under the 'context' of a NPC, and use NPC specific commands like the following.

emote "eyes %N warrily."
to %player "Are you sure you really want to do this?"
to %player "Because if your not sure, you should walk away right now."
do "remove overcoat"
do "give overcoat to %N"

Now you'll notice that I've not specified WHO is doing this emoting, talking, and acting. Astute observers will also take note of the complete lack of pauses.

Yes, that's right ladies and gentlemen, no more pauses. You see, this is a NPC-Centric Script. It runs in the context of a NPC, so whichever NPC is running this script, he/she's the one who's doing these actions. %player is not the NPC. %player is the person who did something to cause this NPC to run this script. And example of this is they said a keyword, or handed them a package or something like that. If your wondering, the NPC is avablie in the script as %npc. But you probablly won't use that.

'But why no pauses!?' I'm sure your screaming by now. Well, I'll tell you.

All NPC centric commands are 'queued' for replay, and -AUTOMATICALLY- paused, based upon their lenght; That is to say: The longer the command, the longer the pause after they say it before they say the next thing.

Neat, huh?

'So it's really that easy?' Well, almost. There's one thing you have to do to make your script a NPC-Centric Script.

You have to make the FIRST LINE in your script:
uses $npc_centric_script

This tells the Scripting engine to use a different script runner than the default script runner. The $npc_centric_script defines ADDITIONAL commands which are NPC centric specific. So you get all the commands you have in a normal script, AND in addition, you get the NPC centric script commands. But as you can see, the NPC centric ones make alot of the normal commands unnecesssary.

In case your wondering, if you don't specify a 'uses' line as the first line, it's assumed you'll be using the $default_script runner. This is identical to having the first line in your script being:
uses $default_script

So in conclusion, you should be writing "NPC-Centric Scripts" when you have a existing NPC doing something in response to something, and "regular" scripts when your just doing general ambience spoofing or dreams or things like that.

So, here's the command reference:

say STRING message
 <message> is the message you want the %npc to say
 If %npc is not defined, an exception will be raised.
 This uses $npc_centric_script:pronoun_sub, see its help.
 Ex. say "I'm gonna keel you!"

to OBJ player, STRING message
 <player> is the player to talked to directly
 <message> is the message you want the %npc to say
 If %npc is not defined, an exception will be raised.
 This uses $npc_centric_script:pronoun_sub, see its help.
 Ex. to %victim "I'm gonna keel you!"

do STRING action
 <action> is the command you want the NPC to 'type'
 If %npc is not defined, an exception will be raised.
 This uses $npc_centric_script:pronoun_sub, see its help.
 Ex. do "kill %N"

emote STRING action
 <action> is the command you want the NPC to 'emote'
 If %npc is not defined, an exception will be raised.
 This uses $npc_centric_script:pronoun_sub, see its help.
 Ex. emote "does a really long emote."

mumble STRING action
 <action> is what you want the NPC to 'mumble'
 If %npc is not defined, an exception will be raised.
 This uses $npc_centric_script:pronoun_sub, see its help.
 Ex. emote "does a really long emote."

whisper OBJ player, STRING action
 <player> is the player to be whispered to
 <action> is the command you want the NPC to 'whisper'
 If %npc is not defined, an exception will be raised.
 This uses $npc_centric_script:pronoun_sub, see its help.
 Ex. whisper %victim "I'm gonna enjoy slicing you open and eating your liver!"

ooc STRING action
 <action> is what you want the NPC to 'ooc'
 If %npc is not defined, an exception will be raised.
 This uses $npc_centric_script:pronoun_sub, see its help.
 Ex. ooc "Quite with the OOC already!"

social STRING action
 <action> is what you want social you want the NPC to do
 If %npc is not defined, an exception will be raised.
 This uses $npc_centric_script:pronoun_sub, see its help.
 Ex. social "smile %N" would make him smile at %player

I'm sure there will be questions concerning this. Feel free to post, and bug me to try out your scripts.

-Kevlar

No questions? Bueller? Bueller?
*raises hand furitively*

Ooh ooh! I got a question...

If you're doing a npc-centric script, and you want to control another npc in the room or out of the room(move %npc#2 to ...) for that matter, how do you address them?

Also, in 'Loan Shark Scripts' someone said to "find the other NPCs to control them". If we should do that, how do we know what their names are to find them, or will you tell us/change it yourself?

Ah! A astute question.

Well... you COULD 'find' them by name, or have them passed in as %npc2, and %npc3 (this requires a special verb to be written by a coder to support this).

But I gotta tell ya, the best way I can think of doing it is to make another $npc_centric_script to be run in the context of the other NPC.

When you go to burn this bridge, let's have a converstaion about what it is you want to do, and come up with a good solution for that specific situtation. Cool?

-Kevlar

::cool:: Yeah, cool. ::cool::

Where do other objects come in? Like what category($player, $npc, $room, ?) do things like weapons, chyen, drinks, clothing, etc fit into?

(Edited by Hunter at 10:12 pm on Oct. 20, 2002)

Alrighty I'm -still- working on that Detox thing trying to get it to run correctly,  I got the procedure part done and it parses,  but I'm having trouble with the 'if' statement for when someone asks the doctor for the procedure.  this is the actuall procedure:

uses $npc_centric_script
do ".lead %N to a table and .lie them down.
tell %player "You lie back and stare at the ceiling."
pause 15
do ".say while fitting restraints around %N's wrists and feet and placing a bite guard in %o mouth, \"This is gonna hurt quite a bit.\"  then .turn, .grab a rather large syringe from a drawer and .fill it with a bright orange liquid."
pause 10
do ".place a hand on %N's shoulder and .drive the syringe into the center of %o chest.
tell %player "Your veins fill with fire and the world drops away as the syringe empties into your heart."
pause 3
force %player ".scream in pain as I .convulse uncontrolably, my arms and legs pulling the restraints to their limit. Sweat  covers my body immediatly as the injection does it's work."
pause 20
tell %player "The pain continues to rage on and you want it to end so bad death is a welcome prospect."
pause 15
tell %player "There is a bright flash of light and the world goes dark."
create $dream_room "%room"
rename %room "Firepit"
describe %room "You can see or hear nothing except the fire that consumes you. A pain like no other you have ever felt cripples you, all you can do is lie there and burn."
avatar %player $dream_avatar "%avatar"
move %avatar %room
pause 30
force %avatar ".scream out but no cry is heard.  My arms and legs .flail about trying to douse the flames that envelope them.
tell %room "%player flails about on the table, a look of horror and unbearable pain twisting %o tear streaked face.  %S cries out that %s's burning and begs for someone, -anyone- to extinguish the flames."
pause 15
tell %avatar "You writhe in agony and pray for any possible release as the flames char your flesh, your hands and feet already turned to ash and thrown to the wind in your thrashings.  Tears roll down your face as you continue to cry out in a silent voice."
tell %room "%N continues to convulse on the table %o screams becomming more and more hysterical, \"Please....OH GOD PLEASE!!!  PUT IT OUT...SOMEONE HELP ME, PLEASE SOMEONE PUT OUT THE FIRE. AHHHHHH!!!!!!!!!!!!\""
pause 5
tell %avatar "The blackness begins to flicker.  Bits of the real world cropping up around you, standing there faintly only for moments then fading away."
pause 10
tell %avatar "The world goes black and the pain is replaced by a dull ache."
pause 60
force %avatar ".open my eye's slowly and it takes me a minute to realize where I'm at."
unavatar %avatar "%player"
tell %player "Your vision clears and you can hear the voices around now.  Your body aches and you feel as if you haven't slept in months"
pause 15
force %player ".look around the room your gaze finally finding the doctor. I .ask \"Is it over?\""
pause 15
do ".nod and while undoing %player's restraints  .say, \"Physically it's over,  you'll need at least 12 hours of sleep, and I'm going to give you an injection of protiens to help to balance what you lost through the detoxification process.\""
pause 2
do ".grab another syringe and .jab it into %N's arm without waiting for a response."
pause 5
force %player ".stand up wearily from the table rubbing your torn and bruised wrists and ankles."
pause 5
do ".takes a look at you with his moniters and evaluates the readings.  He then administers first aid to the injuries you incurred during the procedure."
to %player "Your all done, now go home and lie down."

That all runs fine, this is the part that I'm getting the error on:

uses $npc_centric_script
if match %phrase "I need" or "I want" and "detox" or "detoxification"
to %N "Alright, I'm glad to see you want help.  The whole process is gonna take about half an hour, and cost you 7500 chyen.
else
do ".Shrug and .say, \"I'm a busy man pay for a service or let me go about seeing to my other patients.\""
endif
__________this is the error I get_______________
Error while running 'Detox Speech', on line 1:
Error while calling 'if' with ', I need, I want, detox and detoxification'
Error while calling 'I want' with '': Verb not found

Maybe I'm a dumbass but I don't understand what I did wrong.  If anyone has an idea please clue me in.

When you use the if command with booleans in this scripting language, unlike some obj.-oriented languages, you need to put the 'match' command before every condition. This is what I used, to fix the problem that you were having. Feel free to check this exact code to see if it works.

*begin code*
uses $npc_centric_script
if match %phrase "need" or match %phrase "want" and match %phrase "detox" or match %phrase "detoxification"
to %N "Alright, I'm glad to see you want help. �The whole process is gonna take about half an hour, and cost you 7500 chyen."
else
emote "shrugs and says, \"I'm a busy man! Pay me for a service, or let me go about seeing to my other patients!\""
endif
*end code*

(sorry, I fixed some grammar issues too...)
This is how you need to phrase all conditions using AND, OR, NOT, or any combination of them if you can. I think Kev will back me up on this, but if I'm wrong, please feel free to shoot this post down in flames. Peace!

Well that fixed it as far as I can tell.  It parsed correctly.  Thanks much!.
I couldn't find this in the manuals, but how do you reference the incoming text from a player in one of these scripts? Like which variable would you use for the one allandra called %phrase? I know in the manual it gives an example of if using %message, and I didn't know if that was system or script-defined. Would appreciate the help.
-Rob
Its not there by default, it would have to be setup by the verb that runs the script.
To sort of organize all of my previous posts/ideas:

What I want to do is create three seperate $npc_centric_scripts to be run by three npc's together. What I need to know is:

what variable to check for triggers FOR the second and third NPC's scripts FROM the first.
ie: NPC1 shrugs. Trigger NPCs 2 and 3 to chuckle and shrug also. Send NPCs 2 and 3 into a waiting loop for next trigger.

how to create/destroy $rpg_things per-character
ie: NPC1 seizes your gun while saying "Sorry, no weapons allowed!", your gun disappears from your inventory.

how to address holograms($holographic_advertisment_script) by name.
ie: The hologram of John Doe gets something out of his pocket. OR John Doe gets something out of his pocket.

If anyone could help me out with this, i'd appreciate it.
Also, if it's possible - can we come up with some standardized verbiage to pass spoken/acted strings on to the script? Like so every script can use the same %string or %message from the player to the NPC? Just some ideas.

*looks around bewildered*  Your gun just disappears from your inventory? Is that merely an example or is that actually what your trying to do with a script?
Quote: from Hunter on 11:24 am on Oct. 27,
how to address holograms($holographic_advertisment_script) by name.
ie: The hologram of John Doe gets something out of his pocket. OR John Doe gets something out of his pocket.

You get a blank hologram, which means you rename it to whatever you want, your script should include the naming of the holo.

So it's not a bad thing if I wanted to name one:
'A hologram of Sally Squeeze' or 'the Hologram of Suzy Strip'? Heh, just an idea.

The 'gun disappearing from your inventory' is mostly an example - like if you went to the loan shark and some goons patted you down and 'held onto your gun for you'. You should be able to move $rpg_things from one char to another right? And then just tell the player some nice little:
"Guido pats you down, and upon finding your " %weapon ", he takes it telling you, /"You'll get this back when you leave, we can't have weapons in by Mr. Andolini...I'm sure you understand./"

Ya Know?

(Edited by Hunter at 12:47 pm on Oct. 30, 2002)