Skip to content
RevComGaming edited this page Jan 14, 2023 · 6 revisions

RevComEngine-Core Wiki

RevComEngine Core is a free and open source plugin for RPG Maker VX Ace that provides the functionality of customizible dialog boxes, user input capturing, asset downloading, and database communications. It's features include:

  • Dialog boxes, called Interfaces, that can be created, customized, and managed from a central point
  • Interfaces can contain graphical elements like text, images, or bars, interactive elements like buttons or input boxes, and lists of elements
  • User input mapping including alphanumeric keys, space bar, back button, enter button, tab bar, and shift bar
  • Timer and scene change events that can call functions
  • Mouse position tracking and mouse button interaction checking capability
  • Buttons can respond to mouse interactions including mouse over, mouse out, and mouse click which can be set to call functions
  • Inputs can be given focus or blurred and set to send inputted text to a function
  • Can set mouse representation image
  • Interfaces can follow game characters
  • Inputs can be restricted to allow alphanumeric characters, letters, or numbers, and set to allow spaces in text
  • Bars can use numerical or time based values
  • Can store user settings and save them locally
  • Can log to local files
  • Download files that have been registered with the server by latest version or sets of files by game version. This including audio files (BGM, BGS, ME, and SE), graphics files (Animations, Battlebacks1, Battlebacks2, Battlers, Characters, Faces, Parallaxes, Pictures,
  • System, Tilesets, Titles1, and Titles2), and data scripts
  • Communicating with databases to run queries and functions

Install

Installation is adding script to RPG Maker VX Ace's Script Editor, preferably last in order, with scripts installed afterwards.

Installation

Interfaces

Interfaces are the holder for all graphical and interactive elements. They can be customized to contain graphical elements like text, images, or bars that can visually updated to represent numerical values. They can be customized to contain interactive elements like buttons or input boxes, and lists of elements. Their backgrounds can be changed to any image or made transparent. They can be set to follow game characters for things like moving dialog boxes. When an interface is created, it is given a designation which the plugin will use to track it globally. This will allows developers to reference it from anywhere in the application code.

- Create an interface

Create an interface example

Example creates a dialog box with the designation "dialogbox" at X-axis position of 100 and Y-axis of 100 of top left point in pixels of the interface from the top left corner of the app window, and with a width of 200 pixels and height of 150 pixels. Additionally, there is an optional mode value for making the interface blinking and show at half opacity.

	- Code: 

		RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 200, 150);

	- Function Definition:

		/* Creates interface, returns interface’s object */
		InterfaceAdd(strDesign, 		/* Designation used for later references to interface */
                            nXPos = 0, 			/* X-Axis position of the top left point in pixels of the interface from the top left corner of the app window, defaults to the top left corner of the app window */
                            nYPos = 0, 			/* Y-Axis position of the top left point in pixels of the interface from the top left corner of the app window, defaults to the top left corner of the app window */
                            nWidth = Graphics.width, 	/* Width of the interface, defaults to the full width of the interface */
                            nHeight = Graphics.height, 	/* Height of the interface, defaults to the full height of the interface */
                            nMode = 0,			/* Interface's visual mode: 0 - normal full opacity, 1 - blinking, 2 - half opacity */
                            boolSafeCreate = false)		/* Indicator to use memory management for interface creation. It is advised not to change this value unless having advance knowledge of it operation */

- Create interface with text

Interface with text

Example adds text to a created dialog box with the designation "dialogbox" at X-axis position of 10 and Y-axis of 20 of top left point in pixels of the interface.

	- Code:

		RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 200, 150) 

		RevComEngine_Core.InterfaceTextAdd("dialogbox", "exampletext", "This is added text", 10, 20) 

	- Function Definition:

		/* Adds text to interface, returns indicator that text was added */
		InterfaceTextAdd(strDesign, 		/* Designation of interface to add text to */
                                 strCompDesign, 		/* Designation of text being added for later reference */
                                 strText, 			/* Text to add */
                                 nXOffset = 0, 		/* X-Axis position of the top left point in pixels from the top left corner of the interface, defaults to the top left corner of the interface */
                                 nYOffset = 0)  		/* Y-Axis position of the top left point in pixels from the top left corner of the interface, defaults to the top left corner of the interface */

- Create interface with image and text

interface with image and text IconSet

Example creates an image for use on an interface by first registering the image. This allows for the use of the image across multiple interfaces by referencing its own definition. The "SetImage" function can load images from RPG Maker's cache or directly from the app's subfolders. The example uses the "nType" value of 3 to load the image from a RPG Maker "system" folder instead of using the direct file path, and creates it from a piece of spritesheet. The function allows for setting making a image from a larger one, mainly for use of spritesheets. The image "dialogimage" is created as a 24 by 24 pixel image from larger spritesheet, and offset from the spritesheet's top left corner by 360 on the X-axis and 96 on the Y-axis. The image is created on a dialog box with the designation "dialogbox" at X-axis position of 100 and Y-axis of 100 of top left point in pixels of the interface.

	- Code: 

		RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 200, 150) 

		RevComEngine_Core.InterfaceTextAdd("dialogbox", "exampletext", "This is added text", 10, 20) 

		RevComEngine_Core.SetImage("newimage", 
                        "IconSet.png", 
                        3,
                        24, 
                        24,
                        360, 
                        96)

		RevComEngine_Core.InterfaceImageAdd("dialogbox", 
                                 "dialogimage", 
                                 "newimage",
                                 100, 
                                 100)

	- Function Definition:
		
		/* Loads image for use with RevComEngine_Core functions */
		SetImage(strImgDesign, 		/* Designation of image for future reference */
                        strSpritesheetPathName, 	/* The filename of the image. If changing "boolLoad" to "true", then this needs to the path and filename of the image in the app's subfolder */
                        nType,			/* The type of image being loaded based on RPG Maker's image types and their folders. If changing "boolLoad" to "true", this is not used. Possible value: 0 - character, 1 - tileset, 2 - animation, 3 - system, 4 - picture, 5 - battleback1, 6 - battleback2, 7 - battler, 8 - face, 9 - parallax, 10 - title1, 11 - title2 */
                        nWidth, 			/* Width of the image in pixels. This is can a subsection size within a larger image or spritesheet */
                        nHeight,			/* Height of the image in pixels. This is can a subsection size within a larger image or spritesheet */
                        nXPos, 			/* X-axis starting offset of the image in pixels if inside a larger image or spritesheet. If using the full image, set to 0 */
                        nYPos,			/* Y-axis starting offset of the image in pixels if inside a larger image or spritesheet. If using the full image, set to 0 */
                        boolLoad = false,		/* Indicator to load image directly or from RPG Maker's app cache. If set to "true", "strSpritesheetPathName" must be set to the path and filename of the image in the app's subfolder */
                        boolDispose = true)		/* Indicator to unload image when no longer referenced. This set be set to "false" if image is used elsewhere in app. */

		/* Adds loaded image to interface, returns bitmap object for image, else a “nil” value */
		InterfaceImageAdd(strDesign, 		/* Designation of interface to add image to */
                                 strCompDesign, 	/* Designation of image within interface that's being added to, used for future reference */
                                 strImgDesign,	/* Designation of loaded image used in "SetImage" function */
                                 nXOffset, 		/* X-Axis position of the top left point in pixels from the top left corner of the interface */
                                 nYOffset, 		/* Y-Axis position of the top left point in pixels from the top left corner of the interface */
                                 nZPos = 100)	/* X-Axis position used in the layering of images, default to 100 to overlay standardly used app images */

- Set interface background image

Interface with replaced background

Example creates an interface with text after replacing its background. The “SetWindowFrame” function that part of the interface’s main object, “BGMRPGM_Base”, allows for changing the background image of the interface.

	- Code: 

		interface = RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 200, 150) 
  
		RevComEngine_Core.SetImage("backimage", 
                        "background.png", 
                        3,
                        60, 
                        48,
                        0, 
                        0)
                        
		backgroundimage = RevComEngine_Core.GetImage("backimage")

		interface.SetWindowFrame(backgroundimage)
                                 
		RevComEngine_Core.InterfaceTextAdd("dialogbox", "exampletext", "This is added text", 10, 20) 

	- Function Definition:

		/* Sets background image for interface */
		BGMRPGM_Base.SetWindowFrame(bmImage = nil)  /* Bitmap object to replace interface background, defaults to nil which removes the background image from the interface */

- Make interface transparent

Interface with transparent background

Example creates an interface with image and text that has a transparent background. The “SetWindowFrame” function that part of the interface’s main object, “BGMRPGM_Base”, allows for changing the background image of the interface, and can remove the image if not set to the value.

	- Code: 

		interface = RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 200, 150) 

		interface.SetWindowFrame()

		RevComEngine_Core.InterfaceTextAdd("dialogbox", "exampletext", "This is added text", 10, 20) 

		RevComEngine_Core.SetImage("newimage", 
                        "IconSet.png", 
                        3,
                        24, 
                        24,
                        360, 
                        96)

		RevComEngine_Core.InterfaceImageAdd("dialogbox", 
                                 "dialogimage", 
                                 "newimage",
                                 100, 
                                 100)

- Make an interface follow a character

Interface following character

Example sets up an interface to follow the game player’s character. First, the “SetMapStartFunc” function is used to call the user created “Setup” function when map, #1, is started. This allows the code to wait until the game player’s object, $game_player, exists with the map. When the map is created, the interface is created, text is added to it, and it is set to follow the player character with a X-axis offset of 15 and a Y-axis offset of -100 so that it follows behind and above the character.

	- Code:

		RevComEngine_Core.SetMapStartFunc(1, 
                               self, 
                               "Setup")
                               
		def Setup

			RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 200, 75)                  

			RevComEngine_Core.InterfaceTextAdd("dialogbox", "exampletext", "This is added text", 10, 20) 

			RevComEngine_Core.InterfaceGet("dialogbox").SetFollower($game_player, 15, -100)
		end

	- Function Definition:

		/* Creates event to be triggered when a specific map is loaded, and calls specified method within an object, returns object ID for the event */
      			SetMapStartFunc(nMapID, 	/* Map number within app */
                               		objDestination, 	/* Object to call when map is created which contains the method to run */
                               		strMethodName, 	/* Name of method to run within object */
                               		mxValue = nil, 	/* Value to pass method being ran, defaults to nil value */
           	                   	boolRemoveAfter = true /* Remove this call event after initially ran */)

		/* Gets existing interface’s object */
		InterfaceGet(strDesign /* Designation of interface to get object for */)

		/* Sets follower for interface */
		BGMRPGM_Interface.SetFollower(mxSetFollower /* Object for RPG Maker’s Game Player or Character for interface to follow */, 
			nSetXFollowOffset = @nXFollowOffset /* X-axis offset of top left corner of RPG Maker’s Game Player or Character image to follow, defaults to 0 or previously set value */, 
			nSetYFollowOffset = @nYFollowOffset /* Y-axis offset of top left corner of RPG Maker’s Game Player or Character image to follow, defaults to 0 or previously set value */)

Buttons

- Add Button to Interface

Add button to interface

Example sets up a button on an interface that is X-axis offset 10 pixels and X-axis offset 15 pixels from the top left corner of the interface with a width and height of 100 by 50, and having the text “BUTTON”. The button’s object is then used to set user function call to change the color of the button on mouse in and out events and left and right click events.

	- Code:

		RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 200, 75)                  

		button = RevComEngine_Core.InterfaceButtonAdd("dialogbox", "dialogbutton", 10, 15, 100, 50, "BUTTON")

		button.SetMouseInFuncCall(self, "BtnInEvent")
           
		button.SetMouseOutFuncCall(self, "BtnOutEvent") 

		button.SetMouseClickFuncCall(self, "BtnClickLeftEvent", 0)

		button.SetMouseClickFuncCall(self, "BtnClickRightEvent", 1)

     			 def self.BtnInEvent(btnSelect)
           
           			btnSelect.SetWindowBackColor(3)
      			end
                          
      			def self.BtnOutEvent(btnSelect)
           
           			btnSelect.SetWindowBackColor()
      			end
                          
      			def self.BtnClickLeftEvent(btnSelect)
           
           			btnSelect.SetWindowBackColor(1)
      			end
                          
      			def self.BtnClickRightEvent(btnSelect)
           
           			btnSelect.SetWindowBackColor(2)
      			end
         
	- Function Definition:

		/* Adds button to interface, returns button’s object */
		InterfaceButtonAdd(strDesign, /* Designation of the interface to add the button */
                                   strCompDesign, /* Designation of the button being created, for future reference */
                                   nXOffset, 	/* X-Axis offset of the top left point in pixels from the top left corner of the interface */ 
                                   nYOffset, 	/* Y-Axis offset of the top left point in pixels from the top left corner of the interface */ 
                                   nWidth, 	/* Width of the button in pixels */ 
                                   nHeight,	/* Height of the button in pixels */ 
                                   strText = nil /* Button text, defaults to nil for no text */ )

		/* Sets up mouse “IN” event to call, when triggered, a method within an object, returns indicator if the event was created */
		BGMRPGM_Input.SetMouseInFuncCall(objDestination, /* Object to call mouse “IN” event is triggered */ 
							       strMethodName) /* Name of function to run in object when mouse “IN” event is triggered */ 
		BGMRPGM_Input.SetMouseOutFuncCall(objDestination, /* Object to call mouse “OUT” event is triggered */ 
							          strMethodName) /* Name of function to run in object when mouse “OUT” event is triggered */ 
		BGMRPGM_Input.SetMouseClickFuncCall(objDestination,  /* Object to call mouse “CLICK” event is triggered */ 
								 strMethodName, /* Name of function to run in object when mouse “CLICK” event is triggered */ 
								 nClickType = 0) /* Numeric value for click event type. Values: 0 – Left click, 2 – Right click. Defaults to left “CLICK” mouse events */ 

Text Boxes

- Create textbox

Added textbox to interface

Example sets up an input box on an interface that is X-axis offset 10 pixels and X-axis offset 15 pixels from the top left corner of the interface with a width and height of 100 by 50, and it does not have initial focus or default text.

	- Code:

		RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 200, 75)                  

		RevComEngine_Core.Initialize()

		RevComEngine_Core.InterfaceInputAdd("dialogbox", 
                                  "dialogtextbox", 
                                  10, 15, 100, 50)
         
	- Function Definition:

		/* Sets up RevComEngine_Core higher functionality */
		Initialize(strTitle = nil, /* Title of app window to identify specific app get inputs from, defaults to nil which sets it to the current app window */
			   boolMapDefaultKeys = true) /* Indicator to setup keymapping on specific keys for use with textboxes for all alphanumeric keys, 'ENTER', 'SPACE', 'BACK', 'TAB', 'SHIFT', and 'PERIOD' keys. This will remove any previous keymapping settings including those created by RPG Maker.

		/* Adds textbox to interface, returns textbox’s object */
		InterfaceInputAdd(strDesign, /* Designation of the interface to add the textbox */
                                  strCompDesign, 		 /* Designation of the textbox being created, for future reference */
                                  nXOffset, 			/* X-Axis offset of the top left point in pixels from the top left corner of the interface */ 
                                  nYOffset, 			/* Y-Axis offset of the top left point in pixels from the top left corner of the interface */ 
                                  nWidth, 			/* Width of textbox in pixels */ 
                                  nHeight,			/* Height of textbox in pixels */ 
                                  boolHasFocus = false,	/* Indicator to give the textbox focus for input, defaults to false */
                                  strDefaultText = nil)		/* Default text to be in textbox */ 

- Create textbox for numbers only

Example sets up an input box on an interface that is X-axis offset 10 pixels and X-axis offset 15 pixels from the top left corner of the interface with a width and height of 100 by 50, and it does not have initial focus or default text. An additional setting on the textbox’s object restricts it to only accepts numbers as input.

	- Code:

		RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 200, 75)                  

		RevComEngine_Core.Initialize()

		textbox = RevComEngine_Core.InterfaceInputAdd("dialogbox", 
                                  "dialogtextbox", 
                                  10, 15, 100, 50)

		textbox.SetTextType(2)
         
	- Function Definition:

		/* Changes the type of input the input box accepts */
		BGMRPGM_Input.SetTextType(nSetTextType = 0) /* Numeric value for type of input to accept, defaults to 0 for any characters. Values: 0 – any characters, 1 – letters only, 2 – numbers only */

- Capture textbox input

Textbox capture text

Example sets up an input box and button and uses them to update text in the interface by setting the button “CLICK” event’s set user function to call the input box “SEND” event that is also set to user function. Input boxes and buttons can be set to call multiple user functions. The example sets the button “CLICK” event to the user function “SetText” and the input box’s “SEND” event is set to “SendText”. When the “CLICK” event is triggered, it will use the interface’s “SendInput” function to trigger the input button’s “SEND” event that will call “SetText”. In the “SetText” function, it will use the interface’s “InterfaceTextSet” to update previously added text.

	- Code:

		RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 185, 110)                  

		RevComEngine_Core.Initialize()

		RevComEngine_Core.InterfaceTextAdd("dialogbox", 
                                 "dialogtext", 
                                 "STARTING TEXT", 
                                 10, 
                                 5)

		textbox = RevComEngine_Core.InterfaceInputAdd("dialogbox", 
                                  "dialogtextbox", 
                                  10, 50, 100, 50)
		textbox.SetFuncCall(self, "SetText")

		button = RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton", 
                                  110, 50, 65, 50, "SET")
                                  
		button.SetMouseClickFuncCall(self, "SendText", 0)

		button.SetMouseInFuncCall(self, "BtnInEvent")
           
		button.SetMouseOutFuncCall(self, "BtnOutEvent") 

		def self.SendText(buttontext)
           
				interface = RevComEngine_Core.InterfaceGet("dialogbox") 
                                  
 				interface.SendInput("dialogtextbox")                            
		end

		def self.SetText(newtext)

			RevComEngine_Core.InterfaceTextSet("dialogbox", "dialogtext", newtext)
		end

		def self.BtnInEvent(btnSelect)
           
			btnSelect.SetWindowBackColor(3)
		end
                          
		def self.BtnOutEvent(btnSelect)
           
			btnSelect.SetWindowBackColor()
		end
         
	- Function Definition:

		/* Sets input’s default event to be triggered when interacted with, returns indicator that event was created */			
                                BGMRPGM_Input.SetFuncCall(objDestination, /* Object to call textbox’s “SEND” event is triggered */ 
						     strMethodName) /* Name of function to run in object when textbox’s “SEND” event is triggered */ 

		/* Triggers input’s default event */	
 			SendInput(strDesign)     /* Designation of textbox trigger “SEND” event */

		/* Updates texts on an interface, returns indicator that text was updated */	
		InterfaceTextSet(strDesign, /* Designation of the interface containing previously created text */
                                  strCompDesign, 	/* Designation of previously added text */
                                  strText) 		/* Text to update to */

Bars

- Creating different types of bars

Bars example

Example sets up three different bars: static, fill, and timed. The static bar is set to a value of 100 with a limit of 100, making the bar appear full. A mouse “CLICK” event is used to decrease the value by 10, showing it decrease. The fill bar is set to a value of 0 with a limit of 100. This causes the bar start off invisible until given a value greater than 0. A mouse “CLICK” event is used to increase the value by 10, making it visible and showing it increase. The timer bar is set to a value of 100 with a limit of 100 and a time limit of 50 seconds. This causes the bar automatically decrease over time.

	- Code:
		@bar1value = 100
		@bar2value = 0

		RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 150, 170)                  

		RevComEngine_Core.InterfaceBarAdd("dialogbox", 
                                "dialogbar1", 
                                10, 
                                10, 
                                100,
                                20, 
                                0,
                                @bar1value,
                                @bar1value) 
                                
                                
		RevComEngine_Core.InterfaceBarAdd("dialogbox", 
                                "dialogbar2", 
                                10, 
                                40, 
                                100,
                                20, 
                                1,
                                @bar2value,
                                100,
                                7,
                                8)
                                
                                
		RevComEngine_Core.InterfaceBarAdd("dialogbox", 
                                "dialogbar3", 
                                10, 
                                70, 
                                100,
                                20, 
                                2,
                                100,
                                100,
                                9,
                                10,
                                50000)
                                
		button = RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton", 
                                  30, 110, 75, 50, "CHANGE")
                                  
		button.SetMouseClickFuncCall(self, "ChangeBars", 0)

		def self.ChangeBars(buttontext)

			@bar1value -= 10
			@bar2value += 10

				RevComEngine_Core.InterfaceBarSetValue("dialogbox", "dialogbar1", @bar1value) 
				RevComEngine_Core.InterfaceBarSetValue("dialogbox", "dialogbar2", @bar2value) 
		end
         
	- Function Definition:

		/* Adds graphical bar to interface, returns interface’s object */	
		InterfaceBarAdd(strDesign, /* Designation of the interface to add the bar */
                                strCompDesign, /* Designation of the textbox being created, for future reference */
                                nXOffset, 			/* X-Axis offset of the top left point in pixels from the top left corner of the interface */ 
                                nYOffset, 			/* Y-Axis offset of the top left point in pixels from the top left corner of the interface */ 
                                nWidth, 			/* Width of bar in pixels */ 
                                nHeight = 15, 		/* Height of bar in pixels, defaults to 15 pixels minimum */ 
                                nType = 0, 			/* Type of bar, values: 0 for static bar, 1 for fill bar that comes invisible when its value is 0, 2 for timed bars that decrease over a set period of time */
                                nValue = 0, 			/* Current value to be visually represented on the bar */
                                nLimit = 100, 		/* Maximum value of the bar to contrast against current */
                                nColorBar = 0, 		/* Color value based on RPG Maker color settings, used to represent current value of bar */
                                nColorBack = 19,		/* Color value based on RPG Maker color settings, used to represent static background of bar */
                                fTimeLimitInMillis = 5000) /* Time span in milliseconds for decreasing of timer bar, only used when “nValue” is set to 2, defaults to 5000 milliseconds */

Lists

- Creating lists of components

List example

Lists can contain a series of components including bars, images, buttons, and textboxes. When a component is added to a list, it’s positional settings are ignored, and became controlled by the list’s position and spacing settings. Example creates six buttons, and puts them into two lists, one that is horizontally tiled and the other vertically.

	- Code:
		@width = 40
		@height = 50

		RevComEngine_Core.InterfaceAdd("dialogbox", 10, 10, 150, 250)                  

		RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton1", 
                                  10, 75, @width, @height, "1")
		RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton2", 
                                  10, 75, @width, @height, "2")
		RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton3", 
                                  10, 75, @width, @height, "3")
		RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton4", 
                                  10, 75, @width, @height, "4")
		RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton5", 
                                  10, 75, @width, @height, "5")
		RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton6", 
                                  10, 75, @width, @height, "6")
                                  
		RevComEngine_Core.InterfaceListAdd("dialogbox", 
                                 "dialoglist1",
                                 10, 
                                 10, 
                                 @width, @height)
                                  
		RevComEngine_Core.InterfaceListAdd("dialogbox", 
                                 "dialoglist2",
                                 10, 
                                 70, 
                                 @width, @height, 1)
                                 
		RevComEngine_Core.InterfaceListItemAdd("dialogbox", 
                                 "dialoglist1",
                                 "dialogbutton1")
		RevComEngine_Core.InterfaceListItemAdd("dialogbox", 
                                 "dialoglist1",
                                 "dialogbutton2")
		RevComEngine_Core.InterfaceListItemAdd("dialogbox", 
                                 "dialoglist1",
                                 "dialogbutton3")
                                 
		RevComEngine_Core.InterfaceListItemAdd("dialogbox", 
                                 "dialoglist2",
                                 "dialogbutton4")
		RevComEngine_Core.InterfaceListItemAdd("dialogbox", 
                                 "dialoglist2",
                                 "dialogbutton5")
		RevComEngine_Core.InterfaceListItemAdd("dialogbox", 
                                 "dialoglist2",
                                 "dialogbutton6")
         
	- Function Definition:

	/* Adds list of elements to interface, returns indicator if list was added */
	InterfaceListAdd(strDesign, /* Designation of the interface to add the list */
                                 strCompDesign,	/* Designation of the list being created, for future reference */
                                 nXOffset, 		/* X-Axis offset in pixels between list’s components  */ 
                                 nYOffset, 		/* Y-Axis offset in pixels between list’s components */ 
                                 nItemWidth, 		/* Expected width of components to be added to list, used for spacing  */ 
                                 nItemHeight,		/* Expected height of components to be added to list, used for spacing  */ 
                                 nOffsetType = 0)	/* Tile type of components, values: 0 – Tile components horizontally,  1 – Tile components vertically, other values - Tile components diagonally. Defaults to 0 for  horizontal tiling  */ 
             
	/* Adds element to existing list of an interface, returns indicator if element was added */
	InterfaceListItemAdd(strDesign, /* Designation of the interface containing list to add the component to */
                                    strCompDesign,		/* Designation of the list to add component to */
                                    strItemDesign) 		/* Designation of the component to add to the list */

Timers and Map Events

- Setup events for maps and timed changes

Map/Timer events example

Events can setup to trigger when maps are entered or by timed settings. The example sets up event trigger when map 1 is entered to create an interface, add a button to it, and create a reoccurring timed event trigger for change the button’s background color.

	- Code:
         		@color = 1
                                  
		RevComEngine_Core.SetMapStartFunc(1, self, "MapStart")

		def self.MapStart

			RevComEngine_Core.InterfaceAdd("dialogbox", 10, 10, 120, 80)                  

			RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton", 
                                  10, 10, 100, 50, "EXAMPLE")

 		RevComEngine_Core.SetTimer("dialogtimer",
		self,
 		"ChangeButtonColor",
		3000,
		Time.now,
		0,
		0,
		true)
	end

	def self.ChangeButtonColor

		interface = RevComEngine_Core.InterfaceGet("dialogbox")

		interface.SetInputButtonBackColor("dialogbutton", @color)
                                  
 		@color += 1

 		if @color > 19

				@color = 1
		end
	end

	- Function Definition:

	/* Sets up timed event */
	SetTimer(strDesign, 		/* Designation of new timer, for future reference */
                        objDestination, 		/* Object to call when timer event is triggered */
                        strMethodName,		/* Name of method to run within object */
                        nTimeInMillis,		/* Time span in milliseconds to trigger event */ 
                        tmStart = Time.now,	/* Time to start countdown to event trigger, default to current time */
                        nDelayInMillis = 0,	/* Time span to delay in milliseconds after start time set in “tmStart” to begin countdown to event trigger. Defaults to 0 for no delay */
                        nIntervals = 0,		/* Number of times to execute event trigger. This is ignored if “boolContinous” is set to “true”. Defaults to 0 so event trigger only occurs once */
                        boolContinous = false,	/* Indicator to continually run event after countdown from previous execution */
	   mxParams = nil)		/* Parameters to pass to the ran function. Defaults to nil value to pass no value. */

	/* Changes input box or button’s background color, returns indicator that update occurred */          
	BGMRPGM_Interface.SetInputButtonBackColor(strDesign, /* Designation of button within interface of color to change */
							          nColor = nil) /* RPG Maker color number to update button’s color to. Defaults to nil value to reset it to default background color */

Mouse Image

- Setup image to follow mouse

Mouse follow example

Images can be setup to follow mouse movement. An event is used to setup the follow since it requires app to have accessed Operating System resources which might delayed from start of app.

	- Code:
		RevComEngine_Core.SetImage("newimage", 
                        "IconSet.png", 
                        3,
                        24, 
                        24,
                        360, 
                        96)
                        
 		RevComEngine_Core.SetTimer("dialogtimer",
		self,
 		"AttachImage",
		500)
    
    			def AttachImage
		
      				RevComEngine_Core.SetMouseImage("newimage")
    			end

	- Function Definition:

		/* Sets loaded image to follow mouse movement */          
		SetMouseImage(strImageDesign, /* Designation of the image to have follow mouse */
				   nZPos = 100000, /* Layer on which to set image for layering */
				   nAngle = 0)	        /* Angle in degrees which rotate image from top left corner of mouse pointer */

KeyMapping

- Mapping keys to events

Keymapping example

Example sets up four key events to a function and pass text to update an interface with. It uses the “InputMapKeyToFunc” function to setup alphanumeric keys, and uses “InputMapTabBarToFunc” and “InputMapSpaceBarToFunc” functions for the Tab key and Spacebar , respectively. The “Initialize” function must be called first to setup access to key events.

	- Code:
		RevComEngine_Core.Initialize()

		RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 200, 150) 

		RevComEngine_Core.InterfaceTextAdd("dialogbox", "exampletext", "This is added text", 10, 20) 

		RevComEngine_Core.InputMapKeyToFunc("k", self, "UpdateText", "K was pressed")
		RevComEngine_Core.InputMapKeyToFunc("a", self, "UpdateText", "A was pressed")
  			RevComEngine_Core.InputMapTabBarToFunc(self, "UpdateText", "TAB was pressed")
  			RevComEngine_Core.InputMapSpaceBarToFunc(self, "UpdateText", "SPACEBAR was pressed")
  
  			def self.UpdateText(text)
    
    				RevComEngine_Core.InterfaceTextSet("dialogbox", "exampletext", text)
  			end

	- Function Definition:

		/* Sets up alphanumeric key press event, and method within object to be called when triggered */          
		InputMapKeyToFunc(strKey, 	/* Lowercase of alphanumeric character of key for event to map  */
					objOwner, 	/* Object to call when key is pressed which contains the method to run */
					strFuncName, /* Name of method to run within object */
					mxValue = nil) /*  Value to pass method when its called, default value is nil */  

		/* Sets up TAB key press event, and method within object to be called when triggered */          
  			InputMapTabBarToFunc(objOwner, /* Object to call when key is pressed which contains the method to run */
					     strFuncName, /* Name of method to run within object */
					     mxValue = nil) /*  Value to pass method when its called, default value is nil */  


		/* Sets up SPACEBAR key press event, and method within object to be called when triggered */          
  			InputMapSpaceBarToFunc(objOwner, /* Object to call when key is pressed which contains the method to run */
					         strFuncName, /* Name of method to run within object */
					         mxValue = nil) /*  Value to pass method when its called, default value is nil */ 

Settings

- Setting and retrieving settings values

Settings example

Example takes text from an input box and uses mouse “CLICK” and input boxes “SEND” events to pass the value to a function where the save functionality is used to store the value for later use. The “SetSetting” function saves a value by a setting name, can be saved to local file, and retrieved later including by other instances of the app using the “GetSetting” function.

	- Code:   

		RevComEngine_Core.Initialize()

		RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 250, 110)               

		RevComEngine_Core.InterfaceTextAdd("dialogbox", 
                                 "dialogtext", 
                                 "STARTING TEXT", 
                                 10, 
                                 5)

		textbox = RevComEngine_Core.InterfaceInputAdd("dialogbox", 
                                  "dialogtextbox", 
                                  10, 50, 100, 50)
		textbox.SetFuncCall(self, "SetText")

		button = RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton1", 
                                  115, 50, 65, 50, "SET")
                                  
		button.SetMouseClickFuncCall(self, "SendText", 0)

		button.SetMouseInFuncCall(self, "BtnInEvent")
           
		button.SetMouseOutFuncCall(self, "BtnOutEvent") 
  
		button = RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton2", 
                                  180, 50, 65, 50, "GET")
                                  
		button.SetMouseClickFuncCall(self, "GetText", 0)

		button.SetMouseInFuncCall(self, "BtnInEvent")
           
		button.SetMouseOutFuncCall(self, "BtnOutEvent") 

		def self.SendText(buttontext)
           
				interface = RevComEngine_Core.InterfaceGet("dialogbox") 
                                  
 				interface.SendInput("dialogtextbox")                           
		end

		def self.SetText(newtext)

				  RevComEngine_Core.SetSetting("settingtext", newtext)  
		end

		def self.GetText(newtext)

			RevComEngine_Core.InterfaceTextSet("dialogbox", "dialogtext", RevComEngine_Core.GetSetting("settingtext"))
		end

		def self.BtnInEvent(btnSelect)
           
			btnSelect.SetWindowBackColor(3)
		end
                          
		def self.BtnOutEvent(btnSelect)
           
			btnSelect.SetWindowBackColor()
		end

	- Function Definition:

		/* Stores setting value by a name */          
		SetSetting(strSettingName, /* Name of setting to save */ 
			      mxValue)	         /* Value of setting to save */

		/* Gets setting value by a name */        
		GetSetting(strSettingName) /* Name of setting to retrieve */

Downloading Files:

This functionality requires the installation of RevCommServer, RevCommClient, and RevCommProcessor which is documented in the References section. This operators by having files for download registered with RevCommServer with a designation. When an app uses RevCommProcessor and RevCommClient to connect to RevCommServer, it gets a list of the available file designations. The app can use the designations to request download to a specific local folder. The following examples require having images placed on the server in a “files” folder in the same directory as the RevCommServer app. The images are registered by adding the following settings to RevCommServer’s config file, “RevCommConfig.xml”. In the file, the “operations” section by default is commented out. The comments must be removed, and the addition placed under the “operations” section’s “commands” section. Notice that the add sections, named “registerfile”, has settings for “filedesignation” and “filenamepath” which registers the file designation and its path in a subfolder with RevCommServer, respectively. Examples of the config file settings, the specific settings for registering download files, and examples of the files on the server.

DownloadServerConfig

<registerfile>
	<filedesignation>image1</filedesignation>
	<filenamepath>IconSet.png</filenamepath>
</registerfile>
<registerfile>
	<filedesignation>image2</filedesignation>
	<filenamepath>background.png</filenamepath>
</registerfile>

ServerImageFiles

- Downloading a specific file to a RPG Maker folder

DownloadFileFolder

The example downloads an image file from a server and drops it into a specified RPG Maker folder. It connects to the server, and then uses a timer to wait 10 seconds to allow the client and server to connect and communicate the list of files by designation that are available for download. It takes the first designation in the list and makes it into the text on a button. When the button is pressed, it passes the button’s object to a “CLICK” event function where it gets the button’s text from the object’s “GetText” function. It uses designation to request the file be downloaded to the RPG Maker folder “System” under the “Graphics” folder.

	- Code:

  			if RevComEngine_Core.Connect([SERVER IP ADDRESS]) == true
 			RevComEngine_Core.SetTimer("dialogtimer",
			self,
 			"WaitForDownloadInfo",
			10000,
			Time.now)
                               end
  
  			def self.WaitForDownloadInfo
            
    				imagedesign = RevComEngine_Core.GetDownloadList()[0]
    
    				RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 250, 110)  
    
    				button = RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton", 
                                  110, 50, 100, 50, imagedesign)
                                  
			button.SetMouseClickFuncCall(self, "DownloadImage", 0)

			button.SetMouseInFuncCall(self, "BtnInEvent")
           
			button.SetMouseOutFuncCall(self, "BtnOutEvent") 
  
 			end

		def self.DownloadImage(button)
			RevComEngine_Core.DownloadStart(button.GetText(), 'GRAPHICS_SYSTEM')
		end

		def self.BtnInEvent(btnSelect)
           
			btnSelect.SetWindowBackColor(3)
		end
                          
		def self.BtnOutEvent(btnSelect)
           
			btnSelect.SetWindowBackColor()
		end

	- Function Definition:

		/* Creates connection to server */       			
		Connect(strServerIPHostName, 	/* Server IP Address or URL Address */
			  nPort = 59234)		/* Server Port. Defaults to 59234. Do not change unless also changing in RevCommServer’s config settings */

		/* Gets list of designations of available files for download */       
		GetDownloadList

		/* Starts download of specified file by designation */       
		DownloadStart(strFileDesign, 		/* Designation of file registered with RevCommServer for download */
                             			  strFileType = nil,		/* File type value used to determine which RPG Maker folder to download to. Values include: 'AUDIO_BGM' for “Audio” folder’s ”BGM” folder, 'AUDIO_BGS' for “Audio” folder’s ”BGS” folder, 'AUDIO_ME for “Audio” folder’s ”ME” folder, 'AUDIO_SE' for “Audio” folder’s ”SE” folder, 'GRAPHICS_ANIMATIONS' for “Graphics” folder’s ”Animations” folder, ‘GRAPHICS_BATTLEBACKS1' for “Graphics” folder’s ”Battlebacks1” folder, 'GRAPHICS_BATTLEBACKS2' for “Graphics” folder’s ”Battlebacks2” folder, 'GRAPHICS_BATTLERS' for “Graphics” folder’s ”Battlers” folder, 'GRAPHICS_CHARACTERS' for “Graphics” folder’s ”Characters” folder, 'GRAPHICS_FACES' for “Graphics” folder’s ”Faces” folder, 'GRAPHICS_PARALLAXES' for “Graphics” folder’s ”Parallaxes” folder, 'GRAPHICS_PICTURES' for “Graphics” folder’s ”Pictures” folder, 'GRAPHICS_SYSTEM' for “Graphics” folder’s ”System” folder, 'GRAPHICS_TILESETS' for “Graphics” folder’s ”Tilesets” folder, 'GRAPHICS_TITLES1' for “Graphics” folder’s ”Titles1” folder, 'GRAPHICS_TITLES2' for “Graphics” folder’s ”Titles2” folder, 'DATA' for “Data” folder. Default value is nil for setting direct folder path with “strFilePath” value.} */ 
                             			  strFilePath = nil,		/* Direct path to download file to. This overrides the value of “strFileType” when set. Default is nil value to allow “strFileType” setting to be used instead. */
                             			  nDownloadTimeLimitSec = 60) /* Amount of time in seconds to wait for download to finish. If time elapses from start of download, the download is automatically canceled. Default value is 60 seconds. */

		/* Gets text from input */       
		BGMRPGM_Input.GetText(boolClearText = false) /* Indicator to clear text of input after value is retrieved. Default value is “false” to have the value remain in the textbox or button */

- Downloading all available files to a specific folder

DownloadAllFolder

The example downloads all image files are available from a server and drops it into a specified same subfolder in the app’s root directory. It is necessary to first call the “Initialize” function since the process require the app, the server, and the database to communicate which needs to be setup through the call. Next, the example connects to the server, and then uses a timer to wait 10 seconds to allow the client and server to connect and communicate the list of files by designation that are available for download. When the button is pressed, it calls a “CLICK” event function to call the “DownloadAll” function to download all available files to the created “Assets” folder in the app’s root.

	- Code:

		RevComEngine_Core.Initialize()

  			if RevComEngine_Core.Connect([SERVER IP ADDRESS]) == true
 		
			RevComEngine_Core.SetTimer("dialogtimer",
			self,
 			"WaitForDownloadInfo",
			10000,
			Time.now)
                               end
  
  			def self.WaitForDownloadInfo
    
			RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 250, 110)  
    
    				button = RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                  "dialogbutton", 
                                  110, 50, 100, 50, "DOWNLOAD ALL")
                                  
			button.SetMouseClickFuncCall(self, "DownloadImages", 0)

			button.SetMouseInFuncCall(self, "BtnInEvent")
           
			button.SetMouseOutFuncCall(self, "BtnOutEvent") 
  
 			end

		def self.DownloadImages(button)

    				RevComEngine_Core.DownloadAll("Assets")
		end

		def self.BtnInEvent(btnSelect)
           
			btnSelect.SetWindowBackColor(3)
		end
                          
		def self.BtnOutEvent(btnSelect)
           
			btnSelect.SetWindowBackColor()
		end

	- Function Definition:

		/* Downloads all available files from server */       			
		DownloadAll(strFilePath = "", 	/* Path under app’s root folder for downloading files */
				nDownloadTimeLimitSec = 60)
							/* Limit in seconds to download file */

- Data Maps:

This functionality has a version for both the client and the server sides. On the client, object’s variable or function results can be mapped to a database statement that has been registered with RevCommServer that gets called when the value changes. The value can be used as a replacement variable within the database statement. On the server side, a database query can be mapped to a client variable or function. The query is ran at an interval, and, when the value changes, it’s passed down to the client variable or passed in a call to the client function. The passed values can be a single value, an array or table row, and an array of arrays for multiple rows which can represent table rows. This functionality requires the installation of RevCommServer, RevCommClient, RevCommProcessor, and setting and connecting to a database which is documented in the References section. Database queries and statements are registered with RevCommServer in its config file, “RevCommConfig.xml”. The following examples require the following settings to be added to the RevCommServer’s config file, “RevCommConfig.xml”. In the file, the “operations” section by default is commented out. The comments must be removed, and the addition placed under the “operations” section’s “commands” section. Notice that the add sections “registerdatastatement” and “registerdataquery”. The “registerdatastatement” element has settings for “databasedesignation”, “datadesignation”, and “statement” which indicates to use the database designated as “main”, registers the data statement to be called with the designation “clienttest” which will be referenced on the client side, and gives the database statement to be ran, respectively. In the database statement, there is a replacement variable “@clientvalue”. This will also be referenced on the client side for the mapped value to be inserted into the statement. The “registerdataquery” element has a setting for “query” which gives the query to be called, respectively. There are secondary settings within it are for the server data map including "clientobjectdesignation", "clientvarfuncname", "isvariable", and "interval" which indicates the designation given to the client side function or variable name to be mapped to, the indicator that the receiving end of the map is a variable or function, and the interval in milliseconds to run the query in checks for an updated value, respectively. Lastly, run the table creation statement on the database.

		<registerdatastatement>
		  <databasedesignation>main</databasedesignation>
		  <datadesignation>clienttest</datadesignation>
		  <statement>INSERT INTO test (testvalue) VALUES (@clientvalue);</statement>
		</registerdatastatement>
		<registerdataquery>
		  <databasedesignation>main</databasedesignation>
		  <datadesignation>test</datadesignation>
		  <query>SELECT CURRENT_TIMESTAMP();</query>
		  <datamap>
			<clientobjectdesignation>testobj</clientobjectdesignation>
			<clientvarfuncname>testvalue</clientvarfuncname>
			<isvariable>true</isvariable>
			<interval>500</interval>
		 </datamap>
		</registerdataquery>

CREATE TABLE test (
	testvalue VARCHAR(25) NOT NULL
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

- Send database value to client variable

The example maps a server side query value to a client variable. The query was specifically made where it gets a different value every time it’s ran, so it will have a new value to pass to the client variable. The button press shows the value that is incrementing on its own.

	- Code:

		class TestClass
    
    				def SetDefault
      					@testvalue = ""
      				end
    
			def ShowTestText

    					RevComEngine_Core.InterfaceTextSet("dialogbox",  "dialogtext", "VALUE: " + @testvalue)				
			end
		end

		@testreceiver = TestClass.new
  			@testreceiver.SetDefault()

		RevComEngine_Core.Initialize()
 			RevCommProcessor.RegisterObject("testobj", @testvalue)

  			if RevComEngine_Core.Connect([SERVER IP ADDRESS]) == true 

			RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 250, 110)               

			RevComEngine_Core.InterfaceTextAdd("dialogbox", 
                                 	"dialogtext", 
                                	 "VALUE: ", 
                                	 10, 
                                	 5)

			button = RevComEngine_Core.InterfaceButtonAdd("dialogbox", "dialogbutton1", 115, 50, 65, 50, "RUN")
                                  
			button.SetMouseClickFuncCall(@testreceiver, "ShowTestText", 0)

			button.SetMouseInFuncCall(self, "BtnInEvent")
           
			button.SetMouseOutFuncCall(self, "BtnOutEvent")
		end

		def self.BtnInEvent(btnSelect)
           
			btnSelect.SetWindowBackColor(3)
		end
                          
		def self.BtnOutEvent(btnSelect)
           
			btnSelect.SetWindowBackColor()
		end

- Send client value to database statement

The example maps a client variable to the server side database statement to be used as replacement variable value. The Data Map directly uses a functions from RevCommProcessor to setup the process. The example uses “AddDataMapVar” function for setting up the variable mapping. The database table can checked for the results after the client variable is changed by updating the textbox.

	- Code:

		@testvalue = ""

		def testset(sendvalue)

			@testvalue = sendvalue
		end

		def testsend

			RevComEngine_Core.InputSend()
		end

		RevComEngine_Core.Initialize()

  			if RevComEngine_Core.Connect([SERVER IP ADDRESS]) == true

			RevCommProcessor.AddDataMapVar("testobj", self,  "testvalue",  “clienttest", "clientvalue") 

			RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 250, 110)               

			RevComEngine_Core.InterfaceInputAdd("dialogbox", “testinput”, 0, 0, 50, 35, true)

			RevComEngine_Core.InputSetSendFunc(self, “testset”)

			button = RevComEngine_Core.InterfaceButtonAdd("dialogbox", "dialogbutton1", 115, 50, 65, 50, "RUN")
                                  
			button.SetMouseClickFuncCall(self, "testsend", 0)

			button.SetMouseInFuncCall(self, "BtnInEvent")
           
			button.SetMouseOutFuncCall(self, "BtnOutEvent")
		end

		def self.BtnInEvent(btnSelect)
           
			btnSelect.SetWindowBackColor(3)
		end
                          
		def self.BtnOutEvent(btnSelect)
           
			btnSelect.SetWindowBackColor()
		end

	- Function Definition:

		/* Creates data map within an object’s variable and server’s data query */       		
		RevCommProcessor .AddDataMapVar(strDesign, 	/* Designation of new data map, used for future reference */
                           objSource,						/* Object of variable to map to */ 
                           strVarName, 						/* Name of variable within object to map to */
                           strDataProcessDesign, 					/* Designation of data query registered with RevCommServer to map to */
                           strDataParamName)  					/* Name of replacement value to be part of the data query ran through RevCommServer */

- Data Processes:

This functionality allows the app communicate through server directly with the database and get information and instructions back. This information can tell the app would code needs to be run, and pass the information as parameters to it. This functionality requires the installation of RevCommServer, RevCommClient, RevCommProcessor, and setting and connecting to a database which is documented in the References section. This operators by having registering database procedures with RevCommServer in its config file, “RevCommConfig.xml” where it will be given a designation. In the app, the designation can be used in a call to server to run the procedure, and pass it any sent parameters. RevCommServer will run the procedure with the sent parameters and also has the ability to pass values from it’s own user session information. This information is own client ID for the user session, user’s IP address, the client created transmission and response IDs, and group ID, if using RevCommServer groups which will be explained later. In the database procedure, it can respond back to the app by using RevCommServer’s database API to request the app to run any functions that belongs to objects that have been registered by external access, and pass it data as parameters. The following example require having userdata settings in the config file and registering the database procedure. The userdata settings are the replacement values that can be passed into the procedure, and already have default settings in the config file. The procedure is registered by adding the following settings to RevCommServer’s config file, “RevCommConfig.xml”. In the file, the “operations” section by default is commented out. The comments must be removed, and the addition placed under the “operations” section’s “commands” section. Notice that the add sections, named “registerdatastatement”, has settings for “databasedesignation”, “datadesignation”, and “statement” which indicates to use the database designated as “main”, registers the procedure to be called with the designation “test”, and gives the statement to be called with replacement parameters and one parameter named “text” that will be sent, respectively. The example database procedure “test_proc” is also included below.


		<userdata>
      <clientid>ID</clientid>
      <ipaddress>IP</ipaddress>      
      <transactionid>transID</transactionid>
      <responseid>respID</responseid>
      <groupid>groupID</groupid>
    </userdata>

		<registerdatastatement>
		  <databasedesignation>main</databasedesignation>
		  <datadesignation>test</datadesignation>
		  <statement>CALL test_proc(@transID, @respID, @ID, @text);</statement>
		</registerdatastatement>

DROP PROCEDURE IF EXISTS test_proc; DELIMITER // CREATE PROCEDURE test_proc(nTransID INT(10), nRespID INT(10), nClientID INT(12), strText VARCHAR(25)) BEGIN DECLARE strTestText VARCHAR(50) DEFAULT CONCAT('I\'m here: ', strText);

`CALL msg_send_proc(nTransID, `
				   `nRespID, `
				   `nClientID,`
				   `'TESTMESSAGE',`
				   `'TESTOBJ',`
				   `'ShowTestText',`
			  	   `strTestText,`
			  	   `TRUE);`

END // DELIMITER ;

- Calling a database procedure and having it communicate back:

The example uses a Data Process to a call database procedure registered with RevCommServer with the designation of “test”, and passed the current time as the parameter named “text”. The procedure adds the time to a message that sends back using RevCommServer’s database procedure, named “msg_send_proc”. This function sends a message back to call a object’s function registered with RevComEngine_Core as “TESTOBJ” that updates text on screen with the returned text. The Data Process directly uses functions from RevCommProcessor functions to setup and execution.

	- Code:

		class TestClass

			def ShowTestText(returnedtext)

    					RevComEngine_Core.InterfaceTextSet("dialogbox", 
                                  "dialogtext", 
                                  returnedtext)				
			end
		end

		@testreceiver = TestClass.new

		RevComEngine_Core.Initialize()

  			if RevComEngine_Core.Connect([SERVER IP ADDRESS]) == true

			RevCommProcessor.RegisterObject("TESTOBJ", @testreceiver)

			RevComEngine_Core.InterfaceAdd("dialogbox", 100, 100, 250, 110)               

			RevComEngine_Core.InterfaceTextAdd("dialogbox", 
                                 	"dialogtext", 
                                	 "STARTING TEXT", 
                                	 10, 
                                	 5)

			button = RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                 	 "dialogbutton1", 
                                	  115, 50, 65, 50, "RUN")
                                  
			button.SetMouseClickFuncCall(self, "RunProc", 0)

			button.SetMouseInFuncCall(self, "BtnInEvent")
           
			button.SetMouseOutFuncCall(self, "BtnOutEvent")
		end

		def self.RunProc (btnSelect)

                			RevCommProcessor.AutoRetProcessCmd(true)
                			RevCommProcessor.AutoRetEndTrans(true)
                			RevCommProcessor.StartDataProcess(1, 'test')
                			RevCommProcessor.AddDataProcessParams(1, 'text', Time.now.to_s)
                			RevCommProcessor.SendDataProcess(1, 1, true, true) 
		end

		def self.BtnInEvent(btnSelect)
           
			btnSelect.SetWindowBackColor(3)
		end
                          
		def self.BtnOutEvent(btnSelect)
           
			btnSelect.SetWindowBackColor()
		end

	- Function Definition:

		/* Registers an object for access to external updates from the server */  
	 	RegisterObject(strDesign, 		/* Designation to register object for external access */
			  objRegistrant, 	/* Object to register for external access */
			  boolIsShared = false, /* Indicator that object is shared across user apps. Functionality currently not implemented */
			boolHostOnly = false) /* Indicator that if object is shared, then it only process information from host user’s version of object. Functionality currently not implemented */

		/* Sets or gets if the returned message from the Data Process is to be run as introductions. Default value is nil value to only return current value */
  		 RevCommProcessor.AutoRetProcessCmd(boolSetAutoRetProcessCmd = nil)

		/* Sets or gets if to delete Data Process after initial return of results. Default value is nil value to only return current value */
                	 	RevCommProcessor.AutoRetEndTrans(boolSetAutoRetEndTrans = nil)

		/* Starts data process, returns indicator that it was started */
                	 	RevCommProcessor.StartDataProcess(nNewTransID, /* Transmission ID for the created Data Process */
						    strDataDesign) /* Designation of database procedure associated with RevCommServer to be called. */

		/* Adds parameter name and value to data process, returns indicator that parameter was added */
                	 	RevCommProcessor.AddDataProcessParams(nTransID, /* Transmission ID for the Data Process */
							   strParamName, /* Name of database procedure’s parameter that the value is being sent for */
							   mxParamValue) /* Value of database procedure’s parameter being sent for */

		/* Runs an instance of the data process, returns indicator that instance was sent to server for processing */
                    	RevCommProcessor.SendDataProcess(nTransID,  /* Transmission ID for the Data Process */
						    nNewRespID,  /* Response ID for this send of Data Process instance being called */
						    boolAsync = true, /* Indicator to run the Data Process as an asynchronous  process, else it run in a pool of other synchronous Data Processes. Defaults to “true” */
						    boolAutoRetrieval = true)
								        /* Indicator to delete the Data Process after its initial return of results. Defaults to “true” */

User Login:

RevComEngine_Core has the ability to connect user data to RevCommServer sessions allowing for keeping and information in user sessions. This functionality requires the installation of RevCommServer, RevCommClient, RevCommProcessor, and setting and connecting to a database which is documented in the References section.

- Creating user creation and login:

User creation example User login example

Creates the default version of user creation and login dialog box after map #1 is loaded.

	- Code:

		RevComEngine_Core.SetMapStartFunc(1, 
                               self, 
                               "Setup")
                               
		def Setup


		RevComEngine_Core.Initialize()

  			if RevComEngine_Core.Connect([SERVER IP ADDRESS]) == true
			RevComEngine_Core.UserInfoSetup()
                               end
  end

	- Function Definition:

		/* Creates default dialog box for creating users */
		UserInfoSetup(nXPos = Graphics.width / 2 - 200, 
							/* X-Axis position of the dialog box’s left top corner from the top left corner of the app. Default value attempts to calculate positioning the dialog into the center of the app window */
                            			nYPos = Graphics.height / 2 - 200, 	/* Y-Axis position of the dialog box’s left top corner from the top left corner of the app. Default value attempts to calculate positioning the dialog into the center of the app window */
                             			boolAddPhoneNum = false,		/* Indicator to add input box for new user’s phone number. Defaults to “false” value to have it not appear on default dialog box */
                             			boolAddEmail = false,			/* Indicator to add input box for new user’s e-mail address. Defaults to “false” value to have it not appear on default dialog box */
                             			boolRequirePhoneNum = false,	/* Indicator that new user’s phone number is required field. Defaults to “false” value to have it have the information required. */
                             			boolRequireEmail = false)		/* Indicator that new user’s phone number is required field. Defaults to “false” value to have it have the information required. */

- User Session Groups:

RevComEngine_Core has the ability to put users into groups after creating users and logging in. This allows information like messages to be passed between users in the group. This functionality requires the installation of RevCommServer, RevCommClient, RevCommProcessor, and setting and connecting to a database which is documented in the References section.

SessionGroupStart SessionGroupInvite SessionGroupInviteAccept

Creates setup for creating user group and inviting an user to group. This example will include images another using inviting the example user to a group.

	- Code:

		RevComEngine_Core.SetMapStartFunc(1, 
                               self, 
                               "Setup")
                               
		def Setup

			RevComEngine_Core.Initialize()

  				if RevComEngine_Core.Connect([SERVER IP ADDRESS]) == true

				RevComEngine_Core.LoginCreateSetup(0, 0)
  
  
				RevComEngine_Core.InterfaceAdd("dialogbox", 450, 0, 66, 51)    

				button = RevComEngine_Core.InterfaceButtonAdd("dialogbox", 
                                 			 "dialogbutton1", 
                                	  		0, 0, 65, 50, "RUN")
                                  
				button.SetMouseClickFuncCall(self, "SetupSession", 0)

				button.SetMouseInFuncCall(self, "BtnInEvent")
           	
				button.SetMouseOutFuncCall(self, "BtnOutEvent")
                               		end
                             	end

    			def SetupSession
      
        			RevComEngine_Core.SessionGroupSetup()
      			end


     			 def self.BtnInEvent(btnSelect)
           
           			btnSelect.SetWindowBackColor(3)
      			end
                          
      			def self.BtnOutEvent(btnSelect)
           
           			btnSelect.SetWindowBackColor()
      			end

	- Function Definition:

		/* Creates default dialog box for user login */
       			LoginCreateSetup(nXPos = Graphics.width / 2 - 200, /* X-Axis position of the dialog box’s left top corner from the top left corner of the app. Default value attempts to calculate positioning the dialog into the center of the app window */
                                		      nYPos = Graphics.height / 2 - 100)/* Y-Axis position of the dialog box’s left top corner from the top left corner of the app. Default value attempts to calculate positioning the dialog into the center of the app window */
        		SessionGroupSetup(nXPos = Graphics.width / 2 - 200, /* X-Axis position of the dialog box’s left top corner from the top left corner of the app. Default value attempts to calculate positioning the dialog into the center of the app window */
                                 		        nYPos = Graphics.height / 2 - 100, /* Y-Axis position of the dialog box’s left top corner from the top left corner of the app. Default value attempts to calculate positioning the dialog into the center of the app window */
                                 		        boolAddTimeInput = false)	    /* Indicator to create textbox for entering time limit for session group invite. Default value is “false” indicating to not add textbox to dialog */

References:

- Setting up RevCommServer:

RevCommServer setup RevCommServer start up

The setup requires a server with the correct firewall permissions on the default port, currently 59234, or the port updated through settings. In the settings file, RevCommConfig.xml, change the following settings values for “<hostname></hostname>” to the server IP address, either external or most likely the internal address. This file should be in the same directory as the RevCommServer app. If setup is correct, start up should appear as in the following example:

- RevCommServer database connection:

RevCommServer database connection

RevCommServer currently only supports MySQL database up to 8.1, and connects through settings in the RevCommConfig.xml file that should be in the same directory as the RevCommServer app. First, uncomment the command section inside of the default version of the file if having not already done so. In the “database” section with the attribute “designation” set to “main”, and set the following settings. The “<server></server>” value must be set to the database’s servers IP address, “<name></name>” to the database’s name, “<username></username>” to the username for accessing the database, and “<password></password>” for the password. The server where RevCommServer is located must have access to the database server and appropriate ports through any firewalls, and the user has full permissions on the database. Second, on the database, run the install script for RevComEngine_Core 2.0, rce_release_20_setup.sql. If setup is correct, start up should appear as in the example image.

- RevCommProcessor and RevCommClient setup:

RevCommProcessor setup

RevCommClient setup

Install RevCommProcessor by adding script to RPG Maker VX Ace's Script Editor. The installation of RevCommClient requires putting the following files in the root folder of the app: 32bit - RevCommClient32.dll, libssl-3.dll, and libcrypto-3.dll / 64bit - RevCommClient64.dll, libssl-3-x64.dll, and libcrypto-3-x64.dll