Page 1 of 1
					
				Chat how-to up on wiki
				Posted: Thu Aug 05, 2010 5:07 pm
				by yufra
				The link for "Chats: Beyond Hack and Slash" on the wiki how-to page taunted me as I passed through yesterday, and since I had just spent some time using the Chat code for my module I decided to write 
a guide.  Let me know if there are any issues with it, or simply edit the wiki yourself.  Cheers!
 
			
					
				Re: Chat how-to up on wiki
				Posted: Thu Aug 05, 2010 5:40 pm
				by darkgod
				Well done Sir Knight!
			 
			
					
				Re: Chat how-to up on wiki
				Posted: Thu Aug 05, 2010 9:36 pm
				by Shoob
				hmmm, I suppose I could write up a guide on how to randomize chats too (makes the game more variable).  though I dont know how much time I have to do that.
if you want to know how to do that just use
Code: Select all
 greeting = {"Hi", "Hello", "Good day", "Bonjour", "Greetings"}
hope = {"hope", "trust", "see", "perceive"}
and then to call it:
Code: Select all
newChat{ id="hello",
    text = rng.table(greeting) .. " @playername@! I " .. rng.table(hope) .. " your quest goes well.",
    answers = {
         {rng.table(greeting) .. "!"},
    },
}
notice the use of rng.table(foo) to pick a random string and the use of ".." to combine the strings.
 
			
					
				Re: Chat how-to up on wiki
				Posted: Thu Aug 05, 2010 10:33 pm
				by yufra
				I like the randomization Shoob!