| View previous topic :: View next topic |
| Author |
Message |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Jun 20, 2005 8:38 am Post subject: gosub to command problem |
|
|
hi all,
i have come across a strange problem
i have a program that works fine BUT when i change a gosub section of code to a command (using all the correct syntax), the program does not work any more
best as i can figure, using a command instead of a gosub clears my variables such as %t, %y, . . .
anyone come across this little problem?
serge _________________
|
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Jun 20, 2005 9:33 am Post subject: |
|
|
i forgot to say, and this adds to the mystery, that if i use variables such as %%t and %%y then the variable keeps its content whereas if i use %t and %y then its contents are cleared
serge _________________
|
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Mon Jun 20, 2005 12:01 pm Post subject: |
|
|
Here's a quote from the help file...
| Quote: | To facilitate the use of commands and functions written in DialogScript, the language supports local variables.
When a script-defined function or command is executed, a new set of variables %1 .. %Z is created for use in that command or function.
The variables %1 and up are preloaded with the command parameters or function arguments.
Other than that, the variables %1 .. %Z are empty when the command or function is executed, and their contents are lost when the exit command is executed. (To return a value as the result of a user-defined function, one string may be given as the parameter to the function's EXIT command.)
On exit, execution continues at the point after the command or function that was used.
Long-named variables (those starting with "%%") are global and may be accessed at any point in the program. If it is desired to use such variables within a user-defined command or function it is suggested that a naming convention (such as prefixing each name with the command/function name and an underscore) is used to avoid accidental conflicts. |
Hope that explains it well enough...
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Tue Jun 21, 2005 12:49 am Post subject: |
|
|
thanks for that hooligan...i certainly did not know about this
serge _________________
|
|
| Back to top |
|
 |
|