Page 1 of 1 1
Topic Options
#46074 - 2003-09-26 01:08 AM simple programming
keys Offline
Fresh Scripter

Registered: 2003-07-22
Posts: 13
My brain is broken.
code:
 
$errorpile[3] ;declaration of array with 4 slots
$test = "This is a test." ;test string
$errorpile[2] = $test ; assign slot 2 to $test
? $errorpile[2] ;print slot 2

I was hoping this would print "This is a test."
Compile error on line:
$errorpile[2] = $test

Please help. Thanks

Top
#46075 - 2003-09-26 01:11 AM Re: simple programming
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
KiX is an interpeter lasnguage, not a compiled one. Are you sure you have the right board?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#46076 - 2003-09-26 01:11 AM Re: simple programming
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Try slapping a DIM in your declaration there:

dim $errorpile[3]

-Shawn

Top
#46077 - 2003-09-26 01:12 AM Re: simple programming
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
code:
Dim $errorpile[3] ;declaration of array with 4 slots
$test = "This is a test." ;test string
$errorpile[2] = $test ; assign slot 2 to $test
? $errorpile[2] ;print slot 2

Dang! Way too slow tonight [Frown]

[ 26. September 2003, 01:12: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#46078 - 2003-09-26 01:12 AM Re: simple programming
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
you declare variable either by assigning a value to it or by explicitly making it something with global or dim.
you do none of these.

simple change your "declaration" line to:
dim $errorpile[3]

and it should work just fine
_________________________
!

download KiXnet

Top
#46079 - 2003-09-26 04:09 PM Re: simple programming
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11163
Loc: Boston, MA, USA
And the use of variables/arrays is documented in the KiXtart Manual.
_________________________
There are two types of vessels, submarines and targets.

Top
#46080 - 2003-09-26 11:00 PM Re: simple programming
keys Offline
Fresh Scripter

Registered: 2003-07-22
Posts: 13
Thanks for all the help. I am actually declaring $errorpile in a script that calls other scripts that will dump their errors into this array.
So, from your advice I declared the variable a GLOBAL and all is well.
Interpreted langauge? Does this mean the scripts are run directly by kix32.exe and the errors come out as the script is being interpreted.
Thanks again

Top
#46081 - 2003-09-26 11:02 PM Re: simple programming
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11163
Loc: Boston, MA, USA
Yes, that is how an Interpreter works, OTOH a compiler compiles a script/program into binary code that can be executed directly.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 304 anonymous users online.
Newest Members
Praveer, Ollero, rayyo, Foxlicht, DonChild
17742 Registered Users

Generated in 0.034 seconds in which 0.013 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org