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

TinTin + TCL (and GUI windows!)

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



Joined: 13 Aug 2008
Posts: 4
Location: United States

PostPosted: Wed Aug 13, 2008 12:49 pm    Post subject: TinTin + TCL (and GUI windows!) Reply with quote

Hi folks,

I wanted to present to the community some work I have been doing for the last few days. My project is to embed TCL into TinTin ... Tcl is a full-featured scripting language that also happens to provide a cross platform GUI toolkit known as Tk.

Tcl's homepage: http://www.tcl.tk/

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

Technically TinTin's entire scripting API could be re-implemented directly into Tcl, but my concern is just providing a few core functions to communicate from TinTin to Tcl's interpreter and vice versa (which means modifying TinTin's source code as little as possible).

From TinTin there is a new #tcl command. Its syntax is
#tcl {variablename} {... source code to execute...}
variablename refers to a TinTin variable and is optional. The return output from the Tcl code is stored to this variable, if none is given then the output from the script is displayed to the console.

Example 1:
#tcl {result} {clock format [clock seconds]}
#OK. VARIABLE {result} HAS BEEN SET TO {Wed Aug 13 11:18:35 CDT 2008}.

Stores the output into a TinTin variable called result, which then can be accessed in the normal ways:

#echo {The current time is: $result}
The current time is: Wed Aug 13 11:20:11 CDT 2008

Example 2:
#tcl {source myscript.tcl}
This would load a script myscript.tcl into Tcl's interpreter.

Example 3:
#tcl {result} { set socket [socket hostname.com 6000] ; set data [read $socket] ; close $socket ; return $data }
This is a pretty far-out example, but essentially it would open a network connection to hostname.com:6000, read all available text, then close the socket. The output would be stored in a TinTin variable "result"

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

From the Tcl interpreter there is a new tintin command. It's syntax is
tintin do arg
tintin set varName ?newValue?
tintin function name arg1 ?arg2 ...?
tintin subst string
tintin session ?sessioname?

tintin do arg
This executes arg through TinTin's main command parser.
Examples:
tintin do {#help}
tintin do {#session main mymud.org 5000}

tintin set varName ?newValue?
Set or retrieve a TinTin variable.
Examples:
tintin set currenttime [clock format [clock seconds]]

set tclvar [tintin set tintinvar]
This will set a Tcl variable to the value of a TinTin variable.

tintin function name arg1 ?arg2 ...?
Example:
Since just about anything that could be defined within a TinTin function could be done just as easy or easier with plain Tcl, this feature isn't incredibly useful, but I included it to be complete.
Say you have a TinTin function like this...
#function {prod} {#math {result} {%1 * %2}}
From Tcl you could call it by doing...
set result [tintin function prod 5 10]
And it will return 50

tintin subst string
This command will evaluate any TinTin functions, variables, or commands in the string and return the result.
Example:
Say you have the TinTin function defined above, from Tcl you could do
set result [tintin subst {The product of 5 and 10 is @prod{5 10}}]
The syntax is the same as within TinTin... variables are expanded by $ characters, functions by @, commands by #, etc.
Note: Don't confuse this with Tcl's built in command called subst which operates similarly.

tintin session ?sessioname?
Calling session without a session name will return the current session. Providing a session name will change the current session.
This gets a little tricky so bear with me...
When Tcl code is executed from TinTin, it will automatically default to whatever session it was that called it. So using this command isn't generally necessary.
However, Tcl can fire background events such as timers, file events, window GUI related things such as clicking a button, and so on... For these cases, there is no way for it to determine what TinTin session it should direct itself to. By default it will use whatever active session you have. Normally if all you use is one session, you won't have a problem. This command is useful when you have multiple sessions running and need to direct commands among them.
Example:
Code:

proc drinktimer {} {
     tintin session main
     tintin do {drink flask}
     after 600000 drinktimer
}
after 600000 drinktimer

What this will do is after 10 minutes (Tcl timers are in milliseconds), it will run the "drinktimer" procedure that we created. The session command is necessary to tell Tcl to run the following code in the "main" session. There are some more clever ways to work with timers in Tcl, but we'll save that for other days.

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


Here is a precompiled Windows binary
http://www.kungfo0.org/tintin/WinTin-1.98.4+tcl.zip
You will need to install the ActiveState TCL libraries first, which are available from http://www.activestate.com/store/activetcl/
ActiveTCL's site is a little messy to navigate, but click the Download link on that page, the name information isn't required on the next page, then choose the Windows package of 8.5.3
8.5.3 is the version of Tcl my Windows binary is compiled against.
One additional thing you must do is to set an environment variable that points to the correct path.
The default install path for Tcl is C:\Tcl (this is fine), so create an environment variable called TCL_LIBRARY and set it equal to C:/Tcl/lib/tcl8.5
Note: If you installed Tcl anywhere than the default location, this path will need to be modified. Also, notice I used forward slashes instead of the standard backslashes on Windows - this is on purpose and is necessary in this case.
To set environment variables, right click on My Computer, go to Properties, then go to the Advanced tab and click the Environment Variables button. It doesn't matter if you make it a User variable or System variable.

Here is a precompiled MacOS X binary
http://www.kungfo0.org/tintin/tintin-1.98.4+tcl-osx.tar.gz
It was compiled on OS 10.5.4 which has Tcl 8.4.7
If it doesn't work on your version of MacOS you may need to download the source and compile it manually.

For Linux here is a diff patch that can be run against the stock TinTin 1.98.4 source
http://www.kungfo0.org/tintin/tintin.patch.gz
Download the patch into the tt folder and run
gunzip tintin.patch.gz
patch -p2 < tintin.patch
And then proceed with the normal compiling steps.


There are are a plethora of Tcl packages and modules available on the Internet. Some examples are HTTP clients, FTP clients, SQL database clients, etc. The thing that most people here will be excited about are the GUI features.

Here is a screen shot of a quicky example script I wrote using some Tk GUI widgets:

The script doesn't actually do much of anything, it's just an example of some possibilities.
I've included the script (named script.tcl) with the other archives.
To load it do:
#tcl {source script.tcl}

I'm sure there will be a flood of questions on how to use all of this, particularly about Tcl scripting.
The Tcl/Tk manual are available at: http://www.tcl.tk/man/tcl8.5/
There are probably some much better guides findable via Google.
I'll try to help where I can.


Thanks!
-KuNgFo0


Last edited by kungfo0 on Fri Aug 15, 2008 11:20 am; edited 3 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
magiko



Joined: 11 May 2006
Posts: 33

PostPosted: Wed Aug 13, 2008 1:11 pm    Post subject: Reply with quote

fo0 is my officemate at work, and it's been a lot of fun watching the progress of this recently. I'm pretty excited by this.

How much to let tintin's scripting handle, and how much to let TCL handle, will be a combination of user preference and how much MUD details the script is working with.

Here's how to update the ticker in his previous GUI example, making sure it's sync'd with the mud (if you don't ever want to, or can't for whatever reason sync it with mud output, you really don't need quite so much code).

Code:
#variable {tickerAlertTime} {10}
#variable {tickerTotal}{60}
#alias {resetTicker}{#variable {tickerTotal}{60};#tcl dummy resetticker}

note that he has resetticker defined in his script.

"dummy" is there so that it returns to a dummy variable, and it doesn't end up in my console

Code:

#alias {tickerChecks} {
   #if {$tickerTotal == $tickerAlertTime} {
      #showme Tick in $tickerAlertTime;
   } {};
}

my tickerChecks could have been moved over to tcl too, but I'd like to retain control here. This particular example will say "Tick in 10" at 10s til tick.

and now your MUD's on-tick text strings to reset the ticker:
Code:

#action {^Your studies complete, you close your %0 with a smile.}{resetTicker}
#action {^The lightning has stopped.}{resetTicker}
#action {^The rain has stopped.}{resetTicker}
#... etc


In a few hours I'll make a full example that will do nothing but make a window that handles shouts/tells.
Back to top
View user's profile Send private message
magiko



Joined: 11 May 2006
Posts: 33

PostPosted: Wed Aug 13, 2008 6:26 pm    Post subject: Reply with quote

#tcl {source shoutwindow.tcl}

And here's shoutwindow.tcl:

Code:

#/usr/bin/tclsh
 
package require Tk
 
proc insertshout {shout} {
   if {[winfo exists .shouts]} {
      .shouts.shoutframe.list insert end $shout
      .shouts.shoutframe.list yview moveto 1
      .shouts.shoutframe.list xview moveto 0
   }
}
 
proc clearshout {} {
   .shouts.shoutframe.list delete 0 end
}
 
proc shoutwindow {} {
   if {[winfo exists .shouts]} {
      puts "The shout window is already open."
      return
   }
   toplevel .shouts
   wm title .shouts "TinTin++ - Shout Window"
   wm focusmodel .shouts passive
 
   labelframe .shouts.shoutframe -padx 5 -pady 5 -text shouts/tells
   scrollbar .shouts.shoutframe.yscroll -orient vertical   -command ".shouts.shoutframe.list yview"
   scrollbar .shouts.shoutframe.xscroll -orient horizontal -command ".shouts.shoutframe.list xview"
   listbox .shouts.shoutframe.list -setgrid 1  -borderwidth 0 -yscroll ".shouts.shoutframe.yscroll set" -xscroll ".shouts.shoutframe.xscroll set" -relief flat -borderwidth 5 -background gray
 
   pack .shouts.shoutframe -expand yes -fill both
   grid rowconfig .shouts.shoutframe 0 -weight 1 -minsize 0
   grid columnconfig .shouts.shoutframe 0 -weight 1 -minsize 0
 
   grid .shouts.shoutframe.list    -row 0 -column 0 -sticky news -in .shouts.shoutframe
   grid .shouts.shoutframe.yscroll -row 0 -column 1 -sticky news -in .shouts.shoutframe
   grid .shouts.shoutframe.xscroll -row 1 -column 0 -sticky news -in .shouts.shoutframe
 
   pack .shouts.shoutframe -padx 5 -pady 5 -fill both
 
   button .shouts.clear -text "Clear" -command { clearshout }
   pack .shouts.clear -padx 5 -pady 5 -anchor s
}
 
wm withdraw .
shoutwindow
tintin do {#alias {shoutwindow} {#tcl dummy shoutwindow}}
return "Shout Script Loaded"

Then you'll need your standard capturing code such as:

Code:

#action {^%0 shouts '%1'} {#tcl {dummy} {insertshout {%0 shouts '%1'}}}
#action {^You shout '%0'} {#tcl {dummy} {insertshout {You shout '%0'}}}





the line "tintin do {#alias {shoutwindow} {#tcl dummy shoutwindow}}" creates an alias you can use in tintin to open/reopen the shoutwindow (type shoutwindow).


Last edited by magiko on Thu Aug 14, 2008 1:39 am; edited 3 times in total
Back to top
View user's profile Send private message
mattikus



Joined: 06 Aug 2008
Posts: 15

PostPosted: Wed Aug 13, 2008 9:16 pm    Post subject: Reply with quote

Awesome work guys. I'll have to play around with it. Looks very promising and I'm totally interested in the development from here on out, so keep us notified.

I was just curious, however, why you went with tcl/tk as opposed to lua or some other embeddable scripting language. Something you're familiar with or ease of pluggability?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Wed Aug 13, 2008 10:04 pm    Post subject: Reply with quote

Cool stuff, I tried the windows link (http://www.kungfo0.org/tintin/WinTin-1.98.4+tcl.zip) but it's not working.

http://www.kungfo0.org/tintin/WinTin+tcl.zip gives me a no permission error.

I'll try to look into tcl when I have time.


I'm curious if this could be implemented through tintin's run command as well.

Within tintin it's possible to execute: #run {session name} {telnet address port} which will run telnet inside tintin++. Would the tcl telnet client (you'd probably want one as basic as possible) at http://wiki.tcl.tk/7524 work with the run command and provide the same functionality?
Back to top
View user's profile Send private message Send e-mail
kungfo0



Joined: 13 Aug 2008
Posts: 4
Location: United States

PostPosted: Wed Aug 13, 2008 11:25 pm    Post subject: Reply with quote

mattikus wrote:
Awesome work guys. I'll have to play around with it. Looks very promising and I'm totally interested in the development from here on out, so keep us notified.

I was just curious, however, why you went with tcl/tk as opposed to lua or some other embeddable scripting language. Something you're familiar with or ease of pluggability?


The answer is both... I've been coding in Tcl over 10 years now and embedding Tcl is extremely easy. Tcl is also pretty powerful, and it provides easy access to a cross platform Gui (although I'm very new to using the Gui controls).


Scandum wrote:
Cool stuff, I tried the windows link (http://www.kungfo0.org/tintin/WinTin-1.98.4+tcl.zip) but it's not working.

http://www.kungfo0.org/tintin/WinTin+tcl.zip gives me a no permission error.

I'll try to look into tcl when I have time.


Sorry about that, permissions error on my server. It should work now.

Scandum wrote:
I'm curious if this could be implemented through tintin's run command as well.

Within tintin it's possible to execute: #run {session name} {telnet address port} which will run telnet inside tintin++. Would the tcl telnet client (you'd probably want one as basic as possible) at http://wiki.tcl.tk/7524 work with the run command and provide the same functionality?


Telnet was just an example, I'm more interested in providing other people with means to accomplish things than anything in particular for myself.
Of course the #run command provides the ability to spawn an external interactive process.. and with some creative action binds you could probably achieve some two way communication (although to me it feels inelegant among other things). And I believe my solution is necessary for real time communication to a Gui window.
Let me put on my technical hat and provide an example:
Code:

#run tcl tclsh
% proc timer {} {
puts "This is a test"
after 1000 timer
}
% timer
This is a test
after#0

This should create a background timer within tcl that runs every 1000 milliseconds. However, there is a problem - in my example the function only runs once, the timer never fires. This is because Tcl is unable to enter its main event loop. You could force it into this by doing something like "vwait forever" however doing it this way would cause TinTin to block/become inaccessible. Now instead of a simple timer, imagine a Gui window that needs to fire an event whenever you click a button.

Now if you ask how is it different than what I am doing... I am using Tcl's C api code Tcl_DoOneEvent() to make it fire any pending events during each iteration of TinTin's main loop (there's no way to simulate this directly through Tcl's own scripting language.. it's generally never necessary or even feasible).

Trying to do this sort of stuff in other languages is probably going to make you run into similar problems.

Hope that helps a little.
-Fo0
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
magiko



Joined: 11 May 2006
Posts: 33

PostPosted: Thu Aug 14, 2008 10:21 am    Post subject: Another Example Reply with quote

For this example, I wanted to do something with graphics. An eventual project will be a very nice console - but for now, how about a sweet ticker window:



The numbers could have been made with your system font (but not the point of the example - these are gifs). The background color is easily changeable in the tcl if you wish (if so, look for two insances of LightGoldenrod1). The graphics have a transparency, so whatever (light) color you choose will look ok - and you can of course make your own graphics without touching the code.

Because you need the images, I packed it - it is here: http://www.lauzet.com/tt_stuff/tickerwindow.zip (last modified august 14, 2008)

Call it with:

#tcl {source tickerwindow.tcl}

The script can work at the same time the shoutwindow example above, and provides a "tickerwindow" alias to reopen it if you close it.

If you need to change the maximum value of the ticker it sets up an alias:
tickmax 10

And to force the ticker to reset to its max, it makes alias:
resetticker

(dummy just a variable name that doesn't matter - it is used to keep a blank line (the return from the script) from ending up in your window - it goes into the dummy variable instead. Scripts can return text to the window, and it's sometimes useful to do so.


Last edited by magiko on Thu Aug 14, 2008 12:32 pm; edited 2 times in total
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Thu Aug 14, 2008 10:50 am    Post subject: Reply with quote

What one would need to do is write a very simple telnet client in tcl or another language (like a stripped down tintin) which in turn calls on tcl. This could make things much more accessible because it'd work more like a plugin. (edit: upon closer investigation this isn't feasible)

Alternatively you can run tclsh in one session, and communicate with it in another session. I think this might work very well for interface stuff, but two way communication between sessions is messy in tintin (suggestions welcome). One way communication goes well though since you can execute:
Code:

#action {^%0 shouts '%1'} {#tclses insertshout {%0 shouts '%1'}}

I'm curious if this would works with your shoutbox magiko?

I definitely need to upgrade the script command to automatically store the output into a variable so you can use:
Code:

#script {time} {tcl -c 'puts [clock format [clock seconds]]'}


Last edited by Scandum on Thu Aug 14, 2008 9:53 pm; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Thu Aug 14, 2008 3:11 pm    Post subject: Reply with quote

Quote:
For these cases, there is no way for it to know what TinTin session it should direct itself to. By default it will use the global session (gts).

You'd probably want to use gtd->ses here instead of gts since gtd->ses points to the currently active session.
Back to top
View user's profile Send private message Send e-mail
kungfo0



Joined: 13 Aug 2008
Posts: 4
Location: United States

PostPosted: Fri Aug 15, 2008 11:21 am    Post subject: Reply with quote

Scandum wrote:
Quote:
For these cases, there is no way for it to know what TinTin session it should direct itself to. By default it will use the global session (gts).

You'd probably want to use gtd->ses here instead of gts since gtd->ses points to the currently active session.


Ahh good catch. I have updated my files with this change.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Fri Aug 15, 2008 3:28 pm    Post subject: Reply with quote

I've been playing around with #run and script shells. I haven't gotten tcl to work on cygwin - but the following more or less works for lua:

Code:

#run luases lua

session = "gts"

function test ()
        for x=1,10 do
                tintin(string.format("#showme <138>testing: %2d", x))
        end
end

function tintin (command)
        print(string.format("tintin (%s) %s", session, command))
end

#action {tintin (%0) %1}
{
        #%0 %1
}

#gts


Tintin aliases and commands are parsed before they reach the Lua shell - so it's impossible to directly access those from within the script shell.

Actions however can trigger on Lua echoes, so with actions you can talk back to tintin.

The above script sets 'gts' as the session to report back to (though the return session can easily be set as a function argument). The test function can be accessed from the startup session by using: #luases test()

The same concept ought to work for all other scripting languages.
Back to top
View user's profile Send private message Send e-mail
kungfo0



Joined: 13 Aug 2008
Posts: 4
Location: United States

PostPosted: Fri Aug 15, 2008 5:36 pm    Post subject: script Reply with quote



Here's a screenshot of a script I'm working on... you add your friends by IP address and it passes information back and forth. The information is collected through various tintin action binds.

I'll post some code for it in a few days.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
magiko



Joined: 11 May 2006
Posts: 33

PostPosted: Fri Oct 16, 2009 5:07 pm    Post subject: Reply with quote

fo0 updated this today

http://www.kungfo0.org/tintin/

There, you can find patched tt++ 1.99.7 binaries for Windows, Mac OS (intel and ppc), and a source patch.

The modification adds support for TCL/TK and adds necessary commands for cross-talk between the two - the added tintin command being #tcl -- this thread has examples on how to create triggers to update the GUI.
Back to top
View user's profile Send private message
Zonbidesu



Joined: 14 Jan 2009
Posts: 28

PostPosted: Thu Oct 29, 2009 11:24 pm    Post subject: Reply with quote

I just barely downloaded and got all the parts working, and I can say: It all works out of the box over here on my Snow Leopard install.

Great work! I can't wait to play around with it! (...runs off to learn tcl)
Back to top
View user's profile Send private message Send e-mail
Zonbidesu



Joined: 14 Jan 2009
Posts: 28

PostPosted: Thu Oct 29, 2009 11:29 pm    Post subject: Reply with quote

Quick question...

Can you give me an example of how to do something along the lines of displaying the current time on my '#split' bar in tintin++?

I know it would involve having TCL setup some kind of timer so that every minute it checks the time and updates the tintin variable...
Back to top
View user's profile Send private message Send e-mail
magiko



Joined: 11 May 2006
Posts: 33

PostPosted: Tue Nov 03, 2009 1:23 am    Post subject: Reply with quote

Are you asking for your system's clock to be displayed in the prompt? I think (for the sake of the script community and max compatibility) that a better solution wouldn't involve TCL for this particular solution. I'll play with it tomorrow if this is really what you're wanting.

The split line can be updated each second if you wish -- in fact, that's where I put my game's ticker countdown timer so I know when the tick is coming -- is this maybe what you're really wanting to use a clock for?
Back to top
View user's profile Send private message
Artthou



Joined: 28 Feb 2005
Posts: 30

PostPosted: Thu Nov 12, 2009 5:20 pm    Post subject: Reply with quote

Curious what you folks think would perform better between these two options:

Goal: Separate window displaying current health of all characters in the group.

Option 1: Use this nifty TCL extension to add the window, feeding it data from tintin actions.

Option 2: Setting up a RAM disk on my linux box, using #system commands in tintin to write the latest data to a file on the RAM disk, and then having an independent Perl program (Perhaps a GUI written in perlTK, or just in a terminal) read and display the contents of that file as it changes.

The ramdisk for option 2 avoids having to do an expensive disk write, and having the display program be separate allows it to be fully multithreaded (would option 1 accomplish this the way it is implemented?)

There is probably a faster way to set up a shared memory segment that tintin could make use of, but ramdisk was the easies thing I could think of off the top of my head.

The TCL looks cool, but I don't know the language, and would have to update my tintin scripts to be compatible with the latest version (not quite ready), so option 2 helps in that regard as well.

Thanks for any feedback!
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Thu Nov 12, 2009 5:37 pm    Post subject: Reply with quote

Isn't it easier to use something like #split 1 1 , and use #showme {text} {-1} to write info to the top part?
Back to top
View user's profile Send private message Send e-mail
Artthou



Joined: 28 Feb 2005
Posts: 30

PostPosted: Mon Nov 16, 2009 12:06 pm    Post subject: Reply with quote

Quote:
Isn't it easier to use something like #split 1 1 , and use #showme {text} {-1} to write info to the top part?



I need to read up on the #show and #split options to understand what kind of placement on the screen is possible (I'd like it in the upper right corner without overwriting the text on the left, but could go with it being in its own split window at the very top (large groups would mean that I lose a decent about of lines in that case))
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Mon Nov 16, 2009 11:27 pm    Post subject: Reply with quote

Easiest is using #line log <filename> <text> and using tail -f <filename> in a different terminal. This works well for keeping tells and channels in a different window, though I personally prefer using #grep instead whenever I want to check tells and channels.

It's also possible to to use #run tail -f <filename> using a different tintin session in a different terminal, which would allow using #split and/or setting up some triggers to further manipulate the data.

For your main window the easiest would be to do something like:
Code:

#split 3 1

#loop 1 8 cnt {#var party[health][$cnt] 100;#var party[member][$cnt] Unknown

#echo {{%+3m %-12s %+3m %-12s %+3m %-12s %+3m %-12s} {-1}} {$party[health][1]} {$party[member][1]} {$party[health][2]} {$party[member][2]} {$party[health][3]} {$party[member][3]} {$party[health][4]} {$party[member][4]}

#echo {{%+3m %-12s %+3m %-12s %+3m %-12s %+3m %-12s} {-2}} {$party[health][5]} {$party[member][5]} {$party[health][6]} {$party[member][6]} {$party[health][7]} {$party[member][7]} {$party[health][8]} {$party[member][8]}


Paste that and that should give you a basic idea of how to get started.
Back to top
View user's profile Send private message Send e-mail
Artthou



Joined: 28 Feb 2005
Posts: 30

PostPosted: Mon Nov 23, 2009 2:30 pm    Post subject: Reply with quote

Just thought I would check back in with my results.

I used the #line log command to write the statuses to a file on linux on a filesystem that uses tmpfs which is effectively a ramdisk that grows as needed (sometimes /tmp is by default, usually you can use /dev/shm).

I wrote a perl script to do the displaying of data since tail -f wasn't handling the file well since it is being deleted and recreated constantly.

I also noted that when using #system from the background session to delete the file, the cursor in the current session would jump up above the split line to where my prompt is from the incoming MUD text. It would even jump then left to right as I would type each time the ticker went off triggering another #system command in the other session. This should be easy to reproduce...it started behaving when I commented out the #system command from the ticker's action

To get around this, I have the Perl script doing the file removal once it has read the contents, so tintin just #line logs to the file recreating it if necessary.

The only question now is where do I want to put it on my screen to be most effective for my eyes Smile

Thanks for the feedback and suggestions.
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Tue Nov 24, 2009 12:20 am    Post subject: Reply with quote

Probably best to use #script instead of #system to avoid displaying issues.

Something like: #script {tmp} {rm <filename>}

This because tintin has little control over what #system does, so it needs to ready the terminal for displaying in case someone does #system ls.

Also an option is to do something like: #run bash bash;#ses -

And then use: #bash rm <filename> as an alternative to #system.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Development 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