READ THE RULES
0 Members and 1 Guest are viewing this topic.
For online user it is Core.GetUser(sNick), for registered user it is RegMan.GetRegUser(sNick)
GetBool(iBoolId, 0/1)SetBool(iBoolId)GetNumber(iNumberId, iNumber)SetNumber(iNumberId, iNumber)GetString(iStringId, sString)SetString(iStringId, sString) - | is not allowed.
I don't understand, what are they supposed to change?
And shouldn't 0/1 be in the SetBool and not in GetBool?
Updated to version 0.4. Removed all functions from user table and added similar functions to Core metatable where first parameter is user table.
Question for scripters:What values you need in user table everytime? User table is created on every arrival, on every call to function returning user table(s) and because user table have many values that use very much cpu.Idea is to have only few needed values (for me it is sNick and for PtokaX uptr) and other have on request. One function will add all values to user table (Core.GetAllUserData(tUser)), and another function will add only requested value (Core.GetUserData(tUser, iValueId)).
Out of interest, if you needed say three other values, would it be quicker/more efficient to use Core.GetAllUserData(tUser) or to do 3 Core.GetUserData(tUser, iValueId)?
Another request: how about splitting the data in Arrival()'s?
Another request: how about splitting the data in Arrival()'s? It would be faster if the C code did it directly.
ToArrivalSplitted(tUser, sToNick, sMessage)ConnectToMeArrivalSplitted(tUser, sToNick, sIP+Port)MultiConnectToMeArrivalSplitted(tUser, sToNick, sIP+Port)OpForceMoveArrivalSplitted(tUser, sWho, sWhere, sMessage)
SearchArrivalSplitted(tUser, sSearchString)MultiSearchArrivalSplitted(tUser, sSearchString)
My opinion: as in VerliHub, maybe profile, nick and $MyINFO string is the most important things.
From MyINFO, every data could be splitted with little functions.
And splitting gave me an another idea: would it be possible to add one new parameter to ToArrival? Like ToArrival(toUser,fromUser,data)
Core.GetUser( user.sNick ).sIP
Core.GetUserData( user, 0 )
Core.SendToUser( tUser, sData, sFrom )
SendToUser( tUser, sData )
Where did the decision come to make Core.GetUserData return 1 (on success) instead of returning the updated value?
A question concerning Core.SendToUser (and the other functions this applies to) Will we need to prepend the senders <nick> to the beginning of sData (FromNick as it's been called in the current versions API doc), or is this an oversight?
When it returns value then this value will be created twice.. first in user table and second as returning value. In string case it will be much slower. Thas is reason why wanted value is not returned as result of this call.sData can be any protocol command, if you want to send chat then yes you need to include <nick> on begin of data.
ChatArrival = function( user, data ) local cmd, msg = data:match( "%b<>%s" .. sPre .. "(%w+)%s+(.*)|$" ); if tCommandArrivals[ cmd ] then Core.GetUserData( user, 17 ); --Just need iProfile for a profile check in the tCommandArrivals[ cmd ] function. Core.SendToUser( user, "<" .. Core.GetBot( ).sNick .. "> " .. tCommandArrivals[ cmd ]( user, msg ) ); return 1; endend
Core.SendToUser( user, "<" .. Core.GetBot( ).sNick .. "> " .. tCommandArrivals[ cmd ]( Core.GetUserValue( user, 17 ), msg ) )--No reason to update the user table, since I only need the value for this call.
tScripts = { ["ActiveScript"] = 1, ["DisabledScript"] = 0, ["NonExistingScript"] = nil,}