PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: Snoris on 22 February, 2004, 18:51:31

Title: Whisper
Post by: Snoris on 22 February, 2004, 18:51:31
Is there anyone who can help me with this??

I wanna have a command that makes it possible to "whisper" to other users..And no one can / Should se it =))..And no...
I dont wanna send an PM...Thats the point of the Whisper =))
U can skip that xtra thingy =))

EG.
+whisper Snortan Hi hi u ugly little moron =]
*This is not sent to the mainchat of course*

The user Snortan gets this in his Mainchat.....
The user Snoris whispered this to you : Hi hi u ugly little moron =]

Is there someone who can help me with this??

I've tried out some stuff but I'm a n00b as always =))

This is what i came up with =)

if (cmd=="+whisper") then
arg=strsub(arg,1,strlen(arg)-1)
SendToNick(arg,botname,"The user "..user.sName.." sent you this msg : "..arg.."")
user:SendData(botname,"You whispered to "..arg.."")
return 1
end

I'll hope there is SOMEONE who can help me with this =]
Title:
Post by: nErBoS on 22 February, 2004, 19:38:05
Hi,

Hope it helps...

--Requested by Snoris
--Made by nErBoS

Bot = "Whisper-Bot"

function Main()
frmHub:RegBot(Bot)
end

function DataArrival(user, data)

if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="+whisper") then
s,e,cmd,usrto,msg = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s+(.*)")
local usr = GetItemByName(usrto)
if (usr == nil) then
user:SendData(Bot, "The user is'nt online.")
return 1
elseif (usrto ~= nil and msg ~= nil) then
user:SendData(Bot,"You whispered to "..usrto.."")
usr:SendData(Bot, "The "..user.sName.." whispered this to you : "..msg)
return 1
else
user:SendData(Bot, "Syntax error, the command is +whisper .")
return 1
end
end
end
end

Best regards, nErBoS
Title: Whisper Script
Post by: BoJlk on 12 September, 2004, 10:12:49
that's a cool idea...but is this posible to make
OP's and Hub Muster to see the Whispered messages???
(for administrative purpices) 8)
Title:
Post by: plop on 12 September, 2004, 17:12:00
QuoteOriginally posted by BoJlk
that's a cool idea...but is this posible to make
OP's and Hub Muster to see the Whispered messages???
(for administrative purpices) 8)
spying you mean.

plop
Title:
Post by: Herodes on 13 September, 2004, 01:12:03
Maybe you'd like to have a look at this one .. InterCom (http://board.univ-angers.fr/thread.php?threadid=2525&boardid=12)
Title:
Post by: BoJlk on 13 September, 2004, 03:22:32
BTW it works like a Charm! 8)
but how can i unregister the BOT
so it won't be seen i the user list?
what line in the script do i delete/edit
(and how to make a description fot the bot too?)

And how do i Make it available in the !help commands
for User or for OPs
Title:
Post by: Herodes on 13 September, 2004, 12:33:43
change this partfunction Main()
frmHub:RegBot(Bot)
end
to this function Main()
-- frmHub:RegBot(Bot)
end
Title:
Post by: BoJlk on 14 September, 2004, 05:49:41
Doesn't matter u both ROCK!
Any way i was wondering if i type the [username]
the user name can contain character like "?" etc'
so i can't type it when i use the command!

Can it be done like RightClick option?

any suggestions?  ?(
Title: Error...
Post by: BoJlk on 14 September, 2004, 15:17:09
Syntax Error: expected;
  last token read: `-' at line 7 in file `...\PtokaX-0.326.TestDrive4\scripts\Whisper 1.1.lua'

  ?(

 :D
Sorry just added "-"
"--> Option for right click command"


Case Closed it's now Complette...
Title: Something Strange!
Post by: BoJlk on 14 September, 2004, 17:06:53
when i've done a reload in DC++
i recieve another RightClick Command!
so it's two now!...
i've done it three time now it's 5 commands in the rightClick option!  ?(
Title:
Post by: BoJlk on 15 September, 2004, 03:45:11
QuoteOriginally posted by Mutor
When your done editing the user commands, restart your client.

Sorry that i need to ask this thought some terms are not formiliar to me...
Editing witch user command?
and restarting the DC++ software?
Title:
Post by: ??????Hawk?????? on 15 September, 2004, 04:48:14
hi m8    

try this  

added a Clear to the user commands

--Whisper 1.01
--by Mutor
--Request by Snoris
--
--Sends a "For your eyes only message" to another user in main.
--Added request by BoJlk  -> Option for right click command
--
--User Settings-------------------------------------------------------------------------------------
Comm = "+whisper" -- Script Command
Bot = "[Sentry]" -- Rename to your main Px bot
Confirmation = "1" -- Show whisper confirmation [show to sender only] "1"=yes "0"=no
SendComm = "1" -- Send user command [right click] "1"=yes "0"=no
--End User Settings----------------------------------------------------------------------------------
--
--$UserCommand 1 X  Where -> 1=Hub Menu 2=User Menu 3=Hub/User Menu
--
function NewUserConnected(user)
if SendComm == "1" then
user:SendData("$UserCommand 255 |") -- clear
user:SendData("$UserCommand 1 2 Whisper To User $<%[mynick]> "..Comm.." %[nick] %[line:Whisper-Message]||")
user:SendData(" *** Notice :: Right click 'Whisper' command enabled ***")
end
end

OpConnected = NewUserConnected

function DataArrival(user, data)
s,e,cmd,who,msg = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)")
if (cmd == Comm) then --and user.bOperator then -- Use this for Ops use only
local nick = GetItemByName(who)
if not nick then
SendToNick(user.sName,Bot.." The user -> "..who.." is not online. Check your spelling.")
return 1
end
nick:SendData(Bot,"The user "..user.sName.." whispered this to you : " ..msg)
if Confirmation == "1" then
SendToNick(user.sName,"Whisper sent...")
end
return 1
end

end
Title:
Post by: BottledHate on 15 September, 2004, 06:05:06
QuoteOriginally posted by ??????Hawk??????

added a Clear to the user commands



if you have any other scripts sending right click
 commands, it has a good chance of erasing those.


-BH
Title:
Post by: BottledHate on 15 September, 2004, 06:10:15
i hate long commands.. i'd make a shortcut for it...

(mod's 4 mutors last post above.)



- Comm = "+whisper"
+ Comm = {["+wisper"]= 1, ["+w"] = 1}

- if (cmd == Comm) then --and user.bOperator then -- Use this for Ops use only
+ if Comm[cmd] then --and user.bOperator then -- Use this for Ops use only



-BH
Title:
Post by: BoJlk on 15 September, 2004, 07:26:54
Me too i hate the long commands
If you misstyped it by accident... ?(
you'll have a nasty outcome  :D

so BottledHate you right
but where do i add those lines?

here?
--User Settings-------------------------------------------------------------------------------------
Comm = "+whisper"   -- Script Command
Bot = "[Sentry]"   -- Rename to your main Px bot
Confirmation = "1"   -- Show whisper confirmation [show to sender only] "1"=yes "0"=no
SendComm = "1"      -- Send user command [right click] "1"=yes "0"=no
--End User Settings----------------------------------------------------------------------------------
--
Title:
Post by: BottledHate on 15 September, 2004, 07:41:30
sorry...

find the line with the "-" and replace it with the line that has the "+" next to it.

:D


- Comm = "+whisper"
+ Comm = {["+wisper"]= 1, ["+w"] = 1}


- if (cmd == Comm) then --and user.bOperator then -- Use this for Ops use only
+ if Comm[cmd] then --and user.bOperator then -- Use this for Ops use only


-BH
Title: Great
Post by: BoJlk on 15 September, 2004, 08:24:18
Great...!
Gonna Test it now...
Title:
Post by: BoJlk on 15 September, 2004, 08:28:29
This  is a Cool Script

thanks to [Snoris]
Title:
Post by: BoJlk on 19 September, 2004, 20:59:20
Got an Error in Whisper...

QuotePtokaX-0.326.TestDrive4scriptsWhisper v1.2.lua
Syntax Error attempt to compare nil with number
Syntax Error table index is nil
Syntax Error table index is nil
Syntax Error table index is nil
Syntax Error table index is nil
Title:
Post by: BoJlk on 01 October, 2004, 00:49:28
Common No one has an answer for that error

Syntax Error: table index is nil

Considering this Script and for General Idea?