ID:156171
 
Hey guys! I'm trying to make this code below work:
mob
proc
NPCChat(var/N,var/T1,var/T2,var/T3,var/T4)
if("[N]2" in QuestList)
alert("[T4]","[N]")
QuestList -= "[N]3"
QuestList += "[N]4"
return
if("[N]2" in QuestList)
alert("[T3]","[N]")
QuestList -= "[N]2"
QuestList += "[N]3"
return
if(N in QuestList)
alert("[T2]","[N]")
QuestList -= "[N]"
QuestList += "[N]2"
return
else
alert("[T1]","[N]")
QuestList += "[N]" // Add name to Quest List
return

QuestList is a mob/list used to store NPC names for quests.
N is the name of a mob being passed as an arg, and T1-4 are text vars being passed as vars.

Now the idea of this chat code is to universally work for any NPC you talk to. They each have different text vars, fromm text1 to text10. This code can reach up to 10 levels, but I decided 4 was enough to get the point across. I understand that the QuestList-="[N]2" and lines of that nature are incorrect, I was just wondering how I could make this code A: function :P and B: retain its universal nature and function. If more information is required, please let me know!
use a datum

also from your code, npcs would be named bob; bob1; bob2 ?

if you read up on datums and are still stuck you should ask for more help :)