G2D: Difference between revisions
Jump to navigation
Jump to search
(Created page with "<span style="color:#0066FF;text-shadow:black 0.1em 0.1em 0.6em; text-align:center">>>GUI To DGS (G2D)<<</span>") |
|||
(34 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<span style="color:# | |||
==<span style="color:#000000;text-shadow:0.05em 0.05em 0.2em #00000099;">Description</span>== | |||
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) | |||
==<span style="color:#000000;text-shadow:0.05em 0.05em 0.2em #00000099;">Usage</span>== | |||
===<span style="color:#FF7F00;">Server-Sided</span> G2D script converter (G2DSC)=== | |||
Command: g2d [Option] [Arguments] | |||
These command can only be used in MTA Server console. | |||
{| class="wikitable" style="width: 800px; text-align: center; table-layout: fixed;" | |||
|- | |||
!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 | |||
|- | |||
| type | |||
| | |||
|Change the type of G2D, can be hooker or convertor (by default) | |||
|- | |||
|} | |||
'''Example For Convertor'''<br> | |||
Basic: | |||
<syntaxhighlight> | |||
g2d add resA | |||
g2d start | |||
</syntaxhighlight> | |||
Advanced Pattern Mode: | |||
<syntaxhighlight> | |||
g2d add .A match | |||
g2d start | |||
</syntaxhighlight> | |||
'''Output''' files are stored in '''dgs/G2DOutput/''' | |||
<br> | |||
<br> | |||
'''Example For Hooker'''<br> | |||
This is used to add [[dgsG2DLoadHooker]] into script in batch. | |||
OInly first clientsided script with '''guiCreate''' functions will be modified. | |||
<syntaxhighlight> | |||
g2d type hooker | |||
g2d add . match | |||
g2d start | |||
</syntaxhighlight> | |||
'''Backup''' files are stored in '''dgs/G2DBackup/''' | |||
<br> | |||
<br> | |||
===<span style="color:#FF0000;">Client-Sided</span> G2D Hooker (G2D Hooker)=== | |||
See detail [[dgsG2DLoadHooker]] | |||
'''Example''' | |||
<syntaxhighlight lang="lua"> | |||
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 ) | |||
</syntaxhighlight> |
Latest revision as of 11:12, 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]
These command can only be used in MTA Server console.
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 | |
type | Change the type of G2D, can be hooker or convertor (by default) |
Example For Convertor
Basic:
g2d add resA g2d start
Advanced Pattern Mode:
g2d add .A match g2d start
Output files are stored in dgs/G2DOutput/
Example For Hooker
This is used to add dgsG2DLoadHooker into script in batch.
OInly first clientsided script with guiCreate functions will be modified.
g2d type hooker g2d add . match g2d start
Backup files are stored in dgs/G2DBackup/
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 )