View unanswered posts | View active topics It is currently Sat Dec 27, 2025 5:33 pm



Reply to topic  [ 1 post ] 
 TWX Scrolling Window Example 
Author Message
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post TWX Scrolling Window Example
The code below is an example of how to scroll data in a TWX window line by line. It does not include how to set up a window for scrolling back and forward - that requires a bit more work. The concept is similar in using arrays to contain the scroll back and a setTextOut trigger to activate the back or forward scrolling.

# Purpose:  Example of a line by line scroll in a TWX window
# Use: Start script and do a density scan, dScan output to window
# Promethius - March 2009

setVar $windowWidth 625
setVar $windowHeight 335

:createWindow
Window destWindow $windowWidth $windowHeight " Scroll Window " & GAMENAME ONTOP
setVar $lineCnt 0
setVar $destwindow ""

:dataTriggers
setTextLineTrigger sector :sector "Anom :"
setTextTrigger cmd :cmdPrompt "Command [TL="
pause

:sector
# increment line counter
add $lineCnt 1
# get line data into an array
setVar $sectInfo[$lineCnt] currentLine & "*"
# update window
gosub :destWindow
# reset our sector trigger
setTextLineTrigger sector :sector "Anom :"
pause

:cmdPrompt
# sector trigger is still active, just need to restart cmd trigger.
# For this script, we could just leave sector trigger active and not
# even use the cmd trigger, but I felt like doing it this way.
setTextTrigger cmd :cmdPrompt "Command [TL="
pause

:destWindow
setVar $rollLine1 1
setVar $rollLine2 2
# check to see if our window is full
if ($lineCnt = 20)
# set the window content var to empty
setVar $destwindow ""
While ($rollLine1 < 20)
# swap var 1 with var 2 ($sectinfo[1] will contain $sectInfo[2]
# and continue through sectinfo[19] containing sectinfo[20]
setVar $sectInfo[$rollLine1] $sectInfo[$rollLine2]
# refill out window content var with data
setVar $destwindow $destwindow & $sectInfo[$rollLine1]
add $rollLine1 1
add $rollLine2 1
end
# reset our $lineCnt to our window line max minus 1
setVar $lineCnt 19
else
# we haven't got 20 lines of data yet
setVar $destwindow $destwindow & $sectInfo[$lineCnt]
end
# display the contents in the window
setWindowContents destWindow $destWindow
return

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Sun Mar 22, 2009 1:40 am
Profile ICQ
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 33 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by wSTSoftware.