ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Tue Sep 25, 2018 1:28 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: how to use rng?
PostPosted: Thu Jul 10, 2014 11:02 am 
Offline
Higher

Joined: Mon Aug 20, 2012 5:58 am
Posts: 69
I was trying to make a randomized chat, but kept failing at it. It seems that rng.table() or rng.percent() just doesn't work in my chat text.
I got "rng.table(greeting)" and "rng.percent(25)" directly printed out in the dialog. I guess the problem is that I haven't required rng, but I don't know how to do it.

This is my source code:
Code:
newChat{ id="Greeting",
    text = [[#light_green# rng.percent(25) .. "my friend."]],
    answers = {
        {[["Greetings. May I ask you something?"]], jump="Question"},
        {[[Greetings.]]},
    },
}


Top
 Profile  
 
 Post subject: Re: how to use rng?
PostPosted: Thu Jul 10, 2014 12:05 pm 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5755
That is because you are putting the rng functions inside the text string.

What exactly are you trying to randomise?

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
 Post subject: Re: how to use rng?
PostPosted: Fri Jul 11, 2014 12:37 am 
Offline
Higher

Joined: Mon Aug 20, 2012 5:58 am
Posts: 69
I was following the "T4 Modules Howto Guide", trying to make a randomized greeting chat like the guide do. Then since it didn't work out, I switched to another function, the rng.percent(), to see if rng functions work.

And you are right, Housepet. The problem is that the "rng.table()" mistakenly putted in a string, thank you for helping me out. It seems that I need an improved knowledge of lua syntax.


Top
 Profile  
 
 Post subject: Re: how to use rng?
PostPosted: Mon Jul 14, 2014 8:43 pm 
Offline
Sher'Tul

Joined: Fri Sep 21, 2007 3:18 am
Posts: 1081
Location: Angolwen
how to guide? pssshh. Just take something that already exists, break it, then hit it with a hammer a whole bunch of times until it sticks together and "kind of works" like I do.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group