ID:1927930
 
(See the best response by Kaiochao.)
Hey so how do I basically make it so that you get random npc dialouge like a rpg that makes it so that there is more realisim. I tried to do view()<<"Jerry: Hey! Welcome to the WaterHole!" right under icon_state = "". ALso how do I make it loop? So that it keeps going over and over with other sentences and stuff.
Best response
You want NPCs to randomly say a line periodically?
    // define a list of things to say
var speech_lines[] = list(
"Hey! Welcome to the WaterHole!",
"blah blah",
"etc."
)

// define the time between speech (100 is 10 seconds)
var speech_period = 100

// when an NPC is created
New()
..()
// start the speech loop (spawn so the loop doesn't interrupt code)
spawn SpeechLoop()

proc/SpeechLoop()
// repeat forever (as long as src exists)
for()
// wait until the NPC should speak
sleep speech_period

// say a random line
view(src) << "[src]: [pick(speech_lines)]"
Question how should I put that, I know it sounds dumb but I am confused with the spaces.

mob
TestNPC
icon = 'NPC.dmi'
Shop/icon_state = "Shop"
In response to Dayvon64
Put it where you want it.
I am just so confused
In response to Dayvon64
This is how indentation works:
object_type
// object_type inherited variables
inherited_variable = overwrite_value

// object_type variable definitions
var
variable_definition = initial_value
variable_definition = initial_value
variable_definition = initial_value

// object_type inherited procs
InheritedProc(Args)
..()
proc_statements

InheritedProc(Args)
proc_statements
..()

InheritedProc(Args)
proc_statements

// object_type proc definitions
proc
ProcDefinition(Args)
proc_statements

if(condition)
condition_success_statements
else
condition_failed_statements

proc_statements // (condition ignored)

ProcDefinition(Args)
proc_statements

while(condition)
condition_success_repeated_statements

proc_statements // (after while() stops repeating)

ProcDefinition(Args)
proc_statements

spawn(optional_time)
spawned_statements
spawned_statements
spawned_statements

...

child_type
// child_type stuff
...

Compact form of various things: (slashes replace newline+indent)
object_type/inherited_variable = overwrite_value

object_type/var/variable_definition = initial_value

object_type/InheritedProc(Args) single_statement

object_type/proc/ProcDefinition(Args)
proc_statements
proc_statements
proc_statements

object_type
proc/ProcDefinition(Args)
proc_statements
proc_statements
proc_statements

object_type/child_type/...

Congrats, you've read Chapter 2 of the DM Guide. Now go read the rest of it.
I know how to indent....