string ParaString (Object o) {
int n
string s, t
s = number o
if (matches("-",s)) {
s[match 0]
n = start 0
t = s[(n-2):n]
n = n - 1
if (t == ".0-")
n = n - 2
t = s[0:n]
} else
t = s
return t
}
In particular, this sequence is confusing:
s = number o
if (matches("-",s)) {
s[match 0]
n = start 0
t = s[(n-2):n]
n = n - 1
if (t == ".0-")
n = n - 2
t = s[0:n]
Why are they assigning a dash to the beginning to the module? Why are
they then stepping back two spaces to the beginning of the string?
Etc. I'm not understanding the "why" of what they are doing. And, of
course, there are no comments.
Second: What is wrong with this sequence?
Object o
Module m = current
Column c
int ccount=0
Column shallCol
//scans each column to see if we've made one for the shallID
for c in current Module do {
ccount++
if ((title c)=="Shall ID") {
(shallIDexists = true)
}
}
ccount++
//if shallID column hasn't been made, make it, set to 50 pixels, and
label it.
if !shallIDexists {
shallCol = insert(column ccount)
width (shallCol, 50)
title (shallCol, "Shall ID")
}
It keeps giving me a "Syntax error" for:
shallCol=insert(column ccount)
Here is the insert in the reference manual:
insert (column in module)
Declaration:
Column insert(Column c)
Operation:
Inserts a column, pushing subsequent columns one right. Returns a
handle to the new column. If a column is inserted at a new position, it
is important to initialize the width of the new column (see the width
(get) function).
Example:
This example inserts a new column 1 as a copy of the old column 1, if
present:
insert(column 1)
Some help?
A quick test is shown below.
Module m = current
Object obj
for obj in m do {
if ((level obj) > 1) {
print "Object level : " level obj "\n"
print "Object number: " number obj "\n"
print "ParaString : " ParaString(obj) "\n\n"
}
}
Object level : 2
Object number: 2.0-1
ParaString : 2
Object level : 4
Object number: 2.0-2.0-1.0-1
ParaString : 2
Object level : 3
Object number: 4.0-1.0-1
ParaString : 4
joel...@gmail.com wrote:
> I have just been told to "get to know Doors" as part of my job. The
> scripting language is giving me problems. Here is some dxl code that
> has been dropped into my lap:
>
> string ParaString (Object o) {
> int n
> string s, t
> s = number o
> if (matches("-",s)) {
> s[match 0]
> n = start 0
> t = s[(n-2):n]
> n = n - 1
> if (t == ".0-")
> n = n - 2
> t = s[0:n]
> } else
> t = s
> return t
> }
>
int ccount=2
Column shallCol
shallCol = insert(column ccount) //What is wrong with this statement?
You will also need to declare and initialise shallIDexists:
bool shallIDexists = false
And you'll need to assign an attribute to the newly-created column:
attribute(shallCol, "Attribute Name")
Thanks for all your help guys...I have a feeling I'll be asking a few
questions before I get the hang of this crazy scripting language...
Thanks,
Joe