Skip to content

Commit

Permalink
Create OneClickInviter
Browse files Browse the repository at this point in the history
Yep i forgot to push this before
  • Loading branch information
UcanPatatess committed Apr 5, 2024
1 parent 6fd55d5 commit e11bc92
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions Community Scripts/Misc/OneClickInviter
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
--[[

***********************************************
* One Click Inviter *
***********************************************

*************************
* Author: UcanPatates *
*************************

**********************
* Version | 0.0.3 *
**********************
-> 0.0.3 : added multiple search texts
-> 0.0.2 : minor bug fix
-> 0.0.1 : Just the Inviter

***************
* Description *
***************

This script Searchs your 4.chat if you have one and if there is someone that typed lfg,lfp or inv in chat it invites the said person or more to your group(you need to be in target distance)
You can make a macro with /snd run "Your_script_name_here"

*********************
* Required Plugins *
*********************


Plugins that are used are:
-> Something Need Doing [Expanded Edition] : https://puni.sh/api/repository/croizat

]]
SearchStrings = {"lfg", "lfp", "inv"} -- this is what are you searching in your chat
--[[

************
* Script *
* Start *
************

]]
Chat_Log = GetNodeText("ChatLogPanel_3", 7, 2)
-- Iterate through each line in the chat log
for _, searchString in ipairs(SearchStrings) do
-- Your existing code remains the same, but replace SearchString with searchString
Chat_Log = GetNodeText("ChatLogPanel_3", 7, 2)
-- Iterate through each line in the chat log
for line in Chat_Log:gmatch("[^\r\n]+") do
local alphanumeric_text = line:gsub("[^%w%s]", " ")

-- Remove any leading or trailing whitespace
alphanumeric_text = alphanumeric_text:match("^%s*(.-)%s*$")

-- Perform string pattern matching inside the loop
local Name, Surname = string.match(alphanumeric_text, "(%a+)%s+(%a+)%s+(.-)%s*"..searchString)
--debug
yield("/echo "..alphanumeric_text)
-- Check if Name and Surname are not nil before printing
if Name and Surname then
yield("/echo " .. Name .. " " .. Surname)
yield("/target " .. Name .. " " .. Surname)
yield("/invite ")
end
end
end

0 comments on commit e11bc92

Please sign in to comment.