From e11bc922093f1d3aa373c11b9267e514e855df8a Mon Sep 17 00:00:00 2001 From: UcanPatates <56081921+UcanPatatess@users.noreply.github.com> Date: Fri, 5 Apr 2024 16:41:23 +0300 Subject: [PATCH] Create OneClickInviter Yep i forgot to push this before --- Community Scripts/Misc/OneClickInviter | 66 ++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Community Scripts/Misc/OneClickInviter diff --git a/Community Scripts/Misc/OneClickInviter b/Community Scripts/Misc/OneClickInviter new file mode 100644 index 00000000..c24d8473 --- /dev/null +++ b/Community Scripts/Misc/OneClickInviter @@ -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