Page 1 of 1 1
Topic Options
#37126 - 2003-02-28 05:34 PM "Return" messing up my USE command
Anonymous
Unregistered


I am using Kixtart 4.12 on Windows 2000 and am having a problem with USE. Here is the script:
code:
  

$letter = "G:"
$path = "\\yeg01-nts-04\it_drive"
Gosub mapdrive

...

:mapdrive
$map = $map + 1
AT ($map,0) "Connecting to $path as $letter Drive"
Use $letter "$path"
Return

code:
  

The message that I get when I run this script is "Script error: error in use statement! Return". Is there any way to make it so the "Use" doesn't think that the Return statement is part of it's arguments?

Top
#37127 - 2003-02-28 05:45 PM Re: "Return" messing up my USE command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
code:
$letter = 'G:'
$path = '\\yeg01-nts-04\it_drive'
Gosub mapdrive
exit 0

:mapdrive
$map = $map + 1
? 'Connecting to '+$path+' as '+$letter+' Drive'
Use $letter $path
Return

And take a look at the UDF Forum which contains a couple of 'map drive' UDFs. UDFs are preferred over GOSUBS.
_________________________
There are two types of vessels, submarines and targets.

Top
#37128 - 2003-02-28 06:01 PM Re: "Return" messing up my USE command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yeah, basically it was that you forgot the exit, so the mapdrive got executed at the end of script and at that point the return was too much.
_________________________
!

download KiXnet

Top
#37129 - 2003-02-28 06:01 PM Re: "Return" messing up my USE command
Anonymous
Unregistered


OK that's cool. I posted the wrong code with the quotation marks around my last variable in the use statement. I had changed it once I started to troubleshoot.

I was just wondering if you could elaborate on why a UDF is better than a gosub. Are they more efficient with memory? I use the gosub to cut down the # of lines in the script, but am wondering if there is a performance or other gain from using a UDF.

Ooooh! I didn't even see that I missed the Exit statement!!! Ooops! Sorry to waste your time!

[ 28. February 2003, 18:08: Message edited by: Kellar ]

Top
#37130 - 2003-02-28 06:04 PM Re: "Return" messing up my USE command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
UDFs are very modular, they simulate internal KiXtart functions, and they can be included via external files. See e.g. How to use UDFs . There are over 300 UDFs currently available.
_________________________
There are two types of vessels, submarines and targets.

Top
#37131 - 2003-02-28 06:09 PM Re: "Return" messing up my USE command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yeah! [Big Grin]

just like your signature states [Razz]

kellar, if there is some task you wish to have as udf, just say.
we will try to code that too [Wink]
_________________________
!

download KiXnet

Top
#37132 - 2003-02-28 06:40 PM Re: "Return" messing up my USE command
Anonymous
Unregistered


Thanks for the offer for future tasks.

I think I understand from the UDF link posted by sealeopard, so I'm going to give my first UDF a shot and see how it goes. Thanks to both of you for the help.

Top
#37133 - 2003-02-28 06:41 PM Re: "Return" messing up my USE command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Why not use the existing drivemapping UDFs?
_________________________
There are two types of vessels, submarines and targets.

Top
#37134 - 2003-02-28 07:13 PM Re: "Return" messing up my USE command
Anonymous
Unregistered


Well I intended to see if I could get the job done by figuring it out by myself just to see if I could be. However, now that I get right down to it, I'm going to have to just that and look at some previous examples since I don't know how to start the UDF.
Top
#37135 - 2003-02-28 07:55 PM Re: "Return" messing up my USE command
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
If you look here: http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=2&t=004217#000010 you will find my MapDrive UDF in a functional script.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#37136 - 2003-02-28 09:52 PM Re: "Return" messing up my USE command
Anonymous
Unregistered


Thanks Howard, it helps to see a complete example. I can really see how the script is structured with the function in it.

I should also mention that your site is in my bookmarks now too! It's quite handy with the page containing all of the UDF's.

Top
#37137 - 2003-02-28 09:54 PM Re: "Return" messing up my USE command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what page?
hoby??? [Big Grin]

kellar, nice to see that you are in to kix.

seems that you have some fresh blood to share [Wink]
_________________________
!

download KiXnet

Top
#37138 - 2003-02-28 09:56 PM Re: "Return" messing up my USE command
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I think that the UDFs are on Lonkero's or NTDOC's sites. I have Perl and other admin stuff on mine. [Smile]

[ 28. February 2003, 21:56: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#37139 - 2003-02-28 09:57 PM Re: "Return" messing up my USE command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
And of course in the UDF Forum, the other two are just (sorted) mirrors.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 293 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.06 seconds in which 0.022 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org