| View previous topic :: View next topic |
| Author |
Message |
noveltech Contributor

Joined: 16 Sep 2002 Posts: 105
|
Posted: Wed Oct 23, 2002 7:23 pm Post subject: Calling Specific line from within VDS EXE |
|
|
Is it possible to
Call a Specific line or sub routine
from within VDS EXE.
AS in: VDS.EXE /2 which would call the prog and start at :2 and stop?
| Code: |
REM Compile this script and call it VDS
:1
INFO ONE
STOP
:2
Info TWO
STOP
|
Thanks for all feedback! nt |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Oct 23, 2002 7:32 pm Post subject: |
|
|
That's an easy one!
| Code: |
rem %1 holds the first parameter which the compiled program got...
goto %1
:1
info This calls 1
exit
:2
warn And this 2
exit
:3
info And guess what... This calls label :3
exit |
|
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Wed Oct 23, 2002 8:00 pm Post subject: |
|
|
If the user gives the program a parameter such as "/7" or one that isn't supported, you will get an error. You can solve the problem by using:
| Code: | if @null(%1)
warn No Parameter Entered!
goto MainProgramCode
end
if @equal(%1,"/param1")
goto param1
end
if @equal(%1,"/param2")
goto param2
end
if @equal(%1,"/param3")
goto param3
end
:param1
info Enter the code to process here
exit
:param2
info Enter the code to process here
exit
:param3
info Enter the code to process here
exit
:MainProgramCode
rem Main Program Code Here
info Main Program Code Here
exit
rem End Main Program Code |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Wed Oct 23, 2002 8:03 pm Post subject: |
|
|
If you want to test your parameter code without having to go to the trouble of compiling, you can use the Run > Command Line feature built into VDS. Enter your parameter, then run your script.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Oct 23, 2002 8:13 pm Post subject: |
|
|
Can be shorter!
| Code: | if @equal(%1,1)@equal(%1,2)@equal(%1,3)
goto @strdel(%1,@pos(/,%1),@pos(/,%1))
else
goto mainprogram
end
:1
exit
:2
exit
:3
exit
:Mainprogram
blablabla |
|
|
| Back to top |
|
 |
|