Skip to content

messengerbag/Clipboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clipboard

Clipboard is a plugin for Adventure Game Studio (AGS). It offers access to the Windows clipboard, to enable AGS developers to add cut/copy/paste functionality to their AGS game, allowing data to be transferred between the game and other applications. Currently, only plain text strings (ASCII/ANSI C) can be transferred to and from the clipboard.

How To Use

To use the Clipboard plugin in an AGS project, you have to first add the plugin to AGS and activate it within the project. You then simply call the methods provided by the plugin from AGS script when you need to access the clipboard.

How to Activate Plugin

Place AgsClipboard.dll in the Adventure Game Studio engine folder, e.g. C:\Program Files (x86)\Adventure Game Studio 3.4.1 (while IDE is not running). Start the IDE and load the game project. Under the "Plugins" entry in the project tree should now appear "AGS Clipboard Plugin vX.Y (agsclipboard.dll)". Right-click and check "Use this plugin". You can now use the plugin.

How to Use Plugin Features

The plugin provides two methods: bool Clipboard.CopyText(String copyString), which copies a String you provide onto the Windows clipboard (returning true if successful), and String Clipboard.PasteText(), which returns the String that is currently on the Windows clipboard (or null if none). You can use these functions in your game to implement cut, copy and paste functionality (see the demo game).

The plugin also #defines two macros: CLIPBOARD_PLUGIN and CLIPBOARD_PLUGIN_VERSION, where CLIPBOARD_PLUGIN_VERSION is a float representation of the plugin version number, with two decimal digits for the minor version (so that e.g. v1.2 is represented as 1.02). That means that you can use #ifdef#endif and #ifndef#endif blocks in your script, so it only tries to use the clipboard if the plugin is present.

License and Credits

This code is offered under multiple licenses. Choose whichever one you like.

You may use it under the MIT license:

You may also use it under the Creative Commons Attribution 4.0 International License:

You may also use it under the Artistic License 2.0:

In game credits, the preferred style is "Clipboard plugin by Snarky" or "Clipboard plugin by Gunnar Harboe", but you can adapt it as you like to the overall style of credit (or leave it out: no in-game credit is required, though it is appreciated).