Sardis
(Fresh Scripter)
2004-04-29 07:34 PM
Display a variable

How can you display the contents of a variable in a script?

Bryce
(KiX Supporter)
2004-04-29 07:49 PM
Re: Display a variable

kind of a open question....

$variable

would all that you would need...

perhaps if you told us more on what you are trying to do?


Sardis
(Fresh Scripter)
2004-04-29 08:11 PM
Re: Display a variable

Ok, I actually need to learn how to use labels so I can use the goto feature. How do I assign a section of code a lable so I can reference it in code?

ShaneEP
(MM club member)
2004-04-29 08:32 PM
Re: Display a variable

Straight from the manual...

Quote:

Action: Defines a label within the script file to which you can transfer control.

Syntax: :label

Remarks: Labels must be unique within a script or user defined function and cannot contain whitespace characters. Note also that you can define labels inside script segments (for example inside a WHILE – LOOP segment), but you cannot jump to such a label from outside the segment.





ShaneEP
(MM club member)
2004-04-29 08:35 PM
Re: Display a variable

Here's a fun little example for you

Code:
:testlabel
$x = $x+1
? $x
GoTo "testlabel"



Bryce
(KiX Supporter)
2004-04-29 10:30 PM
Re: Display a variable

Quote:

Ok, I actually need to learn how to use labels so I can use the goto feature. How do I assign a section of code a lable so I can reference it in code?




ahhh, i would say take a look at the FUNCTION stuff.

Code:

$say = myword("hello")
? $say

$say = Myword("Functions are fun")
? $say

$say = myword("test 1 2 3")
? $say


quit


function myword($word)
$myword = "I want to say:" + $word
endfunction



You will always be able to access the same bit of code by using the same function over and over again.

Bryce