AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   TOGs SourcePawn Syntax Converter [MS Excel Based for now] (https://forums.alliedmods.net/showthread.php?t=290805)

Peace-Maker 05-04-2018 13:14

Re: TOGs SourcePawn Syntax Converter [MS Excel Based for now]
 
Quote:

Originally Posted by Silvers (Post 2589592)
Well after seeing that Python script I'm embarrassed to post mine, but then again I tried the python converter on some of my sourcepawn scripts and it broke them deleting parts etc. So mine actually works nearer 99% even though it's not optimized and you could say terrible. I put 73k .sp lines through it with few problems.

I haven't had any issues with that script yet. What exact code was deleted?

Silvers 05-04-2018 17:20

Re: TOGs SourcePawn Syntax Converter [MS Excel Based for now]
 
Quote:

Originally Posted by Peace-Maker (Post 2590713)
I haven't had any issues with that script yet. What exact code was deleted?

I think this or something similar with menus:
PHP Code:

AddToTopMenu(g_hAdminMenu"sm_forcemode_menu"TopMenuObject_ItemHandle_Categoryplayer_commands"sm_forcemode_menu"ADMFLAG_GENERIC); 

It deleted TopMenuObject_Item or some equiv.

Peace-Maker 05-05-2018 15:40

Re: TOGs SourcePawn Syntax Converter [MS Excel Based for now]
 
Quote:

Originally Posted by Silvers (Post 2590731)
I think this or something similar with menus:
PHP Code:

AddToTopMenu(g_hAdminMenu"sm_forcemode_menu"TopMenuObject_ItemHandle_Categoryplayer_commands"sm_forcemode_menu"ADMFLAG_GENERIC); 

It deleted TopMenuObject_Item or some equiv.

That's correct though, since there are seperate AddCategory and AddItem functions on the methodmap.

Dragokas 05-22-2018 07:53

Re: TOGs SourcePawn Syntax Converter [MS Excel Based for now]
 
1 Attachment(s)
Maybe, it will make life easier for somebody.

===========================================
Batch sm plugins converter to new syntax.
===========================================

Benefits: all-in-one. Simple right click => got new .sp/.smx

Copyrights:

MethodMaps converter by Peace-Maker.
New-syntax converter by ThatOneGuy (port to VB6 by SilverShot and Dragokas).
Batch Script by Dragokas.

------------------------------------------

Installation:

- Install Python: https://www.python.org/downloads/
- Download and unpack SourcePawn compiler for Windows (v.1.8+): https://www.sourcemod.net/downloads.php?branch=dev
- Unpack this archive.
- Edit sp_file_handler.reg to point to your compiler path.
- Apply sp_file_handler.reg by double-click.
- Edit Convert_Syntax.cmd to point "include" in correct folder path of your compiler.
- Make shortcut to file "Convert_Syntax.cmd"
- Press Win + R, enter "Shell:Sendto" and place shortcut in opened window.

Usage:

- Press right mouse click on your old-syntax .sp file => choose "Convert_Syntax".
- Wait for coverting to new syntax (stage 1).
- spcomp.exe will try to compile. If errors appear, you should manually fix them (file "plugin.sp").
- Press any key (enter).
- Wait for coverting to new methodmaps (stage 2).
- spcomp.exe will try to compile. If errors appear, you should manually fix them (file "plugin_mm.sp"):
> Usually it's wrong var. types like:
>> Handle cvar = INVALID_HANDLE; => should be: ConVar cvar;
>> Handle hMenu => should be: Menu hMenu
>> Handle hEvent => should be: Event hEvent e.t.c.

At the end, you will receive:
- plugin.sp.bak (your original file). It will not be overwritten in any situation.
- plugin.sp (after stage 1 - new syntax only)
- plugin_mm.sp (after stage 2 - new syntax + new methodmaps)
- .smx files for each stage.

rogeraabbccdd 08-07-2018 21:45

Re: TOGs SourcePawn Syntax Converter [MS Excel Based for now]
 
Quote:

Originally Posted by Dragokas (Post 2593268)
Maybe, it will make life easier for somebody...

Hello, can you add Typedefs convert in your script?
Old funcenum is deprecated in SM 1.10

Dragokas 08-08-2018 11:12

Re: TOGs SourcePawn Syntax Converter [MS Excel Based for now]
 
Hi, rogeraabbccdd!

My script consist of:
Quote:

Originally Posted by Dragokas
Copyrights:

MethodMaps converter by Peace-Maker.
New-syntax converter by ThatOneGuy (port to VB6 by SilverShot and Dragokas).

You have to ask them.

--
P.S. You have a misprint in your signature.

disawar1 09-12-2018 13:11

Re: TOGs SourcePawn Syntax Converter [MS Excel Based for now]
 
Hi there. Here the bug report.

Before
PHP Code:

Float:vOrg[3] = {0.00.00.0}
static 
count 

After
PHP Code:

// Invalid syntax
float vOrg[3] = {0.0int 0.0int 0.0}
static 
count 

Valid syntax
PHP Code:

float vOrg[3] = {0.00.00.0}
static 
int count 


eyal282 01-25-2020 17:58

Re: TOGs SourcePawn Syntax Converter [MS Excel Based for now]
 
Quote:

Originally Posted by Dragokas (Post 2593268)
Maybe, it will make life easier for somebody.

===========================================
Batch sm plugins converter to new syntax.
===========================================

Benefits: all-in-one. Simple right click => got new .sp/.smx

Copyrights:

MethodMaps converter by Peace-Maker.
New-syntax converter by ThatOneGuy (port to VB6 by SilverShot and Dragokas).
Batch Script by Dragokas.

------------------------------------------

Installation:

- Install Python: https://www.python.org/downloads/
- Download and unpack SourcePawn compiler for Windows (v.1.8+): https://www.sourcemod.net/downloads.php?branch=dev
- Unpack this archive.
- Edit sp_file_handler.reg to point to your compiler path.
- Apply sp_file_handler.reg by double-click.
- Edit Convert_Syntax.cmd to point "include" in correct folder path of your compiler.
- Make shortcut to file "Convert_Syntax.cmd"
- Press Win + R, enter "Shell:Sendto" and place shortcut in opened window.

Usage:

- Press right mouse click on your old-syntax .sp file => choose "Convert_Syntax".
- Wait for coverting to new syntax (stage 1).
- spcomp.exe will try to compile. If errors appear, you should manually fix them (file "plugin.sp").
- Press any key (enter).
- Wait for coverting to new methodmaps (stage 2).
- spcomp.exe will try to compile. If errors appear, you should manually fix them (file "plugin_mm.sp"):
> Usually it's wrong var. types like:
>> Handle cvar = INVALID_HANDLE; => should be: ConVar cvar;
>> Handle hMenu => should be: Menu hMenu
>> Handle hEvent => should be: Event hEvent e.t.c.

At the end, you will receive:
- plugin.sp.bak (your original file). It will not be overwritten in any situation.
- plugin.sp (after stage 1 - new syntax only)
- plugin_mm.sp (after stage 2 - new syntax + new methodmaps)
- .smx files for each stage.

native SQLiteVIPAPI_AddFeature(char FeatureName[64], Handle VIPLevelList, Handle NameList, &bool AlreadyExisted=false);

This is generated by your converter, should be bool &. Also should be native int SQLiteVIPAPI_Add...

Dragokas 01-25-2020 18:44

Re: TOGs SourcePawn Syntax Converter [MS Excel Based for now]
 
Quote:

Originally Posted by eyal282 (Post 2681624)
native SQLiteVIPAPI_AddFeature(char FeatureName[64], Handle VIPLevelList, Handle NameList, &bool AlreadyExisted=false);

This is generated by your converter, should be bool &. Also should be native int SQLiteVIPAPI_Add...

You quoted my post, but parser is not mine.
We just made external interface.
Maybe at some point I'll take a look on engine. Not now.
Thanks for report.

ThatOneGuy 01-25-2020 23:40

Re: TOGs SourcePawn Syntax Converter [MS Excel Based for now]
 
Quote:

Originally Posted by eyal282 (Post 2681624)
native SQLiteVIPAPI_AddFeature(char FeatureName[64], Handle VIPLevelList, Handle NameList, &bool AlreadyExisted=false);

This is generated by your converter, should be bool &. Also should be native int SQLiteVIPAPI_Add...

Quote:

Originally Posted by ThatOneGuy (Post 2472251)
Also, it isnt perfect (and probably never will be) ... the point is that the tool gets you most of the way there, taking a lot of the work out of it (if not all).

As noted, the point is that it does most of the work for you, leaving only a few edits to fix rather processing hundreds or thousands of lines, line by line. Hope it helps. At this point I am leaving it as is. I believe others are providing additional support/ports.


All times are GMT -4. The time now is 22:04.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.