ID:171725
 
Is it possible to make it so a user can make an NPC that defines a new variable for another player that talks to it, then have the player talk to a second NPC and change the variable, without making mob/var/tempvar1, mob/var/tempvar2/, mob/var/tempvar3/ etc hard-coded into the game?

Example:

Player1 joins world

Player1 makes NPC "Bob"

Player1 makes NPC "Signpost"

Bob says "Go read the sign over there" if the new var, "tempvarwhatever", is not 1, and he says "Hello" if it is set to 1.

Signpost says "This is a sign. You are reading this." and sets "tempvarwhatever" to 1. Now Bob will say "Hello" now that you've read the sign

Player 2 joins the world

Player 2 talks to Bob, then reads the sign.

Player 2 talks to Bob again, and gets a new response


(I really didn't need an example I'm just bored)
Is there a way to do this without hard-coding "tempvarwhatever"? I don't expect there to be, just it takes a while to do CTRL+V, 1, CTRL+V, 2, CTRL+V, 3, etc, =(
You don't need a variable for each thing, instead you could have a single variable that changes.
mob
var/signquest=""
NPC
verb/talk()
set src in oview(1)
switch(usr.signquest)
if("")
usr<<"Go read the sign."
usr.signquest="read sign"
if("read sign")
usr<<"Go on, read it."
if("talk")
usr<<"I bet you couldn't figure out how I did that."
usr.signquest="finished"
if("finished")
usr<<"What do you want from me? Go on."
obj/sign
verb/read()
set src in oview(1)
switch(usr.signquest)
if("")
usr<<"This sign is blank."
if("read sign")
usr<<"The sign looks different than before. Sign reads "Talk to the person again."
usr.signquest="talk"
if("finished")
usr<<"This sign is blank."

One variable covers it all. You can take it even further and have a single variable for all quests. Have a quests list and add a quest name when a quest is recieved, and make good use of associative lists by setting the quest name in the list to equal the status of that quest.
In response to Loduwijk
I was meant to not have the sign coded into the game at all, like players could make the signs/NPCs. I could use the list idea though that'd work