////////////////////////////////////////////////////////
// DEMONSTRATING MORE METAS
// (simple ascii, simple numeric, indirect, arrays)
////////////////////////////////////////////////////////

// PART1 /// SIMPLE ASCII METAS ////////////////////////////

// create an ascii meta
seta hello "Hello World!"

// Just print hello
writeln "hello"

// Print value of meta 'hello'
// (this is't an environment meta!)
writeln "%hello%"
writeln "Hi you! %hello%"

// convert to uppercase
upper hello


// PART2 /// SIMPLE NUMERIC METAS ///////////////////////////

// create a numeric meta
setn num1 27

// do a little calculation
sub num1 2
div num1 5
add num1 3
mod num1 6

// show result
writeln "OS/%num1%"

// PART3 /// INDIRECT METAS //////////////////////////////////////

// set up a normal meta
seta first "HELLO"

// set up a meta that contains the value of another meta
// second will contain the string '%first%'
// third will contain the string 'HELLO'
seta second "%%first%%"
seta third  "%first%"

// change the value of first
seta first "HI"

// third still contains HELLO, since it was assigned directly
// second still contains %first% and evaluates to the current 
// value of first
writeln "first=%first%"
writeln "second=%second%"
writeln "third=%third%"


// PART4 /// ARRAYS METAS /////////////////////////////////////////
// set up a little "array"
seta line1 "Thank"
seta line2 "you"
seta line3 "for"
seta line4 "testing"
seta line5 "Zap-O-Com"

// do a loop from 1 .. 5
setn n 1
:loop
	// this will evauluate to %line1% (% line %n% %)
	seta ind "%%line%n%%%"
	write "%ind% "
	inc n
	compn "%n%" with 5
	ifnhigh goto loop

writeln

// done it
endscript

