View unanswered posts | View active topics It is currently Fri Feb 22, 2019 8:26 am



Reply to topic  [ 5 posts ] 
 Decompiled Sysop Scripts 
Author Message
Ensign
User avatar

Joined: Tue Dec 17, 2002 3:00 am
Posts: 280
Location: Virginia
Unread post Decompiled Sysop Scripts
Since we're past Christmas now, Happy Valentine's Day!

I haven't actually tested these yet, but pretty sure they'll work just fine. If there are any problems, let me know.

This pack includes So_MakeAnsi for both v1 and v2.

Edit: Added the random planet maker script as well.


Attachments:
SO_Random_Planet_Maker.ts [75.23 KiB]
Downloaded 11 times
Sysop.zip [506.83 KiB]
Downloaded 16 times

_________________
Image ICE 2017 Tournament Winning Team Member
Image ICE 2019 Tournament Winning Team Member
Wed Feb 06, 2019 11:58 pm
Profile ICQ
Commander

Joined: Sun Feb 25, 2001 3:00 am
Posts: 1771
Location: Guam USA
Unread post Re: Decompiled Sysop Scripts
Shadow wrote:
Since we're past Christmas now, Happy Valentine's Day!

I haven't actually tested these yet, but pretty sure they'll work just fine. If there are any problems, let me know.

This pack includes So_MakeAnsi for both v1 and v2.

Edit: Added the random planet maker script as well.


Thank you for honoring me with your first tests of your decompiler on my scripts
I have downloaded them and will let you know if it did a good enough job.
I look forward to the possibility of its release.

You have saved me the time to test it against something I have source for
to see how it does .. now I can let everyone know how close you came to nailing it.

I hope its real close , this is something that has been wanted by many players whom dislike compiled scripts.
Plus it will save a lot of time for authors , now YOU can fix their scripts .. hahaha

Good job , now let me go look into the ones you posted..

Vid

_________________
TWGS V2 Vids World on Guam Port 2002
Telnet://202.151.82.243:2002
Coconut Telegraph (ICQ)# 14340614
Founding Member -=[Team Kraaken]=- Winners of Gridwars 2010 - Ka Pla
Image

Image
Image

The Oldist , Longist Running , Orginal Registered Owner of a TWGS server :
Vids World On Guam


Thu Feb 07, 2019 8:30 am
Profile ICQ WWW
Commander

Joined: Sun Feb 25, 2001 3:00 am
Posts: 1771
Location: Guam USA
Unread post Re: Decompiled Sysop Scripts
Ok , looked through the 0_login script .. for those whom have my .cts
Same version that you can have as .ts here ...

Please try the .ts one out and let me know if it works the same.
I have found (in the first few hundred lines)
a couple waiton commands made into settexttriggers
and a bunch of killtriggers with " around them (may cause errors)
as well as if statements changed IF ($var = "1") to IF ($Var = 1)
which WILL be problematic at the end results.

I will continue on reading/comparing original to this decompile.
I cant wait to get to the includes to see that also.

I did notice that any comments were removed and most word placements were
removed.. making reading a bit harder for me , but aesthetically ok in script running.

So far good job .. hope the .ts runs right.
I'll be back to post more in a bit .. for those following.

Vid

_________________
TWGS V2 Vids World on Guam Port 2002
Telnet://202.151.82.243:2002
Coconut Telegraph (ICQ)# 14340614
Founding Member -=[Team Kraaken]=- Winners of Gridwars 2010 - Ka Pla
Image

Image
Image

The Oldist , Longist Running , Orginal Registered Owner of a TWGS server :
Vids World On Guam


Thu Feb 07, 2019 8:54 am
Profile ICQ WWW
Commander

Joined: Sun Feb 25, 2001 3:00 am
Posts: 1771
Location: Guam USA
Unread post Re: Decompiled Sysop Scripts
Aside from the before mention things I found , the includes contain many of the same problems but may still work .. someone please test .. I dont want to
chance it since I would have to rename mine and further confuse myself in
debugging.

Looks good for the most part , and thank you for sharing my scripts .. this one script that I spent many years in perfecting for all types of servers and mods
will help many people learn many advanced ways to overcome obstacles
a server can throw at you.

I'm sure there are many parts that can be added to mombot to get its login script up to par.
But the 0_login has the ability to launch your BOT script if you fill out the
Globals.cfg correctly.

Anyways , I'm done ranting and fact finding on this .. as a whole .. Good job Shadow
Your decompiler seems to work , at least to get inside the script to rip parts
and bypass security for the most part.

I look forward to your release so we all can use it.
And not just on my scripts .. lol j/k

Vid

_________________
TWGS V2 Vids World on Guam Port 2002
Telnet://202.151.82.243:2002
Coconut Telegraph (ICQ)# 14340614
Founding Member -=[Team Kraaken]=- Winners of Gridwars 2010 - Ka Pla
Image

Image
Image

The Oldist , Longist Running , Orginal Registered Owner of a TWGS server :
Vids World On Guam


Thu Feb 07, 2019 9:24 am
Profile ICQ WWW
Ensign
User avatar

Joined: Tue Dec 17, 2002 3:00 am
Posts: 280
Location: Virginia
Unread post Re: Decompiled Sysop Scripts
Vid Kid wrote:
Ok , looked through the 0_login script .. for those whom have my .cts
Same version that you can have as .ts here ...

Please try the .ts one out and let me know if it works the same.
I have found (in the first few hundred lines)
a couple waiton commands made into settexttriggers
and a bunch of killtriggers with " around them (may cause errors)
as well as if statements changed IF ($var = "1") to IF ($Var = 1)
which WILL be problematic at the end results.

I will continue on reading/comparing original to this decompile.
I cant wait to get to the includes to see that also.

I did notice that any comments were removed and most word placements were
removed.. making reading a bit harder for me , but aesthetically ok in script running.

So far good job .. hope the .ts runs right.
I'll be back to post more in a bit .. for those following.

Vid


Hi Vid,

A couple of points here.

None of this is documented, so everything I did was based on reading the released twx source code and reverse engineering it. There were many bugs in my earlier iterations of this based on unexpected behavior by the compiler. I have fixed most of them.

When you compile a .CTS to .TS, it is actually compiling it into bytecode - meaning that it breaks down the statements (setvar, send, etc) and turns them into individual bytes that refer to what each statement does. It then has a structure where the bytes following reference each of the parameters (variables, constants, etc) used by the command, and it separately adds all the text strings, encrypted, to the end of the file, along with the labels (unencrypted).

The compiler throws away all comments, so the .CTS doesn't contain any of the comments in the original code. Those are impossible to reproduce.

When you actually load a .TS into TWX, it compiles it exactly as it would if you ran TWXC on it, and then executes the compiled code. So the only difference in performance between loading a .CTS or a .TS is that the startup time to load the script is slightly slower with a .TS (because it has to compile it to run it).

Anyway, back to what's changed/missing. The compiler converts all if/then/else and while statements to "BRANCH" statements. These are in the twx documentation describing what they do as a compiler internal statement (but can actually be used in scripts directly). So, an if statement like:

if ($1 = foo)
setvar $1 bar
end

Turns into:

BRANCH :22 $1 = foo
setvar $1 bar
:22

If/then/else are more complicated:

if ($1 = foo)
setvar $1 bar
else if ($1 = bar)
setvar $1 foo
else if ($1 = bob)
setvar $1 foo
end

Becomes:

BRANCH :23 $1 = foo
setvar $1 bar
goto :22
:23
BRANCH :24 $1 = bar
setvar $1 foo
goto :22
:24
BRANCH :22 $1 = bob
setvar $1 foo
:22

While statements are similarly changed into BRANCH and GOTO. This is reflected in the output of my decompiler. I may go back and clean it up, but it's difficult work, and the code generated runs just fine.

re waiton - the compiler converts this directly:

waiton "foo"

to:

settexttrigger WAITON1 :28 "foo"
:WAITON1

Meaning, if you put a "waiton" in your code, it is automatically converted to a trigger by the compiler. So it's no difference from using a trigger.

Waitfor is different - it is a separate function and ignores all other triggers. Waiton can be interrupted by other triggers because it's a trigger itself.

I suspect waitfor is faster, based on how the compiler handles it.

More on this later - I plan to document all of this for anyone who wants to work on this in the future.

I am happy to discuss with you sometime if you'd like.

I would love for you to look at the other scripts and provide any feedback you have so I can make the decompiler better. It's over 2000 lines of c# code already. I do plan to release it once I am sure I have dealt with all the edge cases.

_________________
Image ICE 2017 Tournament Winning Team Member
Image ICE 2019 Tournament Winning Team Member


Thu Feb 07, 2019 10:17 am
Profile ICQ
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.