Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[New G2O][Client-Side] Clipboard

Info: You can support development of this code. Report me every bug below. I'll try to fix it.
NOTE! If you want to report a bug, make sure, that this isn't your fault!

I've recently written simple client-side squirrel module which allows you to manage windows
text clipboard. It's simple to use, it could give some new feature to chat, like ctrl+v shortcut.

*Video presentation:



*List of functions:

bool setClipboard(string text) //returns true if text was succesfully putted into clipboard

*List of Events:

onPaste(string text) //event called when player press or hold ctrl+v keys

*Usage Example:

Squirrel Script
  1. addEventHandler("onPaste",function(text)
  2. {
  3. if (chatInputIsOpen()) // this if checks if chat input from G2O is opened. It's required, because event is called everytime when player press ctrl+v keys
  4. {
  5. chatInputSetText(chatInputGetText().slice(0,-1)+text) // getting text from chatInput, slicing last character (v), and concatenate it with text from clipboard
  6. }
  7. })



-Download module
-Put the module into this directory: Game/Multiplayer/Modules (if you don't have this folder, create it)


-Put the module into main folder
-Add this line into config.xml

  1. <module src="clipboard.dll" type="client" />

Module has been updated!

List of changes:
-Changed hook from oCGame::Render to oCGame::HandleEvent
-From now on when you hold ctrl+v keys, function will be called more than once
Module has been updated!

-From now on, you don't have to use timer, to delay callback call, because first are called original functions, then hook function.

-Video Presentation has been changed.
Module has been updated!

List of changes:
-Changed callback (function onPaste) to event onPaste.

I could integrate event onPaste with chat input from G2O, but i don't want to do this, because not everyone always want to paste something to chat input.

That was propably one of the last module update. When i find some time, maybe i will push code to repository and give a free access to it.
Module and thread has been updated!

-Minor changes in solution and code

-Created and added git repository reference
-Removed md5 checksum
Thread and repository has been slightly updated. I've added and modified .gitignore file, to allow binary (.dll) file to be uploaded when i make push to repository. This simplified the way to download binary file for me, because i don't have to re-upload a file into cloud (and for you, because you can now download the file directly).
Module has been updated!

After changing resolution/world in game, event onPaste wasn't triggered, because hook oCGame::HandleEvent is reloaded by G2O in this two cases. Now (propably) everything is working perfectly (thanks for help CalystoCanem).
In newer version of the G2O, you can paste the text into textInput by default.
Also, you have the same functionality, like in the module, so currently if i'm correct, the module it self is no longer needed.

Still, i'll leave all the links and this topic, maybe someone finds it useful in some way.

Possibly Related Threads…
Thread Author Replies Views Last Post
  [G2O] SpeedBlock Marbar 16 2,411 13.10.2020, 15:32
Last Post: Sative
  [New G2O][Client-Side] LocalStorage Patrix 0 689 08.05.2020, 16:38
Last Post: Patrix
  [New G2O] Module example Patrix 4 4,580 17.05.2019, 01:30
Last Post: Patrix
  [New G2O][Client-Side] Music Module Nubzior 3 3,264 24.05.2018, 08:07
Last Post: Nubzior
  G2O - Client Side Bots(0.0.4) KimiorV 16 9,741 16.01.2017, 10:47
Last Post: KimiorV
  [DEV] G2O Bot module Sative 64 33,946 25.11.2016, 20:13
Last Post: HammelGammel
  G2O Client side bots KimiorV 4 3,098 09.06.2016, 20:11
Last Post: KimiorV

Forum Jump:

Users browsing this thread: 1 Guest(s)