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 


IF STATEMENTS AS TESTS

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


Joined: 08 Apr 2002
Posts: 15

PostPosted: Mon Apr 08, 2002 12:38 am    Post subject: IF STATEMENTS AS TESTS Reply with quote

Hi folks,

I'm new to VDS, and am having a few syntax problems.
I'm trying to delete a file, and test that it was successful by using an IF statement like this:

--snip--
rem delete destination world resource clm file
LIST ADD, OutputWindow, About to delete %A\resource\common\levels\%K\world\*.*
IF FILE DELETE, %A\resource\common\levels\%K\world\*.*
LIST ADD, OutputWindow, OK
else
LIST ADD, OutputWindow, couldn't delete %A\resource\common\levels\%K\world\*.*
END
--snip--

When this is run, it returns OK as true and continues, however the files haven't been deleted. What am I doing wrong?
Back to top
View user's profile Send private message
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Mon Apr 08, 2002 1:22 am    Post subject: Reply with quote

You can't "nest" commands after eachother, only functions can be nested. You may be able to do what you want using the following. Usually you can use @OK() to check whether an operation worked out.

Code:

rem delete destination world resource clm file
LIST ADD, OutputWindow, About to delete %A\resource\common\levels\%K\world\*.*
FILE DELETE, %A\resource\common\levels\%K\world\*.*
IF @OK()
  LIST ADD, OutputWindow, OK
else
  LIST ADD, OutputWindow, couldn't delete %A\resource\common\levels\%K\world\*.*
END


Tommy
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Seffyroff
Newbie


Joined: 08 Apr 2002
Posts: 15

PostPosted: Mon Apr 08, 2002 1:43 am    Post subject: Reply with quote

Tommy,

Thanks for your reply! That had solved my issues, great!

For my next question, As you may have noticed from my code i am using a list box as an output window. Is there any way to make it scroll with the updated messages automatically? at the moment when the number of messages exceeds the length of the list box they continue below the bottom of the box, and you have to manually drag the scrollbar down to see whats going on. Can it scroll down to the bottom of the box automatically somehow?
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Mon Apr 08, 2002 7:23 pm    Post subject: Reply with quote

__________________________________________________________________________________________________________________________
Try this:
Code:

If @greater(@count(OutputWindow), 0)
   LIST SEEK, OutputWindow, @pred(@count(OutputWindow))
end

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Seffyroff
Newbie


Joined: 08 Apr 2002
Posts: 15

PostPosted: Mon Apr 08, 2002 7:27 pm    Post subject: Reply with quote

Thanks, Mac. That works a treat Smile
Back to top
View user's profile Send private message
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