April 16, 2024, 02:42:16 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Strange SUB reaction...

Started by JoaoAfonso, November 30, 2007, 08:51:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JoaoAfonso

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?
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

GWS

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




Tomorrow may be too late ..

Ionic Wind Support Team

Graham,
I don't think that is what he was referring to.   Perhaps if we had a more complete example ;)

Paul.
Ionic Wind Support Team

JoaoAfonso

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.
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900