Skip to content
This repository has been archived by the owner on Mar 19, 2019. It is now read-only.

JavaScript API

Vladimir Alyamkin edited this page Jul 10, 2014 · 11 revisions

All images can be opened with the orinal size by RMB -> "Open image in new tab"

Overview

Unlike other web UI solutions for UE4 VaQuoleUI plugin uses raw script code commands to control the UI. It is most powerfull and flexible approach that gives full control of web application.

I'm pretty sure that it's better to write your own macroses to build the script with parameters you want than meet a limitations of "supplied interface".

Usage advice

You can get the extra power using the VaRest plugin with blueprintable Json objects.

All values received with events from web application are serialized to FString. You can send them from web UI as serialized Json string, and then process it with as a Json in blueprints.

VaRest Example

It will be the best option to handle large amounts of data.

Script Commands (game -> web UI)

Using EvaluateJavaScript node you can send JavaScript code to the web application and evaluate it. Because of asynchronous nature of VaQuoleUI plugin the return value of evaluated script can be received with the FScriptEvalResult event only.

The event has two parameters:

  1. FString Eval Uuid
  2. FString Eval Result

Being queued script command generates the Uuid that can be used to match the evaluation event with previously sent command. Despite on original type return value will be serialized to FString. See the example with notes below.

Script Events (web UI -> game)

You can send custom events from the web application too. To send the event you should call scriptEvent("Command", "Message") function of VaQuoleWebView object with JavaScript: VaQuoleWebView.scriptEvent("ConsoleCommand", "showhud");

On the game side the event FScriptEvent will be broadcasted with two parameters:

  1. FString Event Name
  2. FString Event Command

Check the ConsoleCommand event example below.

Script Examples

Check the provided application \VaQuoleUI\UIResources\example.html with both ways communication examples.