PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: Spoonlord312 on 04 September, 2005, 06:29:49

Title: frmHub object equivilent in lua 5
Post by: Spoonlord312 on 04 September, 2005, 06:29:49
Hey guys,
in lua4 'frmHub:EnableSearchData' and 'frmHub:EnableFullData' were used to allow custom commands for the scripts...now that we're all trying to move up to lua5 i cant seem to figure out what happened to those objects...i have been looking on here for weeks.
I have found all the converter scripts and such and even found an index through a friend but for some strange reason i cannot find what these need to be changed to. This is really important as my registration system has to be put on hold until i figure it out so help is much appreciated! also forgive me if the solution is simple - my scripting experience is very limited in lua4 let alone lua5
Title: forgive my ignorance
Post by: Spoonlord312 on 04 September, 2005, 16:36:59
so ... dataarrival doesnt cut it? i know there are a bunch more arrivals but at this point my scripting knowledge is at a minumum - and two of my scripts are huge (4000+ lines) so it all of a sudden looks like a huge job to edit them. could i get an example or two in reference to commands being entered into the main chat?
Title:
Post by: HaArD on 04 September, 2005, 19:39:47
Instead of using DataArrival for ALL incoming data and switching some data on and off like this:

--// This function is fired when a new data arrives
function DataArrival(curUser, sData)
  -- TODO your code here
end

frmHub:EnableSearchData(n)
  n = 1 or 0 (1-enable,0-disable)
  enables/disables passing of $Search, $MultiSearch and $SR to current script

frmHub:EnableFullData(n)
  n = 1 or 0 (1-enable,0-disable)
  enables/disables passing of ALL incomming data to current script
  NOTE: may have significant influence on hub's performance. Use it wisely!

The new approach has different events for different types of incoming data like this:

SupportsArrival(User, Data) - Incoming supports from user.
ChatArrival(User, Data) - Incoming chat message from user. If script return 1 hub don't process data.
KeyArrival(User, Data) - Incoming key from user.
ValidateNickArrival(User, Data) - Incoming validate nick from user.
PasswordArrival(User, Data) - Incoming password from user.
VersionArrival(User, Data) - Incoming version from user.
GetNickListArrival(User, Data) - Incoming get nick list request from user.
MyINFOArrival(User, Data) - Incoming user myinfo.
GetINFOArrival(User, Data) - Incoming get info request from user.
SearchArrival(User, Data) - Incoming search request from user. If script return 1 hub don't process data.
ToArrival(User, Data) - Incoming private message from user. If script return 1 hub don't process data.
ConnectToMeArrival(User, Data) - Incoming active connection request from user. If script return 1 hub don't process data.
MultiConnectToMeArrival(User, Data) - Incoming multi connection request from user. If script return 1 hub don't process data.
RevConnectToMeArrival(User, Data) - Incoming pasive connection request from user. If script return 1 hub don't process data.
SRArrival(User, Data) - Incoming search reply from user. If script return 1 hub don't process data.
KickArrival(User, Data) - Incoming kick command from user. If script return 1 hub don't process data.
OpForceMoveArrival(User, Data) - Incoming redirect command from user. If script return 1 hub don't process data.
UserIPArrival(User, Data) - Incoming user ip request from user. If script return 1 hub don't process data.
UnknownArrival(User, Data) - Incoming unknown command from user. If script return 1 hub don't process data (don't disconnect user).
BotINFOArrival(User, Data) - Incoming hublist pinger request from user. If script return 1 hub don't process data.

You could simply call dataarrival inside all of the new events, but that's not a very efficient conversion......
Title: Thanks...
Post by: Spoonlord312 on 04 September, 2005, 21:27:45
Alright hey thanks man - now I have been able to convert all my scripts the right way...mostly - now i have to fix the problems caused by the "converter" program...
Appreciate the help!