Random speaking - solved

Started by Gepard, Fri 30/10/2009 12:26:12

Previous topic - Next topic

Gepard

I have these characters that I want to speak random words in sentences. Is it possible at all? Lets say I have a list of words divided into sections. First section is something like: I, you, he, we... and words like that. Second one contains words like want, see, etc. Now I want a character to speak these words like this: First he will say a word from the first section, than word from the second section etc. Can this be done? And how?

THX
Drink up me 'arties! Yo ho!

NsMn

Code: ags

String Subject[4];
Subject[0]="My wife";
Subject[1]="He";
Subject[2]="Barack Obama";
Subject[3]="Your mom";
String Verb[4];
Verb[0]="does";
Verb[1]="gets";
Verb[2]="is";
Verb[3]="shits";
String Object[4];
Object[0]="Nothing";
Object[1]="a new law";
Object[2]="shit";
Object[3]="A present";

Display("%s %s %s.", Subject[Random(3)], Verb[Random(3)], Object[Random(3)],


Try this.

Gepard

//Dictionary
//podmet
String podmet[6];
podmet[0]="I";
podmet[1]="You";
podmet[2]="He";
podmet[3]="She";
podmet[4]="It";
podmet[5]="We";
podmet[6]="They";

//prisudok
String prisudok[8];
prisudok[0]="want"; - this is line 742
prisudok[1]="will";
prisudok[2]="enjoy";
prisudok[3]="like";
prisudok[4]="love";
prisudok[5]="want";
prisudok[6]="hate";
prisudok[7]="dislike";
prisudok[8]="will go";

//predmet
String predmet[9];
predmet[0]="cinema";
predmet[1]="hotel";
predmet[2]="swimming";
predmet[3]="something";
predmet[4]="eating";
predmet[5]="sleeping";
predmet[6]="killing";
predmet[7]="travelling";
predmet[8]="being sick";
predmet[9]="hurt you";

...

Display ("%s %s %s.", podmet[Random(6)], prisudok[Random(8)], predmet[Random(9)]);


---------------------------
Adventure Game Studio
---------------------------
An internal error has occured. Please note down the following information.
If the problem persists, contact Chris Jones.
(ACI version 2.72.920)

Error: run_text_script1: error -6 running function 'room_a':
Error: Array index out of bounds (index: 6, bounds: 0..5)
in Room 1 script (line 742)


---------------------------
OK  
---------------------------
Drink up me 'arties! Yo ho!

Gilbert

//Dictionary
//podmet
String podmet[7];
podmet[0]="I";
podmet[1]="You";
podmet[2]="He";
podmet[3]="She";
podmet[4]="It";
podmet[5]="We";
podmet[6]="They";

//prisudok
String prisudok[9];
prisudok[0]="want"; - this is line 742
prisudok[1]="will";
prisudok[2]="enjoy";
prisudok[3]="like";
prisudok[4]="love";
prisudok[5]="want";
prisudok[6]="hate";
prisudok[7]="dislike";
prisudok[8]="will go";

//predmet
String predmet[10];
predmet[0]="cinema";
predmet[1]="hotel";
predmet[2]="swimming";
predmet[3]="something";
predmet[4]="eating";
predmet[5]="sleeping";
predmet[6]="killing";
predmet[7]="travelling";
predmet[8]="being sick";
predmet[9]="hurt you";

...




Remember, the legal indices for the array blah[n] are 0 to n - 1.

Gepard

Thanks a million both of you!
Drink up me 'arties! Yo ho!

SMF spam blocked by CleanTalk