IonicWind Software

Creative Basic => General Questions => Topic started by: JoaoAfonso on November 30, 2007, 08:51:15 AM

Title: Strange SUB reaction...
Post by: JoaoAfonso on November 30, 2007, 08:51:15 AM
Ahoy.

I am posting today to ask if there is an easy answer for what's happening in one of my programs:
- I have declared the following at the begining of program:
    def camposacado[20]:string
    DECLARE printterreno(nchar:int,terreno:string)
- Then in middle of code, I wrote the following (this messagebox is just to check what is the actual camposacado[3] string):
    messagebox 0,camposacado[3],"ni"
    printterreno(x,camposacado[3])
- And this is the sub printterreno (again with a messagebox to check terreno string):
    sub printterreno(nchar:int,terreno:string)
    messagebox 0,terreno,"ni"

The strange thing is that the result of the first messagebox is what is expected, but the second one isn't... any clue?
Title: Re: Strange SUB reaction...
Post by: GWS on November 30, 2007, 10:34:52 AM
Hi,

I've seen this before, and Paul's comment was:

Creative/IB Std never had the facility for nested brackets.  It's something I am going to address.


So, for the moment, you would have to use:

openconsole

cls

def camposacado[20]:string

camposacado[3] = "test"

DECLARE printterreno(nchar:int,terreno:string)

x = 1

'- Then in middle of code, I wrote the following (this messagebox is just to check what is the actual camposacado[3] string):
messagebox 0,camposacado[3],"ni"

a$ = camposacado[3]

printterreno(x,a$)

do:until inkey$<>""
closeconsole
end


sub printterreno(nchar,terreno)
'- And this is the sub printterreno (again with a messagebox to check terreno string):

messagebox 0,terreno,"nisub"

return


or, pass the entire array camposacado[] to the subroutine, and pick out the element you need within the sub ..  :), but I haven't tried that ..  :)

best wishes,

Graham




Title: Re: Strange SUB reaction...
Post by: Ionic Wind Support Team on November 30, 2007, 06:45:53 PM
Graham,
I don't think that is what he was referring to.   Perhaps if we had a more complete example ;)

Paul.
Title: Re: Strange SUB reaction...
Post by: JoaoAfonso on November 30, 2007, 06:59:14 PM
Thanks for the answers. I guess that was the problem indeed, because if I type temp=camposacado[0] and make the routine work with temp, it works as it was supposed.