Search function

Hello, i have a Trading card game module and i wanna know if it’s possible to add to the module a seach function for the library?

Maybe… I’m not sure this is what you’re after. So if the following doesn’t hit the mark, please can you explain a bit more what you have in mind?

If you mean to search a library that is external to the module, hosted on web-pages, then thanks to a change in v3.7 by @Brent_Easton, you can now put an expression in the [HTML Help File] component. Here’s a simple example that brings up a page specific to the current scenario in a module:


I’ve worked out “codex” from a setting in the scenario file and that allows me to set the URL dynamically.

If you want to search the Vassal module library - currently hosted on the Vassal wiki- then you need to capture your search term within the module into a Global Property, and construct a URL in some form like here - my example search term is “napoleonics” and searches the whole wiki, as I couldn’t quickly figure out how to limit the search by category:

https://vassalengine.org/w/index.php?search=napoleonics&title=Special%3ASearch&profile=default&fulltext=1

You need to be careful to build a Global Property that complies with URL character rules. Google for that, but I found is easiest to use “+” for spaces and do the rest mostly in a Beanshell/Java function in the form: URLEncoder.encode(your_gp_string_here, "UTF-8")

Here’s an example of another “Starting page” expression that will create a support forum post with pre-filled input. It can be used from any module:
"https://forum.vassalengine.org/new-topic?title=" + URLEncoder.encode("["+ModuleName+"]","UTF-8") + "&body=Module+V"+ModuleVersion+"%0AVassal+V"+VassalVersionRunning+"%0AScenario+"+scenarioNameURL+"%0A%0AReplace+this+text+with+a+description+of+the+issue+and+steps+to+reproduce.+To+attach+a+logfile+first+rename+it+from+%22.vlog%22+to+%22.zip%22.+Please+also+add+a+summary+to+the+issue+title.&category=Module+Support"