Userdata Help for chatbot
 

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

Userdata Help for chatbot

Started by Sairaum, 30 May, 2004, 01:18:27

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Sairaum

Im trying to enter a userdata recognition into a chatbot (a bot that responds and responds to words, together with having commands for certain help topics and stuff)
so it uses different trigger files for each user status (for ops, vips, etc) so each status has its own responces, and not everyone gets the same type of responces, or able to use all of its commands. I havent figured out yet how to do it, or if this is even possible. Either from reading a seperate .ini for each status, or make the ini have seperate numbers which direct to different status (if operator, it responds to the certain dedicated triggers, etc) Please help! >.<

Herodes

#1
I am not completely clear on what u want to do
but I am sure that doing a search for "user.iProfile" will give u a really good clue ...

Sairaum

#2
User recognition. Like, that the bot knows the difference between an op and a normal user. So it responds to an operator differently then it does to a regular user. like if operator then msg Hello if registered then msg who is you, etc. That type of stuff. This way an operator will have its own list of responces, while a vip has its own, etc. Aside of that it will have some help and info in it, which can only be activated by regged users (ops thro regular).

Herodes

PtokaX has a function for that .. it calls it profiles ...
iProfile returns the number of the Profile of the user.
This will be a number ... you can have a look in your Profiles.dat in the PtokaX folder ...
It should have a list of your profiles (Master, OP , Vip, ...)
along with a number ...
The default is like :
0|Master|11111111111111111111111000000001
1|Operator|11111100011001111111111000000001
2|VIP|10000000000001111000000000000000
3|Reg|10000000000000000000000000000000

so 1 is the iprofile of Master, 2 is for Operators and so on ...
thats the iProfile of the users with accounts ...

So u could just tell us exactly ur needs .. and then maybe , just maybe someone can do something for u .. :)

Sairaum

Hahaha, yeh sorry, after 2days awake I rather keep stuff as simple as possible.. especially when it comes to coding.. ok well here goes;

Right now, out of lack of care, ive just made a simple bot script, which just loads up a trigger ini with the responces. I made it so it responds to certains words (or part of a word) and gives 1 of the responces which I put in the ini. Now this means it will just respond whenever it sees that certain word. This is bad.. well its bad now, never thought it would cause any issues, hehe. Anyways, what I want to do, is 1 of the following;
1. Make it read from a different ini, depending on the profile. So it knows the difference between a master and a vip and checks to see on both the profile and the word being said, and responds accordingly.
2. Simple way of if the user is master and says woot it says woot back, if user is Reg and says woot it says shut up back.

That would be all kind of.. pretty simple 'if.and.then' but I seem to be too stupid to know the right line..

Herodes

the most simple way going for that shoud be ..

if user.iProfile == 1 then
-- read a file ...
elseif useriProfile ~= 1 then
-- read another file ...
end

It would be helpful to see the script .. :)

Sairaum

#6
*post deleted*

Herodes

#7
Herodes: [*TWO POSTS DELETED BECAUSE OF STUPID PPL*]
1st this one and the next from me ..

Sairaum

#8
It didnt work, the whole part of the Master thing u wrote in it, says it fails to respond (syntax error), and just to make sure it really didnt work, tested it and it just completely ignores that part.

btw for the ini file, just make a file, call it Triggers.ini and put inside stuff like this:

[hello]
SUP!
HEY
HELLO
[bye]
BAIBAI!
BYEBYE!


that should be good enough to test the script =)

Herodes

#9
Thats the 2nd [*REMOVED POST SAME REASON*]

Sairaum

#10
Syntax error: bad argument #1 to `strlower' (string expected, got nil)
stack traceback:
   1:  function `strlower' [C]
   2:  main of file `C:\Program Files\server\scripts\trickerbot.lua' at line 94

Sorry bout that, forgot to mention, the code works without that part that u said shouldnt be there or something =D. GREAT JOB! *bows*

(It says this when I try to load the bot, it gives that syntax, and the bot is unable to start. If I take that part out (which u outlined as maybe not supposed to being there) it works fine, without any problems)

Also you wouldnt know by any chance on how to make the bot send a msg in pm, when a command is said, readin the msg from a file and sending the msg in PM? =D

VidFamne

Well, I put it there because of the "!me" command should
work, with the bot. But its so "modded" now, so perhaps its not needed anymore. :))

Sairaum

Well Ive tried several different codes for it, and none it responds, so yeh.. as always Im doin somethin wrong again......... help ><

VidFamne

#13
The reg.exp ;
s,e,msg = strfind(data, "%b<>([%a ]+)")
is not so good
try this ;
data = strsub(data,1,-2)
local s,e,msg = strfind(data, "%b<>([%a ]+)")
or perhaps this;
local _,_,msg = strfind(data, "%b<>([%a ]+)%|$")

Sairaum

#14
*deleted*

Got that to work inside the bot. BUT it sends it in Private Message style, in the main chat window, not in the PM window >.< HELP! >.<

Fixed it, seems it is cause this bot is invisible, that it sends it that way.

Also when I make it visible, it wont respond anymore -.-

Sairaum

#15
This code wont work if I put it inside the bot mentioned, only when I make a seperate bot.. ?! Whats this?!

Is there some code in there that counters whats already in the bot, making it so it doesnt respond to it?
Either way, whatever I change in it, it just totally ignores it (ChatBot)...grah..

VidFamne

Well, " %a " means all letter, and " ! " is a control character, so try this;
local s,e,msg = strfind(data, "%b<>([%a%c ]+)")

Sairaum

#17
*bows then cheers* nice! It works now in ChatBot!

But it still sends it in private message, in the main chat screen, it needs to send a pm to the user in a different window.

Herodes

#18
Herodes: [*POST REMOVED SCROLL UP TO FIND OUT WHY*]

Yeap .. thats a nice post I enjoyed as I am leaving now after a whole 6 hours tou figure it out ... thanks ..
I have an UPDATE !!! (for "my" script, why in such a dumb way ?)

If man then tries={ willingly, to help, man};
to catch his food ...
if catch his food then
man.thinks = man.." wants his food ..."

I 'm not trying to pretend about anything here ...
I have been without closing a wink since yesterday 13:00GMT
,.. .So I think , other than the fact that your post was insulting ..., that you have shown how a man can react  if someones even "tampers" with his work ...
One the other hand you could be seeing the good part that your code can be enhanced throught this ..
But ur no good at that ..
cya around ... :(

Sairaum

#19
Shurin would be the person. Not nice to call the whole code done by u when all u did was the profile recognition and rewrote it..

Also the pm's are being sent to main chat, instead of a seperate window.

Aside of that, if it sees 'hi' even if 'higher' is beind said, it triggers.

Aside of that, everything seems to be working alright, its not done yet tho, still needs a few adds before it can be called a real ChatBot, so no reason to release it like that yet :P

Also, that person would be me, I made it from scratch..

Aside of that, I will release a zipped (or rarred) file with all the files and information on it, once these things have been worked out, with a few standard scripts (this is still a chatbot, I wont put in hubbot stuff in it, like rules and such, but rather information stuff, of random stuff, which u just have to wait for :P)

ASIDE OF THAT (God let it end..) I think the bot is reacting to a different profile setting.. not entirely sure, but it looks like it

0|Master|11111111111111111111111000000001
1|Operator|11111100011001111111111000000001
2|VIP|10000000000001111000000000000000
3|Reg|10000000000000000000000000000000

I think its reacting to this one, in the main folder of the Ptokax folder.

Aside of that (...sigh..) it gives this error when I give the command (the !rules thing, which I changed to -rules)

Syntax error: bad argument #1 to `read' (string expected, got nil)
stack traceback:
   1:  function `read' [C]
   2:  function `ReadFile' at line 105 [file `...ThaVisual\Desktop\HUB SERVER\scripts\Kumori.lua']
   3:  function `DataArrival' at line 84 [file `...ThaVisual\Desktop\HUB SERVER\scripts\Kumori.lua']

You changed the code, its not responding anymore to it.
This would be the one that does work
commandprefix = "-"
txtcommand = "rules"


function DataArrival(user,data)
	if strsub(data, 1, 1) == "<" then
	data = strsub(data,1,-2)
	local s,e,msg = strfind(data, "%b<>([%a%c ]+)")
      

if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower(""..commandprefix..""..txtcommand.."")) ) then
readfrom("files/rules.txt") 
while 1 do 
line = read() 
if line == nil then break end 
user:SendPM(Botname,line) 
end 
readfrom() 
end
end
end
end

Seen the line and its very short..(in what u wrote) so I dunno? Well either way.. even if I put this in the code u just posted while taking out the other one, it doesnt respond (doesnt give an error anymore either, but Im sure thats just cause it doesnt understand that code anymore)

-Edit on Redone post-
Well Ive slept bout 10 hrs in the past 2 weeks trying to get this bot to work as it should.. (and thats not a lie, I might be off 1 or 2 hrs but yeh) so I find it kind of strange when someone puts his name on it.. to put it lightly. Anyways ur code, have u tested it? Well for right now, it doesnt respond to either the commands or the triggers.. was gonna retry it and see if I had copied something wrongly, but then saw the redone post.. ok..also if u dont want ppl to see the obvious, u shouldnt delete ur posts.. its not helping when u just take the code and put ur name on it.. no matter what reason, help yes, take no.. I asked for help, not a redo of the entire code, especially not when someone writes 1 little responce in it and redoes the whole code and puts his name on it.. especially not after all the work I put on it, and I didnt say u stole it, cause what u did u did, I dont say its MINE cause it aint, without your help it wouldve still be the same. but there is a difference between what has happened here..

Herodes

QuoteOriginally posted by Sairaum
You changed the code, its not responding anymore to it.
You Bet! ;D
QuoteOriginally posted by Sairaum
(doesnt give an error anymore either, but Im sure thats just cause it doesnt understand that code anymore)
Partially correct ... depends on the point of view ...

Sairaum

well when I change it to the code I made it doesnt do anything, but urs doesnt either.. have u tested ur mod?

SMF spam blocked by CleanTalk