Forum

> > CS2D > Scripts > intelligent speech???
Forums overviewCS2D overview Scripts overviewLog in to reply

English intelligent speech???

3 replies
To the start Previous 1 Next To the start

old Re: intelligent speech???

TimeQuesT
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
addhook ("say","iSay");

function iSay(id, txt)
	
	if (txt=="roflcopter") then
		--do action
	end

	return 0;
end


1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook ("say","iSay");

randomtable = {"hello", "ik moet kakken", "Tomate"};

function iSay(id, txt)
	
	for i=1,#randomtable do
		if (randomtable[i]==txt) then
			--do action
		end
	end

	return 0;
end

old Re: intelligent speech???

sheeL
User Off Offline

Quote
user Alexsandro has written
Hello and I am a little scripter.lua
and was wondering how to make so that the engine read my say and compare with type a goal
Ex say1 = {"Hello," Let's talk ","? "} Example if I say a sentence with these words he run a function

Sorry for not being so clear


Like This?

1
2
3
4
5
6
7
8
9
10
11
12
13
badtal={
"123",
"321",
"000"}

addhook("say","CensorText,9)
function CensorText(id,t)
     for _,word in pairs(badtal) do
          if t:lower():match(word) then
 -- your action
      end
  end
end

old Re: intelligent speech???

Alistaire
User Off Offline

Quote
Intelligent speech is easy, but it takes a whole shitload of tables and you have to write grammar rules in your script.

It would look like this;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
verbs={
	walk ={
		walk,
		walk,
		walks,
		walk,
		walk,
		walk,
		walking,
		walking,
		walking,
		etc etc.
	},
	run,
	do,
	plant,
	write,
	etc. etc. etc. etc.....
	
}
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview