mirror of
https://github.com/Earu/EasyChat.git
synced 2025-03-04 03:13:20 -05:00
Updated Home (markdown)
parent
988f66646f
commit
7f2bfd9578
100
Home.md
100
Home.md
@ -56,102 +56,4 @@ Here's the list of console commands that EasyChat has by default:
|
||||
- easychat_timestamps
|
||||
- easychat_use_dermaskin
|
||||
- easychat_players_colored
|
||||
- easychat_no_modules
|
||||
|
||||
|
||||
## Developers
|
||||
When making EasyChat, I didnt forget fellow developers that would mess with it, or even add content to it, that's why I made EasyChat modular and plug & play.
|
||||
|
||||
#### Adding a module
|
||||
Every of us, developers have already made those silly little scripts using PlayerSay or OnPlayerChat hooks, well if you were looking for a place to put those little scripts, you can just put them in easychat/modules/ directory, its as simple as that.
|
||||
In theory EasyChat can run everything as a module, if it placed correctly within its module directory.
|
||||
|
||||
- A clientside script goes into modules/client/
|
||||
- A serverside script goes into modules/server
|
||||
- A shared script just goes in modules/
|
||||
|
||||
|
||||
#### Adding a typing mode
|
||||
To add a mode to EasyChat main tab its very easy, theres a function for it and its called "EasyChat.AddMode", this function has two parameters.
|
||||
|
||||
The first one is a string that will be the name of the mode, and the second one is a function. The function passed as second argument have one parameter which is a string, it is the currently typed DTextEntry text.
|
||||
|
||||
Example:
|
||||
```
|
||||
EasyChat.AddMode("Console",function(text) LocalPlayer():ConCommand(text) end)
|
||||
```
|
||||
|
||||
#### Adding a tab
|
||||
To adda tab to EasyChat, you need to use "EasyChat.AddTab" which has two parameters.
|
||||
|
||||
The first parameter is a string that is the name of the tab, and the second one is a vgui panel.
|
||||
/!\ you must create the panel with vgui.Create before adding it as a tab/!\
|
||||
|
||||
Example:
|
||||
```
|
||||
local panel = vgui.Create("DPanel")
|
||||
EasyChat.AddTab("A new tab",panel)
|
||||
```
|
||||
|
||||
#### Auto-focus
|
||||
EasyChat has an auto-focus feature that allows you to set a panel the user will be focused on when your tab will be active.
|
||||
For that to happen you need to use "EasyChat.SetFocusForOn", the function has two parameters.
|
||||
|
||||
First parameter is a string, its the name of your tab, and the second one is the panel that the user will be focused on when opening your tab and pressing keys.
|
||||
|
||||
Example:
|
||||
```
|
||||
local tabname = "test"
|
||||
local panel = vgui.Create("DPanel")
|
||||
|
||||
EasyChat.AddTab(tabname,panel)
|
||||
local textentry = panel:Add("DTextEntry")
|
||||
EasyChat.SetFocusFor(tabname,textentry)
|
||||
```
|
||||
#### Notifications
|
||||
Like for the private message tab you can create notifications for your tab by using the function "EasyChat.FlashTab", this function has one argument.
|
||||
|
||||
The only argument of that function is the name of your tab, afterward it will proceed to flash it as its name says.
|
||||
Each time FlashTab is called, it creates a new notification, the user will be showed those notifications when he will open his chatbox to type.
|
||||
|
||||
Example:
|
||||
```
|
||||
local tabname = "test"
|
||||
local panel = vgui.Create("DPanel")
|
||||
|
||||
EasyChat.AddTab(tabname,panel)
|
||||
EasyChat.FlashTab(tabname)
|
||||
EasyChat.FlashTab(tabname)
|
||||
```
|
||||
Output:
|
||||
"EC ⮞ 2 new notifications from test"
|
||||
|
||||
### Shortcuts
|
||||
EasyChat provides a way to "emulate" keyboard shortcut, there are two functions with the same paramaters that allows such,
|
||||
EasyChat.AddALTShortcut and EasyChat.AddCTRLShortcut. The first parameter is the second key combination, the second the function that will be called when the key is pressed, the function has 5 paramaters, the textentry panel, its text, the caret pos, the text before caret, and the text after caret, if you want to change the current text typed you need to return a string.
|
||||
|
||||
Example:
|
||||
```
|
||||
EasyChat.AddCTRLShortcut(KEY_BACKSLASH,function(panel,text,caretpos,pretext,posttext) return "" end)
|
||||
```
|
||||
The example above will remove everything from the textentry if you press CTRL+BLACKSLASH, for a panel to use the registered shortcuts you need to use EasyChat.UseRegisteredShortcuts. This function has 3 parameters, the panel you want to use it on (should be a textentry or a child of such), the last key that was pressed and the current key that is getting pressed ie EasyChat.UseRegisteredShortcuts(panel,lastkey,currentkey)
|
||||
|
||||
### HOOKS
|
||||
|
||||
If you need to run some things at specific time relatively to easychat, then this section is for you.
|
||||
Here's the list of hooks easychat runs.
|
||||
|
||||
Shared:
|
||||
```
|
||||
ECInitialized - ran when everything has initialized, no argument passed
|
||||
ECDestroyed - ran when easychat gets destroyed (when disabled or reloaded), no argument is passed
|
||||
ECOpened - ran when a player opens easychat (always return localplayer on client), the player opening the chat is passed
|
||||
ECClosed - ran when a player closes easychat (always return localplayer on client), the player closing the chat is passed
|
||||
ECPreLoadModules - ran before easychat loads modules
|
||||
ECPostLoadModules - ran after easychat loaded modules
|
||||
```
|
||||
|
||||
Client:
|
||||
```
|
||||
ECOpenURL - ran when a player attempts to open an url, the url is passed, return false to prevent opening of the url passed
|
||||
```
|
||||
- easychat_no_modules
|
Loading…
Reference in New Issue
Block a user