G2D: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 17: Line 17:
!Comment
!Comment
|-
|-
| -add
| add
|Resource Name
|Resource Name
|Retain selections and select other resources (-m :Pattern Match)
|Retain selections and select other resources (-m :Pattern Match)
|-
|-
| -c
| clear
|
|
|Clear selections
|Clear selections
|-
|-
| -h
| help
|
|
|G2D Help
|G2D Help
|-
|-
| -rm
| remove
|Resource Name
|Resource Name
|Remove specific selected resources from list  (-m :Pattern Match)
|Remove specific selected resources from list  (-m :Pattern Match)
|-
|-
| -l
| list
|
|
|List all selected resources
|List all selected resources
|-
|-
| -e
| start
|
|
|Start to convert (execute)
|Start to convert (execute)
|-
|-
| -q
| stop
|
|
|Stop converting process
|Stop converting process
Line 51: Line 51:
Basic:
Basic:
<syntaxhighlight>
<syntaxhighlight>
g2d -add resA
g2d add resA
g2d -e
g2d start
</syntaxhighlight>
</syntaxhighlight>


Advanced Pattern Mode:
Advanced Pattern Mode:
<syntaxhighlight>
<syntaxhighlight>
g2d -add .A -m
g2d add .A match
g2d -e
g2d start
</syntaxhighlight>
</syntaxhighlight>



Revision as of 11:06, 8 May 2022

Description

1. G2D aims to convert GUI to DGS without a lot of complex steps. 2. There are 2 versions of G2D:

  • 1) Server-sided G2D script converter (G2DSC)
    • G2DSC is used to convert GUI functions/events to DGS ones by editing scripts. (Useful for converting scripts created by GUI Editor, but it will cause a lot of errors/bugs if you make it convert complicated scripts, because of compatibility)
  • 2) Client-sided G2D hooker (G2D Hooker)
    • G2D Hooker is used to convert complex scripts by injecting hooker before executing the script instead of editing files. (The hooker is valid in one resource)

Usage

Server-Sided G2D script converter (G2DSC)

Command: g2d [-Option] [Arguments]

Options Arguments Comment
add Resource Name Retain selections and select other resources (-m :Pattern Match)
clear Clear selections
help G2D Help
remove Resource Name Remove specific selected resources from list (-m :Pattern Match)
list List all selected resources
start Start to convert (execute)
stop Stop converting process

Example
These command is used in MTA Server console.

Basic:

g2d add resA
g2d start

Advanced Pattern Mode:

g2d add .A match
g2d start

Output files are stored in dgs/G2DOutput/

Client-Sided G2D Hooker (G2D Hooker)

See detail dgsG2DLoadHooker

Example

loadstring(exports.dgs:dgsImportFunction())() --Import functions before
loadstring(exports.dgs:dgsG2DLoadHooker())()  --Load G2D Hooker
local buttonElement = guiCreateButton(200,200,300,300,"Test",false)  --Though you are using gui functions and events, but they have already hooked by DGS
addEventHandler ( "onClientGUIClick", buttonElement, function()
	outputChatBox("clicked")
end, false )