AU - Artificial Unintelligence
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

AU - Artificial Unintelligence

Started by Madman, 27 March, 2007, 19:29:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Madman

This script, has 2 bots that talks to each other.
It won't respond to any chat. All it will do is talk to eachother.

I belive it will be to no use for anyone...
It's was only done, beacuse i wanted to, and had some free time.
I had more idea's for Convos, but got tierd of typeing.

And as always, my best? work is done, before bedtime, just as this...

Code: lua
-- Artificial Unintelligence
-- Made by Madman

ChatTabTimers = {n=0}
tabTimers = {n=0}

-- Time Definition
Sec  = 1000
Min  = 60*Sec
Hour = 60*Min
Day  = 24*Hour
TmrFreq = 1*Sec

tConfig = {
	Bots = {
		Bot1 = "[AU]Jake",
		Bot2 = "[AU]Daniel",
	},
	Time = 1*Hour -- Time between chats
}

function Main()
	frmHub:RegBot(tConfig.Bots.Bot1)
	frmHub:RegBot(tConfig.Bots.Bot2)
	RegTimer(GetConv,tConfig.Time,"Boot")
	SetTimer(TmrFreq)
	StartTimer()
end

function RegTimerChat(Text,Interval,Id,Bot)
	local tmpTrig = Interval / TmrFreq
	assert(Interval >= TmrFreq, "RegTimerChat(): Please Adjust TmrFreq")
	local TimerC = {n=0}
	TimerC.Text = Text
	TimerC.Trig = tmpTrig
	TimerC.Id = Id
	TimerC.Bot = Bot
	TimerC.count=1
	table.insert(ChatTabTimers, TimerC)
end

function RegTimer(F,Interval,Name)
	local tmpTrig = Interval / TmrFreq
	assert(Interval >= TmrFreq, "RegTimer(): Please Adjust TmrFreq")
	local Timer = {n=0}
	Timer.Name = Name
	Timer.Func = F
	Timer.Trig = tmpTrig
	Timer.count=1
	table.insert(tabTimers, Timer)
end

function RemoveTimer(Id)
	local count,Timer2Remove = 0,nil
	for I in ipairs(ChatTabTimers) do
		count = count+1
		if string.find(ChatTabTimers[I].Id, Id) then
			Timer2Remove = count
			break
		end
	end
	if Timer2Remove then
		table.remove(ChatTabTimers, Timer2Remove)
	end
end

function OnTimer()
	for I in ipairs(ChatTabTimers) do
		ChatTabTimers[I].count = ChatTabTimers[I].count+1
		if ChatTabTimers[I].count > ChatTabTimers[I].Trig then
			ChatTabTimers[I].count=1
			SendToAll(ChatTabTimers[I].Bot,ChatTabTimers[I].Text)
			RemoveTimer(ChatTabTimers[I].Id)
		end
	end
	for I in ipairs(tabTimers) do
		tabTimers[I].count = tabTimers[I].count+1
		if tabTimers[I].count > tabTimers[I].Trig then
			tabTimers[I].count=1
			tabTimers[I]:Func()
		end
	end
end

function GetConv()
	nr = math.random(1,table.maxn(Conv))
	if math.random(1,2) == 1 then
		a = tConfig.Bots.Bot1
		b = tConfig.Bots.Bot2
	else
		a = tConfig.Bots.Bot2
		b = tConfig.Bots.Bot1
	end
	oTime = 0
	for tNr = 1,table.maxn(Conv[nr]) do
		Time = math.random(1,5)
		Time = oTime + Time
		ans = tNr/2
		if string.find(ans,"%.5") then
			RegTimerChat(Conv[nr][tNr],Time*Sec,tNr,a)
		else
			RegTimerChat(Conv[nr][tNr],Time*Sec,tNr,b)
		end
		oTime = Time
	end
end

Conv = {
	[1] = {
		[1] = "Hi",
		[2] = "Hello",
		[3] = "How are you?",
		[4] = "I'm good, you?",
		[5] = "I'm good too.",
		[6] = "Good, ttyl",
		[7] = "cya",
	},
	[2] = {
		[1] = "Tjooooo!",
		[2] = "oh, fuck...",
		[3] = "What?",
		[4] = "You have returned...",
		[5] = "Aren't you glad to see me?",
		[6] = "No.",
		[7] = "Why?",
		[8] = "I hate you",
	},
	[3] = {
		[1] = "Yoooo!",
		[2] = "My dog don't like me",
		[3] = "okey?",
		[4] = "It bit me",
		[5] = "Ouch",
		[6] = "No that's no good idea",
		[7] = "huh? what are you talking about?",
		[8] = "Yeah, I can be there",
		[9] = "WTF! WHAT'S YOUR PROBLEM? You don't makeing any sense!",
		[10] = "Wtf? What's your problem?",
		[11] = "Your chatting makes no sense",
		[12] = "I wasen't talking to you, I'm in PM with a friend, and i can't PM him for some reason",
		[13] = "...",
	},
	[4] = {
		[1] = "I'm bad!",
		[2] = "Why?",
		[3] = "Beacuse i just had sex with my girlfriends sister",
		[4] = "Was it good?",
		[5] = "Hell yeah!",
		[6] = "Sweet",
	},
	[5] = {
		[1] = "I just killed my parents",
		[2] = "lol",
		[3] = "I'm serious",
		[4] = "Yeah right!",
		[5] = "Yeah!",
		[6] = "Like i should belive that",
		[7] = "I'll PM you, my address, you can come check",
		[8] = "Ok",
	},
	[6] = {
		[1] = "Can anyone help me?",
		[2] = "Try a shrink",
		[3] = "That's not very nice :(",
		[4] = "I know :D",
	},
	[7] = {
		[1] = "Anyone alive?",
		[2] = "No",
	},
	[8] = {
		[1] = "Anyone alive?",
		[2] = "yes",
	},
	[9] = {
		[1] = "Anyone alive?",
		[2] = "No, I killed them all",
	},
}
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

bastya_elvtars

Everything could have been anything else and it would have just as much meaning.

speedX

Quote from: Madman on 27 March, 2007, 19:29:14
This script, has 2 bots that talks to each other.

What could have been more worst than this?? 1 bot talking to himself :P
Thanking You,

speedX

Madman

Quote from: speedX on 27 March, 2007, 22:03:03
What could have been more worst than this?? 1 bot talking to himself :P
No, no, no. It's 2 bot's that talk. Look:
Code: lua
Bot1 = "[AU]Jake",
		Bot2 = "[AU]Daniel",

2 Bot's, 1 script, it's a very importent diffrent.. ;p
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Tw?sT?d-d?v

 i like the script and others in my hub ...  so i tried to add another bot , but got errors after a while

3rd bot was reg'd in hub and talking but not all 3 together



Syntax C:\Users\JAY\Desktop\0.3.5.2f\scripts\Artificial Unintelligence.lua:107: 'end' expected (to close 'if' at line 103) near 'else'

Where have i gone wrong ... 

Madman

#5
Spoke on dc...
Here's a updated version... beacuse people acctually use this script...
Twisted-Devil tried to add a third bot, that gave me the idea to add how many bots as you want

-- Artificial Unintelligence
-- Made by Madman

-- Version 2
-- Added support for X nr of bots
-- Changed layout of table.
-- Hopefully more random thanks to CrazyGuy
-- All typos unintentional, and will not be removed
-- Added some text stolen from Daywalker, And he can't have it back! It's mine! mine!

-- Version 2.1
-- Added Descr, Email


ChatTabTimers = {n=0}
tabTimers = {n=0}

-- Time Definition
Sec  = 1000
Min  = 60*Sec
Hour = 60*Min
Day  = 24*Hour
TmrFreq = 1*Sec

tConfig = {
	Bots = {
		[1] = "Jack",
		[2] = "Daniel",
		[3] = "Samantha",
		[4] = "Teal'c",
	},
	BotInfo = {
		Descr = {
			"AU Bot",
			"What's this?",
			"I see dead ppl!",
			"Don't read this",
			"I don't have any text here"
		},
		Email = {
			"fake@fake.server",
			"notmy@email.com",
			"AU@AU.AU",
			"Who need a email?",
		},
	},
	Time = 1*Hour, -- Time between chats
	RegBots = 1, -- 1 to reg bots, nil to not...
	BotsAsUser = 1,  -- 1 to reg bots as users, nil to reg as ops
	HasDescrEmail = 1, -- 1 to reg bots with mail and descr
}

function Main()
	if tConfig.RegBots then
		for i = 1,table.maxn(tConfig.Bots) do
			math.randomseed(math.random(1,666))
			Descr = tConfig.BotInfo.Descr[math.random(table.maxn(tConfig.BotInfo.Descr))]
			Email = tConfig.BotInfo.Email[math.random(table.maxn(tConfig.BotInfo.Email))]
			if tConfig.BotsAsUser then
				if tConfig.HasDescrEmail then
					frmHub:RegBot(tConfig.Bots[i],0,Descr,Email)
				else
					frmHub:RegBot(tConfig.Bots[i],0,"","")
				end
		  	else
				if tConfig.HasDescrEmail then
					frmHub:RegBot(tConfig.Bots[i],1,Descr,Email)
				else
					frmHub:RegBot(tConfig.Bots[i])
				end
			end
		end
	end
	RegTimer(GetConvo,tConfig.Time,"Boot")
	SetTimer(TmrFreq)
	StartTimer()
end

function RegTimerChat(Text,Interval,Id,Bot)
	local tmpTrig = Interval / TmrFreq
	assert(Interval >= TmrFreq, "RegTimerChat(): Please Adjust TmrFreq")
	local TimerC = {n=0}
	TimerC.Text = Text
	TimerC.Trig = tmpTrig
	TimerC.Id = Id
	TimerC.Bot = Bot
	TimerC.count=1
	table.insert(ChatTabTimers, TimerC)
end

function RegTimer(F,Interval,Name)
	local tmpTrig = Interval / TmrFreq
	assert(Interval >= TmrFreq, "RegTimer(): Please Adjust TmrFreq")
	local Timer = {n=0}
	Timer.Name = Name
	Timer.Func = F
	Timer.Trig = tmpTrig
	Timer.count=1
	table.insert(tabTimers, Timer)
end

function RemoveTimer(Id)
	local count,Timer2Remove = 0,nil
	for I in ipairs(ChatTabTimers) do
		count = count+1
		if string.find(ChatTabTimers[I].Id, Id) then
			Timer2Remove = count
			break
		end
	end
	if Timer2Remove then
		table.remove(ChatTabTimers, Timer2Remove)
	end
end

function OnTimer()
	for I in ipairs(ChatTabTimers) do
		ChatTabTimers[I].count = ChatTabTimers[I].count+1
		if ChatTabTimers[I].count > ChatTabTimers[I].Trig then
			ChatTabTimers[I].count=1
			SendToAll(ChatTabTimers[I].Bot,ChatTabTimers[I].Text)
			RemoveTimer(ChatTabTimers[I].Id)
		end
	end
	for I in ipairs(tabTimers) do
		tabTimers[I].count = tabTimers[I].count+1
		if tabTimers[I].count > tabTimers[I].Trig then
			tabTimers[I].count=1
			tabTimers[I]:Func()
		end
	end
end

function GetConvo()
	math.randomseed(os.time()) 
	nr = math.random(1,table.maxn(Convo))
	tmp = {}
	tmpBot = {}
	for _,name in pairs(tConfig.Bots) do
		table.insert(tmp,name)
	end
	a = tmp[math.random(table.maxn(tmp))]
	table.insert(tmpBot,a)
	DelBot(a)
	b = tmp[math.random(table.maxn(tmp))]
	table.insert(tmpBot,b)
	DelBot(b)
	c = tmp[math.random(table.maxn(tmp))]
	table.insert(tmpBot,c)
	DelBot(c)
	-- Copy
	d = tmp[math.random(table.maxn(tmp))]
	table.insert(tmpBot,d)
	DelBot(d)
	-- Copy
	-- Paste here and change d to e, and voila, you got a fifth bot
	oTime = 0
	for i = 1,table.maxn(Convo[nr]) do
		for j = 1,table.maxn(Convo[nr][i]) do
			Time = math.random(5,10)
			Time = oTime + Time
			RegTimerChat(Convo[nr][i][j],Time*Sec,j,tmpBot[j])
			oTime = Time
		end
	end
end

function DelBot(var)
	for i,Bot in pairs(tmp) do
		if var == Bot then
			table.remove(tmp,i)
		end
	end
end

Convo = {
	[1] = { -- convo nr
		[1] = { -- line nr
			[1] = "I'm bored", -- bot nr
			[2] = "Me 2",
			[3] = "Me 3!",
		},
		[2] = {
			[1] = "No you are not",
			[2] = "No, and stfu!",
			[3] = "Yes I am",
			[4] = "You all STFU!",
		},
		[3] = {
			[1] = "You people annoy me",
			[2] = "Good!",
			[3] = "Allll Riiight!",
		},
		[4] = {
			[1] = "I hate you guys",
		},
	},
	[2] = {
		[1] = {
			[1] = "Tjooooo!",
			[2] = "oh, fuck...",
		},
		[2] = {
			[1] = "What?",
			[2] = "You have returned...",
		},
		[3] = {
			[1] = "Aren't you glad to see me?",
			[2] = "No.",
		},
		[4] = {
			[1] = "Why?",
			[2] = "I hate you",
		},
	},
	[3] = {
		[1] = {
			[1] = "Yoooo!",
			[2] = "My dog don't like me",
		},
		[2] = {
			[1] = "okey?",
			[2] = "It bit me",
		},
		[3] = {
			[1] = "Ouch",
			[2] = "No that's no good idea",
		},
		[4] = {
			[1] = "huh? what are you talking about?",
			[2] = "Yeah, I can be there",
		},
		[5] = {
			[1] = "WTF! WHAT'S YOUR PROBLEM? You don't makeing any sense!",
			[2] = "Wtf? What's your problem?",
		},
		[6] = {
			[1] = "Your chatting makes no sense",
			[2] = "I wasen't talking to you, I'm in PM with a friend, and i can't PM him for some reason",
		},
		[7] = {
			[1] = "...",
		},
	},
	[4] = {
		[1] = {
			[1] = "I'm bad!",
			[2] = "Why?",
		},
		[2] = {
			[1] = "Beacuse i just had sex with my girlfriends sister",
			[2] = "Was it good?",
		},
		[3] = {
			[1] = "Hell yeah!",
			[2] = "Sweet",
		},
	},
	[5] = {
		[1] = {
			[1] = "I just killed my parents",
			[2] = "lol",
		},
		[2] = {
			[1] = "I'm serious",
			[2] = "Yeah right!",
		},
		[3] = {
			[1] = "Yeah!",
			[2] = "Like i should belive that",
		},
		[4] = {
			[1] = "I'll PM you, my address, you can come check",
			[2] = "Ok",
		},
	},
	[6] = {
		[1] = {
			[1] = "Can anyone help me?",
			[2] = "Try a shrink",
		},
		[2] = {
			[1] = "That's not very nice :(",
			[2] = "I know :D",
		},
	},
	[7] = {
		[1] = {
			[1] = "Anyone alive?",
			[2] = "No",
		},
	},
	[8] = {
		[1] = {
			[1] = "Anyone alive?",
			[2] = "yes",
		},
	},
	[9] = {
		[1] = {
			[1] = "Anyone alive?",
			[2] = "No, I killed them all",
		},
	},
	[10] = { -- convo nr
		[1] =  {
			[1] = "Hi", -- bot nr
			[2] = "Hello",
		},
		[2] = {
			[1] = "How are you?",
			[2] = "I'm good, you?",
		},
		[3] = {
			[1] = "I'm good too.",
			[2] = "Good, ttyl",
		},
		[4] = {
			[1] = "cya",
		},
	},
	[11] = {
		[1] =  {
			[1] = "What do you think of this script?",
			[2] = "What script?",
		},
		[2] =  {
			[1] = "Artifical Unintelligence",
			[2] = "I think it rocks!",
		},
		[3] =  {
			[1] = "Why?",
			[2] = "Well, aren't you AU ?",
		},
		[4] =  {
			[1] = "Yea, so ?",
			[2] = "Then you wouldn't exist without the script dumbass!",
		},
		[5] =  {
			[1] = "Aha..but doesn't that mean that goes for you as well?",
			[2] = "Of course.",
		},
		[6] =  {
			[1] = "Then I wish it wasn't made",
			[2] = ".....",
		},
	},
	[12] = {
		[1] = {
			[1] = "So, did you see that movie last night?",
			[2] = "Yeah, it was way cool",
		},
		[2] = {
			[1] = "Yeah, I think the secne where they blow the house up is best",
			[2] = "Yes, that was sweet",
		},
		[3] = {
			[1] = "Didn't like the ending tho...",
			[2] = "That was a bit odd",
			[3] =  "I SEE NAKED DUMB PEOPLE SITTING ON GREEN CHARIS!",
		},
		[4] = {
			[1] = "Umm, okey...",
			[2] = "Off the meds agian?",
			[3] = "Weeee! I'm flying an orange",
		},
		[5] = {
			[1] = "Yup, defently",
			[2] = "Get help ffs!",
		},
	},
	[13] = {
		[1] = {
			[1] = "download prison break from me always right if you want to have swedish text you just take those with _new in the end i release out them maybe the evening they have released it or the day after otherwise it is only to write to me",
			[2] = "Say what?",
			[3] = "Ever heard of . , ! ? and so on?",
		},
		[2] = {
			[1] = "Yeah, so what?",
			[2] = "Ever tried to use them?",
			[4] = "It's a code, I will get my decoder..."
		},
		[3] = {
			[1] = "I do!",
			[2] = "No you don't",
			[3] = "That line you just wrote, needs some . and ,. It would make it so we actually understood it.",
			[4] = "OMG! I solved it!",
		},
		[4] = {
			[2] = "nice, what does it say?",
			[3] = "Hope it's someting good",
			[4] = "Nope, no good, it says: I want to take over the world, and force all girls to always be naked!",
		},
		[5] = {
			[1] = "Wtf?",
			[2] = "mmmm, boobs...",
			[3] = "eccept for haveing that one as lead i see no problem...",
			[4] = "I see one huge problem",
		},
		[6] = {
			[2] = "What's that?",
			[3] = "Yeah what's so wrong with naked chicks all the time?",
			[4] = "One word",
		},
		[7] = {
			[4] = "Oprah",
		},
		[8] = {
			[1] = "Aaah! nooo!",
			[2] = "OMG!",
			[3] = "Nooo! The horror!",
		},
	},
	[14] = {
		[1] = {
			[1] = "Anyone Alive?",
			[2] = "No",
		},
		[2] = {
			[1] = "Good...so you killed them all?",
			[2] = "Yeps",
		},
		[3] = {
			[1] = "Finally...I like the sound off silence",
		},
	},
}
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Tw?sT?d-d?v

Cool stuff m8     :))

Is it poss to make the bots look more like users and add share,description  ect to them  ?/?

Madman

Yes it is.
I'll do it this week...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Naithif

Hi, sorry for interrupting this thread

Someone made a script like this a while ago. Userlike bots, in high numbers. (which should be possible with this script since botnums are adjustable...) But it was compiled, and only worked for a few minutes.
If you want to make bots userlike, please take countermeasures against "stupid-hubowner-makes-a-new-hub-and-tries-to-show-it-populated-by-using-bots"

And bots are bots. So they don't have share, they can have description, and other stuff, but any emulation of share or tag are counted as fake users. Not to talk about to make them interact with each other. This would also be a risk of being banned from hublists.

Just my opinion.

Madman

Good point, didn't think of that. Prev post updated.
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Naithif

Thanks for understanding  :)
Anyways nice script, great table handling examples, good stuff to learn  ::)

greenbee

Quote},
      [4] = {
         [1] = "huh? what are you talking about?",
         [2] = "Yeah, I can be there",
      },
      [2] = {
         [1] = "WTF! WHAT'S YOUR PROBLEM? You don't makeing any sense!",
         [2] = "Wtf? What's your problem?",
      },
      [6] = {
         [1] = "Your chatting makes no sense",

   },
      [2] = {    should be [5]
great script btw ;p

Madman

We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

SMF spam blocked by CleanTalk