TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Script Organization

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
ixle



Joined: 15 Sep 2011
Posts: 158
Location: United States

PostPosted: Fri Dec 16, 2011 4:30 am    Post subject: Script Organization Reply with quote

Is there a strategy you use to keep interdependent scripts organized?

--backstory--
I have settings for my mud split up into multiple files partially for the necessity of reading and/or killing them and partially to help me easily locate the information desired. However, this method causes certain problems such as creating complex aliases in one file that I would like to re-use in another without duplicating the alias. I do have a main.tin file that reads all the necessary scripts in at startup, but as things progress I'm finding myself having to keep multiple files open to reference the complex aliases.

Variables also are starting to become an issue. A few times I've accidentally used the same variable name in two different scripts and I've also had to move all variables into their own file so I can change them inside the mud, and easily write them to their own file independent of any scripts. This way each script can reference those vars but hopefully not overwrite or remove them.
--/backstory--

What would seem optimal would be a very nice editor configuration for tintin scripts that allowed for folding code. This way I could combine a large number of my scripts into one larger file, and only leave the classes I need to read and kill separated. Does anyone know of something similar or a better alternative? I've seen the link to the emacs highlighting but I don't currently use emacs and afaik it doesn't do the folding.

Anyway, any help is appreciated. Thanks in advance.
Back to top
View user's profile Send private message
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Tue Jan 31, 2012 1:18 pm    Post subject: Reply with quote

I have one stratagy that works for me using the free NotePad++ editor http://notepad-plus-plus.org/ which can handle multple files simultanously, there will of course be others that are also suitable:

Both before starting TinTin (on a cygwin under windoze enviroment) and during gameplay, I keep all my scripts in one big file opened in this editor, which with it's search capabilites means I can find all the places where a variable appears. If (or rather when) I find a bug in my stuff I can correct the script but I then actually copy the corrected sections to a second tempory file. In that also goes (if I have altered any #ACTION/#GAG/#ALIAS... invokations) the corresponding #UNACTIONS/#UNGAG/#UNALIAS... for the OLD ones if they have changed to remove them before they are replaced. It is then possible to insert complex new stuff into a running TinTin++ instance, by #READing in the tempory file. Finally I update the main file in the editor by #WRITEing from the running instance. The suggested editor then moans that the file stored on disk has changed and offers to reload the file which I normally accept.

It is a good idea to attach an identifiable prefix to variables that are local to an #ALIAS/#ACTION etc and then on exit from that you can use an #UNVAR prefix_%* to remove them if not required outside. If you don't remove them, by using such a prefix, you can then quickly jump to the end of the file in the editor and as the variables are sorted in alphabetical order they will be grouped together. Also it makes it easier to debug scripts because you can use a #VAR prefix_%* to see just them in a running [T,W]inTin instance.

Final item about this particular editor, although it runs in a widows enviroment, you will want to change Preferences->New Document->Format to Unix (sets end of line character to be LF only)...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group