forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


gosub to command problem

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Mon Jun 20, 2005 8:38 am    Post subject: gosub to command problem Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Mon Jun 20, 2005 9:33 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Mon Jun 20, 2005 12:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Tue Jun 21, 2005 12:49 am    Post subject: Reply with quote

thanks for that hooligan...i certainly did not know about this Embarassed

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group