ScriptUO

Scripting Resources & Utilities => Stealth Client => Stealth archive => Topic started by: Crome969 on January 03, 2013, 03:33:04 AM

Title: [Tutorial] Using Regions in your Scriptcode
Post by: Crome969 on January 03, 2013, 03:33:04 AM
Today i want to show you a small way to add some better view to your code.
I often camed to the situation were i wroted some hundred lines of code and lost the trace wich file contains what and were in my script code is what function.
Some of you may used C# and know it when try to sort code into Regions to use the folder view\close to hide or see code.
This works in Pascal Script as well.

(http://i.imagebanana.com/img/80lzggkn/unfoldedcode.png)
This Picture shows a sample of one of my Units , were dozen of Code is displayed (Nearly 1000 Lines of Code in 1 File )

You may coming in same Situation and think -> "Okay were is my Procedure XY"

(http://i.imagebanana.com/img/1bw1r3bz/foldedcode.png)

The second Picture shows when i used Regions and folded Code...


So how it works?

First we need to declare where a Region Start by adding  
Code: [Select]
{$Region Tutorial}.
The Name Tutorial can be replaced with any kind of Text you like to describe the region.

Then we need to declare where a Region Ends by adding
Code: [Select]
{$Endregion}
You can pack Regions into Regions, Stealth Editor will display the region folding when right applied..

Sample :

(http://i.imagebanana.com/img/futwdckc/subfolding.png)


Hope this will help you designing Pascal Scripts :)
Title: Re: [Tutorial] Using Regions in your Scriptcode
Post by: dxrom on January 03, 2013, 06:19:52 AM
Like C#

#region xxx

#endregion
Title: Re: [Tutorial] Using Regions in your Scriptcode
Post by: KaliOfLS on January 03, 2013, 06:24:27 AM
Now how do we do that in oEUO/lua?
Title: Re: [Tutorial] Using Regions in your Scriptcode
Post by: Crome969 on January 03, 2013, 07:16:05 AM
Now how do we do that in oEUO/lua?
Please check the Thread Section.
This Subforum is Talk about the StealthClient ( Support Pascal and Python )
Title: Re: [Tutorial] Using Regions in your Scriptcode
Post by: Boydon on January 04, 2013, 01:17:35 AM
Like C#

#region xxx

#endregion

The chief architect of C# is the creator of Delphi. ;)

Anyway I think that regions sometime may clutter your code. Another tool that i like to use to fast browse my code is the function tree in the hint window of stealth.

(http://img204.imageshack.us/img204/9677/screenshotstudiocapturemj.png) (http://img204.imageshack.us/i/screenshotstudiocapturemj.png/)
View Screen Capture (http://img204.imageshack.us/i/screenshotstudiocapturemj.png/)
Title: Re: [Tutorial] Using Regions in your Scriptcode
Post by: camotbik on January 04, 2013, 01:27:28 AM
Or just use notepad++ )
Title: Re: [Tutorial] Using Regions in your Scriptcode
Post by: Boydon on January 04, 2013, 01:52:10 AM
If you work in Python you want to use Notepad++ for sure, but if you work in Pascal Script then Stealth has some very nice built in features that notepad++ does not have (autocomplete, argument hints, integrated debbuging, etc...).
Title: Re: [Tutorial] Using Regions in your Scriptcode
Post by: KaliOfLS on January 04, 2013, 06:49:13 AM
Now how do we do that in oEUO/lua?
Please check the Thread Section.
This Subforum is Talk about the StealthClient ( Support Pascal and Python )

I know, I was making a joke :(

This is a nice feature and I wish I could do it in oEUO.  Hehe.
Title: Re: [Tutorial] Using Regions in your Scriptcode
Post by: Crome969 on January 04, 2013, 07:09:51 AM
Now how do we do that in oEUO/lua?
Please check the Thread Section.
This Subforum is Talk about the StealthClient ( Support Pascal and Python )

I know, I was making a joke :(

This is a nice feature and I wish I could do it in oEUO.  Hehe.
I know how you feel, long ago i searched for the chance to write crazy scripts in euo, but saw its limits.. Then a new hope camed up, oeuo but disapointed due the fact it never really were finished.
I personally think if cheffe and his team would invest more time into project or he would finally release the sources or allow more people to work on it, a lot of beautiful possiblities could appear. Until that oeuo and euo is always known in public, but mere a joke behind the scene...