ArcEmu: [lua-help] Commands - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[lua-help] Commands It's probably simple.

#1 User is offline   avatarscape 

  • Member
  • Pip
  • Group: Members
  • Posts: 18
  • Joined: 30-September 08

Posted 05 June 2011 - 11:29 AM

Hi,
I'm trying to make several commands in LUA that begin with #...
Is it possible to make it so nothing beginning with # isn't sent to other players, and just processed by players? Because I want to make it so it acts like . commands.
It's probably simple =/
Thanks for any help
0

#2 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 05 June 2011 - 11:36 AM

View Postavatarscape, on 05 June 2011 - 11:29 AM, said:

make it so nothing beginning with # isn't sent to other players, and just processed by players?

It's probably simple =/


Hi there and welcome to the world of possibilities.

Yes in fact what you are wanting to do is possible and probably even very simple. It must be as simple as copy and pasteing something and hoping it might work.

I am sure you will find it out if you tend to read through things and consider using the forum search.

Thanks for your message.
Posted Image I do not join. I lead.
0

#3 User is offline   avatarscape 

  • Member
  • Pip
  • Group: Members
  • Posts: 18
  • Joined: 30-September 08

Posted 05 June 2011 - 11:59 AM

How do you do this, Though? I have tried.. The only way I found is by forcing a user to have a ui addon which filters incoming messages, but even this showed the speak animation...
0

#4 User is offline   paroxysm 

  • Chatty Cathy
  • Group: Retired
  • Posts: 320
  • Joined: 25-June 08
  • Gender:Male
  • Server OS:Windows

Posted 05 June 2011 - 12:02 PM

You need to use the 'OnChat' hook message. It returns a boolean and the system sends the message based whether the boolean is true or false. So simply use some string methods to check for a '#' prefix and return a false if that's the case.
The prototype for the event callback is :
local function OnChat( _player, message, chat_type, language_type, unknown)

0

#5 User is offline   avatarscape 

  • Member
  • Pip
  • Group: Members
  • Posts: 18
  • Joined: 30-September 08

Posted 05 June 2011 - 12:52 PM

Oh so I just make a new script which makes a chat hook that returns false if it starts with #?
0

#6 User is offline   paroxysm 

  • Chatty Cathy
  • Group: Retired
  • Posts: 320
  • Joined: 25-June 08
  • Gender:Male
  • Server OS:Windows

Posted 05 June 2011 - 01:16 PM

Well, as you said the commands are prefixed with a '#'. You also want it so that if such a command is typed by a player, you do not want it to be displayed(no chat log, or chat box). You can intercept that message using OnChat hook and by returning a false in that hook, you prevent the server from broadcasting it to other player would normally have seen it.

EDIT: heres some pseudo code:
local function OnChat(player, message )
 local start,end = string.find(message, '#')
 if(start ~= nil and start == 0) then
  --process the rest of the message.
 return false --return a false so the server does not broadcast this message to other players.
 end
end
RegisterServerHook(16, OnChat)

It may not be entirely correct but it's meant to give you an idea of what I'm talking about.
0

#7 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 05 June 2011 - 03:12 PM

imo this has already been used since ages and especially in the scripts section there are many scripts using this... like i said, with a simple search it would have been very easy to find yourself...
Posted Image I do not join. I lead.
0

#8 User is offline   avatarscape 

  • Member
  • Pip
  • Group: Members
  • Posts: 18
  • Joined: 30-September 08

Posted 06 June 2011 - 10:06 AM

I did search, I would've found it out myself if the events documentation stated return value effects xD
0

#9 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 07 June 2011 - 10:31 AM

View Postavatarscape, on 06 June 2011 - 10:06 AM, said:

I did search, I would've found it out myself if the events documentation stated return value effects xD


2 second search uncovered woot...my own post ?! cranky -.-

http://arcemu.org/fo...showtopic=20970
Posted Image I do not join. I lead.
0

#10 User is offline   avatarscape 

  • Member
  • Pip
  • Group: Members
  • Posts: 18
  • Joined: 30-September 08

Posted 07 June 2011 - 12:11 PM

Nowhere in there does it say 'return false'? That's the key bit. I had the commands working, Just showing to players. I've got it now soo...
0

#11 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 07 June 2011 - 07:51 PM

View Postavatarscape, on 07 June 2011 - 12:11 PM, said:

Nowhere in there does it say 'return false'? That's the key bit. I had the commands working, Just showing to players. I've got it now soo...


oh im sorry i'm mrs. read :D
Posted Image I do not join. I lead.
0

#12 User is offline   avatarscape 

  • Member
  • Pip
  • Group: Members
  • Posts: 18
  • Joined: 30-September 08

Posted 08 June 2011 - 03:04 PM

..... Was that meant to be cocky? I can't quite make out the message you just sent;

>Also, Your post, I saw the exact same code posted exactly 1 month before you posted it on mmowned by Dynashock? :s
0

#13 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 08 June 2011 - 06:45 PM

View Postavatarscape, on 08 June 2011 - 03:04 PM, said:

..... Was that meant to be cocky? I can't quite make out the message you just sent;


:D

tbh sometimes it can happen i don't look exactly at the posts as there are so many of them and most of the questions can be answered by the forum search or the wiki...
Posted Image I do not join. I lead.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users