Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setClipboardText(s) #2922

Merged
merged 12 commits into from
Dec 11, 2023
Merged

Add setClipboardText(s) #2922

merged 12 commits into from
Dec 11, 2023

Conversation

Sandalot
Copy link
Contributor

@Sandalot Sandalot commented Dec 3, 2023

Add function to set clipboard text

Looking for any feedback, I'm sure I overlooked a few things.

Add function to set clipboard text
Copy link
Member

@Denneisk Denneisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just curious, what's the intended use-case for this extension?

@Sandalot
Copy link
Contributor Author

Sandalot commented Dec 3, 2023

m just curious, what's the intended use-case for this extension?

I want to be able to copy a players SteamID so I can paste it into tools outside of the game.
I used to use E2 to supplement the moderation tools the last server I played on had, being able to just copy SteamIDs and entity IDs would have saved me some clicks.

@Divran
Copy link
Contributor

Divran commented Dec 3, 2023

I'm not sure this belongs in wiremod at all

@Vurv78
Copy link
Contributor

Vurv78 commented Dec 3, 2023

Only problem I have with it is the excessive limits we're gonna need to implement since E2 doesn't have a client realm yet.

If we have concmd, why not this?

I don't see much point in it right now tho. Why not just implement said moderation tools with http inside E2?

Moved setClipboardText(s) from its own extension to debug.

Also moved e2helper description to a more appropriate location
Added a convar to limit the amount of characters the server is willing to send.

Made use of `#` operator

Limit check now returns nil
Added a cooldown convar and fixed limit test
@Sandalot Sandalot requested a review from Vurv78 December 4, 2023 08:09
lua/wire/client/e2descriptions.lua Outdated Show resolved Hide resolved
lua/entities/gmod_wire_expression2/core/debug.lua Outdated Show resolved Hide resolved
return self:throw("setClipboardText exceeding string limit of " .. clipboard_character_limit:GetInt() .. " characters", nil)
end

timer.Create( timerid, clipboard_cooldown:GetInt(), 1, function() timer.Remove(timerid) end)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timer should remove itself since it only has one rep

I think you'd be better off keeping the last time it was called as a variable somewhere and checking if it has been a second instead of this timer solution.

We really need a generic limit system

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be alright to use a global table for tracking each E2 and storing the the last time it was called as the value?

Copy link
Contributor

@Divran Divran Dec 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at how other extensions have done it, I don't have time to dig up examples right now but I'm sure some of them do basically what vurv is talking about

edit: ok it looks like you may have already done it, nevermind

 oops forgot to remove that
Change to some less confusing
minor nitpicks, I agree its nicer.
Removed timer as suggested and added table to track when last called.
@Sandalot Sandalot requested a review from Vurv78 December 9, 2023 15:16
@Sandalot Sandalot requested a review from Denneisk December 10, 2023 04:31
@thegrb93 thegrb93 merged commit 77e1423 into wiremod:master Dec 11, 2023
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants