Some File Moving Questions
How do u create a new directory? How do u copy a file from one path to another?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Moving An Object Questions
Ok I am making a game for a project that I have to do and I am having some difficulties the following are a few questions
1. The game consists of a snake that you move, I am trying to figure out how I can make another object dissapear when it collide into it that then re-appears randomly on the screen.
2. I want a segment to be added on to the snake each time it collides into this object and I want this segment to turn with the snake whenever the snake turns.
If anyone can help me out here I would really appreciate it !!!!
*Thanx*
2 Questions About Moving Objects.
Hi. I am new to Visuall Basic but not also to programming.
1)I have this function function:
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 32 Then
...
When i have the right arrow key pressed a picture keeps moving. But it stops moving when i hit another key, although the right arrow key is still pressed. How can i do that so that the picture will keep moving when the right arrow key is pressed, no matter if meantime i press other keys?
2) I want to make a picture or shape to start moving everytime a particular key is pressed. I can do this, but if the user press the key twice, the picture starts moving and then ( when they press the key for the second time ) it stops to move, goes to the beginning position and then starts to move again( from the beginning ). But i want the two pictures/shapes to move at the same time. How can i do that? And the user can hit the key as many times as they want. If he hits the particular key 4 times, then four pictures/shapes will start moving from a particular position ( but in different times; every time he press the key a pictures starts to move, if it takes them 5 second to hit the key for the second time, then the second picture will start to move after 5 seconds from the first one. Finally, both of them will move - but the one will be ahead ).
thanks in advance
2 Questions....Moving Active Cell And Counting
Okay, the first question
I have found a cell...now i just need to move 3 cells to the right and get that value.
How do I from a column, count how many of that specific number like
222
222
333
333
444
444
444
so 222 = 2
333 = 2
444 = 3
Any information would be greatly appreciated.
Questions: BitBit Moving, Walkmasks And Item Pickups.
Ok, so far have i quickly created a small program where a picture(the guy you control) moves instantly to the location of your click. Theres 3 things i must now:
1. How can i make my guy move slowly to the targeted location? not instantly.
2.How can i create walkmasks? Forexample if i create a tree, and i dont want my guy to walk right through the tree but around it.
3.How can i make my character pick up items? Forexample how can i make my guy get 10 score-points when he moves over an item, which in reality is a picture.
Edit*
I use BitBit.
This is not going to be a real game, iam just testing things out before i start creating a game.
Nothing is animated.
Moving Around File
if I need to delete a certain line from a file, how can i move to that line in write mode?
Moving A File
Hey there...
I'm wondering how i can move a file. I've been trying the api call, "MoveFile", but i cant seem to get it to work... Anyone??
Thanks,
Jordan
Moving Throughout A File
Hi. Im having trouble with saving in my map editor. This part isnt game related though. What im trying to do is open up a Temp File.. that works fine. but im trying to go to a certain part in it. Like. If i had a tile at 10, 15 i want to go down 15 spaces.. i could do a loop for that easy enough.. but how would i go over? actually in eed it to go over 9 and down 14 then but thats not the point. help appreciated. thanx
Moving A File
It should be simple. I have a file on a networked drive that I want to move to another computer.
Obj.copy doesn't seem to work as the file isn't seen as a declarable object.
How can I do this?
File Moving
VB Code:
filecopy(FullPaths.item(FileNames(x)) , dirPaste.Path)
when i write this line of code to copy files i get a message saying it expects a = sign
fullpaths is a collection with all entries having a key of their file name
Filenames contains the names of the files that are used to reference the paths
File Moving
Hello all,
I have this program where i move files from server to PC and PC to server and so on (you get the idea )
I want to set up a progress bar to display how much time is left, the problem is I have no idea how to do this.
Anybody know how or mabe has an example?
Thanks,
Rudy
File Moving...
I want to know how to move specific files to a different directory. I found some help at http://www.vb-world.net/files/shfileop/ but this isn't exactly what I want to do.
I want to have all files in c:/files that start with the letter A to go to c:/files/A, all files that start with B to go to c:/files/B, etc... To basically alphabetize the files. I'm having trouble figuring out how to do this... do I create some sort of loop that checks each filename, then moves it?
Moving A File
how do i move a file (text document) that the user selects to a designated folder?
Moving A File...
How would I go about moving a specific file, thats in the same folder as the program thats going to move it, to a different folder?
-Thanks
Moving A File
what i want to ask is:
Question: What is the best method to move a file around the network...........?
The methods i have are the 'Name', 'FSO', 'shell32.dd' (which is what i am cuurenlty using), MoveFile/MoveFileEx in the win32 api or is there anything else i'm missing...............
i want to use the fastest most effient method, but i have little info on any of these methods......
Can anyone help?
Thanks
Mark
Moving Data In A File
Hi guys,
I have a little "newbie" problem. I'd like to move all data in a file from offset 720 till the end to offset 640 and further. Is that possible?
Thanks in advance, Jan.
Moving A File From One Folder To Another
Excel 2002 with Visual Basic 6.3
I have a file, say it's called test.txt, in C:. During the course of running a particular macro I would like to find that file, move it and save it to another folder, say C:My Documents.
Any ideas for the procedure?
Thanks
Moving A File Problem
On my MOVE I get... file already exist, when it doesn't.
Private Sub Form_Load()
Dim fs, f, f1, fc, flName
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder("c:workingatlantic")
Set fc = f.Files
For Each f1 In fc
flName = f1.Name
Debug.Print flName
f1.Move ("c:workingatlanticackup")
Next
End Sub
Help Moving The File Created
I got the next codes:
Code:
Private Sub Command1_Click()
On Error Resume Next
If GenerarArchivo(Dir1.List(Dir1.ListIndex) & "" & File1.List(File1.ListIndex)) Then
MsgBox "ECF File Successfuly converted"
File2.Refresh
End If
End Sub
Private Sub Command2_Click()
Shell "c:windows
otepad.exe " + Dir2.List(Dir2.ListIndex) + "" + File2.List(File2.ListIndex), vbNormalNoFocus
End Sub
Private Sub Command4_Click()
On Error Resume Next
If MsgBox("Are you Sure that you want to delete the file:", vbYesNo) = vbYes Then
Kill Dir2.List(Dir2.ListIndex) + "" + File2.List(File2.ListIndex)
File2.Refresh
End If
End Sub
Private Sub Command5_Click()
File2.Refresh
End Sub
Private Sub Command6_Click()
Shell "c:windows
otepad.exe " + Dir1.List(Dir1.ListIndex) + "" + File1.List(File1.ListIndex), vbNormalNoFocus
End Sub
Private Sub Command8_Click()
On Error Resume Next
If MsgBox("Are you Sure that you want to delete the file?", vbYesNo) = vbYes Then
Kill Dir1.List(Dir1.ListIndex) + "" + File1.List(File1.ListIndex)
File1.Refresh
End If
End Sub
Private Sub Command9_Click()
File1.Refresh
End Sub
Private Sub Dir1_click()
File1.Path = Dir1.List(Dir1.ListIndex)
File1.Pattern = "*.txt;*.sel; *.*.txt"
End Sub
Private Sub Dir2_Click()
File2.Path = Dir2.List(Dir2.ListIndex)
File2.Pattern = "*.ECF;*.ECP;*.ECE;*.ECB"
End Sub
Private Sub Drive1_Change()
On Error Resume Next
Dir1.Path = Left$(Drive1.Drive, 1) & ":"
End Sub
Private Sub Timer1_Timer()
End Sub
Private Sub Drive2_Change()
On Error Resume Next
Dir2.Path = Left$(Drive2.Drive, 1) & ":"
End Sub
Private Sub Form_Load()
File1.Path = Dir1.List(Dir1.ListIndex)
File1.Pattern = "*.TXT;*.SEL; *.*.TXT"
File2.Path = Dir1.List(Dir1.ListIndex)
File2.Pattern = "*.ECF;*.ECP;*.ECE;*.ECB"
End Sub
Function GenerarArchivo(ByVal sNombre As String) As Boolean
On Error GoTo Error:
Const HEAD = "TYPE"
Dim iArch1 As Integer
Dim iArch2 As Integer
Dim slinea As String
GenerarArchivo = True
iArch1 = FreeFile
Open sNombre For Input As #iArch1
iArch2 = FreeFile
Open Left(sNombre, Len(sNombre) - 4) & ".ecf" For Output As #iArch2
'paso la primer línea
If Not EOF(iArch1) Then Line Input #iArch1, slinea
stexto = HEAD + slinea
While Not EOF(iArch1)
stexto = stexto + "," + vbCrLf
Input #iArch1, slinea
stexto = stexto + slinea
Wend
Print #iArch2, stexto
Close (iArch1)
Close (iArch2)
Salir:
Exit Function
Error:
MsgBox "Error:" & Err.Description
GenerarArchivo = False
Resume Salir
End Function
What about now?
Sorry for the space.
2 windows where after presing the button create and rename the file but left the file renamed in the directory from the second windows. the problem is that the file is renamed but still in the same dir where I the old file is. Can somebody help me?
Moving Up && Down In File List Box
heyy guyz..
i was wondering...if i have a file list box with many files in it...how can i cause the cursor or watever to move to the next file down or up, to the beginning, and to the end of the list of files (and if possible cause the cursor to move randomly as well)...
and if it does move...under which event would that be?? example: file1_change??
thanxx in advance
Moving In Text File
I have open a text by
open #textfile for input as f_handle
i am moving/reading the file by
line input
if centain condition is not fulfilled i have move a line back ie i have to go to previous line
How i can do that in VB please tell
in foxpro fseek fuction return the current position of the file
which i used for above problem but i dont know how it is used in VB
Please help
Moving A File Before Saving The New One
I am working on project in EXCEL, using VBA. I have a command button which
creates a text file that gets uploaded into a software package we have.
Before the file gets saved, I want to move the old file into an archive
folder on a network drive.
Can anyone help me with code for this?
Bill Krupinsky
Performax - ISG
1050 Hull Street
Baltimore, MD 21230
410-986-2080
email@removed
Please visit us at www.GetPERFORMAX.com
Note: The information contained in this message may
be privileged and confidential and protected from
disclosure. If the reader of this message is not
the intended recipient, or an employee or agent
responsible for delivering this message to the
intended recipient, you are hereby notified that
any dissemination, distribution or copying of this
communication is strictly prohibited. If you have
received this communication in error, please notify
us immediately by replying to the message and
deleting it from your computer.
Couple Quick Questions (file Encoding / File Editing)
okay.... simple enough.....
I want to encode files, they are regular .txt files, but i renamed them .dat so they are alittle less obvious, but still readable by notepad...
most of the files are filled with just text
also file editing....
I need to tell the program to remove the last thing from the list.....
better yet...
I have a list like so:
item1
item2
item1
item3
i want to make the 2nd Item1 to be removed....
thats what i really could use.... but just removing the last one will do...
Problem - Moving A File Using Variable Name
OK, I have a problem, i`m fairly new to VB so this is probably easy to anyone with some experience.
I have done some importing of files (namely csv's) from a specific directory. Once they are imported, I want to move them to a sub-directory called "processed".
I have been trying to use the "Name.....As" code, for example
Name "C:ADirThisFile.txt" As "C:ThatDirThisFile.txt"
but I need to use a variable name rather than a hard-coded filename. This is because this code is in a loop and the filename of the file to be moved changes with each execution of the loop.
for example
Name filename As ".processed" filename
this obviously doesnt work....any suggestions....????
Moving Multiple .DAT Files Into One .DAT File
I need to move all of the .dat files in a directory to one large .dat file. I have been successful in moving one .dat file at a time, but not the entire directory. Below is the current code that I have. What do I need to change so that all of the files will be read and moved at once?
Here is the code.
VB:
Option Explicit
Private Sub Form_Load()
On Error GoTo Err_Form_Load
'Open Dialog box to select multiple files
With CommonDialog1
.DialogTitle = "Woohoo"
.InitDir = App.Path
.Flags = &H200& + &H4&
.Filter = "Data files (*.dat)|*.dat"
.Action = 1
End With
'Input #1
Open CommonDialog1.FileName For Input As #1
Err_Form_Load:
End Sub
Private Sub cmdRun_Click()
Dim sTemp As String
'Open file to be written to
Open "s: est_fold est2.dat" For Append As #2
Do Until EOF(1)
Input #1, sTemp
Write #2, sTemp
Loop
Close #1
Close #2
End Sub
Moving And Changing Bytes In A File
I've decided to create a EXTREMELY basic encrpytion method that involves moving and swapping bytes in a file. Sure, it's not very secure, but it keeps normal people out of the file . I intend to keep the code very simple, and i intend to just make a library, so that other people can use this in their programs.
What i need to know is how i can change bytes in a file. I've looked through the appropriate seconts of the forum, but to no avail. The appropriate posts either involve binary (too low), or ASCII or some other form of text (too high).
EDIT: I suppose there might be a way to get the binary and mathematically transform it in and out of hexadecimal form, but so far i haven't figured that out.
Moving Multiple File From Filelistbox
Hi All,
I have searched the forum and found some discussions on filelistboxes. I am doing what has already been previously suggested in those discussions but I am not getting the desired result.
I have a list of jpeg images in a filelistbox. The filelistbox multiselect property has been set to 2 - extended. The filelistbox does highlight a block of files when selected (click once on the top file, then hold down the shift key and select somewhere in the middle of the file list box), but when I try to copy the selected files only the last file is copied. My code is attached, any help offered will be greatly appreciated, I am sure it will be something simple
Code:
For i = 0 To FileSub.ListCount - 1
If FileSub.Selected(i) = True Then
TempStr1 = FileSub.Path & "" & FileSub.List(FileSub.ListIndex)
TempStr2 = FileTemp.Path & "" & FileSub.List(FileSub.ListIndex)
FileCopy TempStr1, TempStr2
End If
Next i
FileTemp.Refresh
Alittle Help With 'moving A File Into A Directory'
hi everyone im new here, i was referred by a friend, and i need alittle help on a simple program. it containes two buttons. the first i am using shell to call a program(no problem there)
but i have trouble doing this
i need a button to move c:/Program Files/xxxxxx/xxxxxxxx/splash.jpg to c:/Program Files/xxxxxxxx/xxxxxxxxx/xxxxxxxxx
i put the x'es cause the path is irrelevant. i just need alittle help on how i can move one file into a folder directory
thx alot
~g3nuin3
File Moving Without Existing Destination
I have a file that I want to move to a folder however I don't have the same
file in the existing folder. I have a OpenFileDialog that the member uses to
select the file and move the file name into the text box. Then I have a
secondary FolderBrowserDialog that the member uses to select the folder to move it
to. All the selections are made however when I try to move the file it comes
to System.IO.File.Move(Source, Destination) however it doesn't like it
because it says that the Destination Folder already exist I'm not trying to create
the folder I just want to move this file inside of it. Any ideas. Sorry if
this is basic I am trying to learn
Shawn
Moving Through The Files In A File List Box...
Hey everyone,
As the title states I am trying to move through files in a file list box. For example...if the file list box contains 3 files and the user selects all 3 and clicks on a delete button, a loop will be activated like below that will update the selected index and call the delete confirmation each time. The problem is I don't know how to get the selected index to change. I have tried filelistbox1.selectedindex.equals(count) but the selected index never changes from 0. If this isn't clear post back and I'll try to explain it better...any help would be greatly appreciated. Thanks in advance
Code:Dim count As Integer = 0
Do Until count = FileListBox1.SelectedItems.Count
'update selected index so when frmdelete is called it uses the right filename
frmdelete.show
count = count + 1
Loop
Edited by - piles on 6/20/2007 8:10:01 AM
Finding Out If A File Is Locked Before Moving It
Hi,
I need to move files from one directory to another during run time, with the file system object.
How can I make sure that the files are not locked (still being written) before I attempt to move them ?
Is there a IsLocked function of some kind ?
Dani
Code For Moving To The First Blank Cell In A Worksheet; Moving Left,right,up Or Down
I have created an application form as a userform in Excel. I need to send the data entered into my text boxes when the program runs to separate excel cells in a worksheet.
My problem is I can use code that will send the textbox entry to a specific cell eg. If my textbox is named Surname I can say
range("a5").value = surname but if I do that when I run the programme to enter the next record for someone else the first record will be overwritten.
I NEED A CODE LINE THAT WILL TAKE ME TO THE FIRST EMPTY CELL AND ALLOW ME TO MOVE DOWN OR TO THE LEFT OR TO THE RIGHT
Moving Or Saving A .mdb File To Another Folder Code
eiy guys,, i need a code that will move or save as my database.mdb
located on C:
and move it to D:/backup/
please give me the code and the proper preferences to click
please email me at pwedepobangmagtanong@yahoo.com
Moving A File From One Folder To Another {updating Hyperlinks}
Thank you!!! I was looking for help moving files from one folder to another.
But I have a question...and this may be a little above my league (started learning VBA a month ago)
After I have moved the files, how do I update my hyperlinks within Excel?
Thanks in advance.
Copy+moving File And Creating Folder That
My first post, this forum is great.
I searched and found how to move a file to a diff. dir using FSO object. Here is my situation. I want to create the destination folder so it displays that days date.
I'm moving "c:projects*.fdd" files ----> c:projects?
Where the question mark is i want a folder created to reflect that days date.
Thanks.
MoveFile Does Not Work When Moving File In A Variable
Hello, I have a form that first it gets the name of the file and stores it in a variable. When I try to do the fso.MoveFile (<souce folder> & <name of the file>),<destination folder> it does not work. If I say "*.*" it will move all files in the source folder but I only want to move the one in the variable. How can I do that?
Thanks.
CODEIf fldr.files.count >= numberOfFiles Then
For Each fil In fldr.files
If Right(fil.ShortName, 3) = "TIF" Then
If fil.DateLastModified < oldestDate Then
oldestFile = fil.path
oldestDate = fil.DateLastModified
End If
End If
Next
ShowFileList = oldestFile
MsgBox oldestFile ' show me file name in a msgbox
filename = oldestFile
fso.MoveFile (sfolder & fso.GetFileName(oldestFile)), dfolder
End If
Problem When Moving Connection String To INI File
I've built a COM object that is being used with ASP for my web application. The application works fine, but when I try to move the connection string to an INI file, I start encountering problems. For each class I went into Component Services under the Activation tab, checked 'Enable Object Construction' and entered the path to the INI file in the text box. The code for retrieving the conn string from the INI file is below.
Code:
Private Sub Init()
Dim oInit As Object
On Error GoTo ErrHndlr
Set oInit = CreateObject("eSvcsFunctions.cInitValues")
sConnection = oInit.getConnectionString(sIniLocation, "ConnectionInfo", "Provider", "Server", "User", "password", "database", "InTerNeTAppS03")
Set oInit = Nothing
Exit Sub
ErrHndlr:
App.LogEvent "FISProductdoc.Init: " & Err.Number & ": " & Err.Description
Err.Raise Err.Number, Err.Source, Err.Description
End Sub
As soon as the 'Enable Object Construction' box is checked I get an error on my ASP page that says 'ActiveX component can't create object'. Any help is appreciated. Thanks in advance.
File Open && File Save Questions
Again drawing on the groups experience:-
1. For general file opening and file saving, using VB6, are there any issues
with using the FileOpen and FileSave Common Dialog Boxes?
2. Is using the FileOpen and FileSave Common Dialog Boxes the best way to go
in general?
3. For Most of my projects I will be using the same types of data input form
and report output form, as discussed here recently. Also, the files that are
saved or recalled are all of the same type (text files with extension .job)
and are, ideally for me, saved in the same directory (App.Path / job). This
being the case the FileOpen and FileSave Common Dialog Boxes seem to be a
bit of an over kill?
a) When file saving; only the "file name", without extension is needed. This
could be supplied more simply on the data input form as the first part of
the required data, or is this too crude?
b) When recalling an existing job I could get away with just the FileListBox
because I know (or think I know) where the Drive/Directory is. Or is this
also too crude.
a) and b) appear very simple to me but don't mimic your conventional Windows
style application. I would therefore be most grateful for your advice.
Regards
Martin Double
Email: Join Bytes!
Web Site: http://home.btconnect.com/cadoss
HELP! Excel Query That Pulls From A Moving File Location
I have what seems like a unique situation. At least I have not found anything similar in searching these forums. If I'm wrong please direct me to a similar thread.
I am working in excel and I need a VB code that will pull a query from another excel file and can be refreshed. I can get that part but I run into a problem when the file that the query is pulling data from is moved. I need the code to propt the user to find the new location and then pull a new query from the new location and put it on the same spot as the previous query.
Please help quickly! I have to get this done and present it in a couple of days.
Thanks in advance for your help.
Nic
Moving A File And Keeping The Directory Structure In VBScript
Hello, first off, I am going to say this is my first VBScript script.
I do well enough in plain VB, but this is confusing me.
I've been asked to make a script that would copy files from one drive onto another if they were older then a certian date.
So far, this is what I have
Code:
strDriveFrom = "C:" ' Set to the directory you want to copy from
strDriveTo = "D:"' Set to the directory you want to copy to
StartDate = "11/22/2002"' Any file modified after this date will be moved
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFS.GetFolder(strDriveFrom)
Set oSubFolders = oFSFolder.SubFolders
For each folderObject in oSubFolders
Set oFiles = oFS.Drives(strDriveFrom).RootFolder.SubFolders(folderObject).Files
For each fileObject in oFiles
Set oFile = oFS.GetFile(fileObject)
dteFileModified = oFile.DateLastModified
dteFileModified = FormatDateTime(dateModified, 1)
if DateDiff("d", StartDate, Date) < 0 Then
Next
I then hit me that I have no idea how to keep the directory structure, and how to scan sub folders.
Any help would be very much appreciated.
X File And Other Questions
I've finally managed to move a mesh around a 3D environment, but I'm not sure it's the best/normal way of doing it. Here's what I've got so far:
Basically get keyboard input from user
Move world matrix to position the new location of player 1
Render Player 1
Move world matrix back to original position
Render static objects
Code:
'In Module
Public Type MeshesUDT
Mesh As D3DXMesh
MeshName As String
MeshMaterials() As D3DMATERIAL8
MeshTextures() As Direct3DTexture8
NumMaterials As Long
End Type
Public Meshes() As MeshesUDT
Public NumMeshes As Integer
Public m As Integer
Public Function InitMeshGeom() As Boolean
NumMeshes = 3
ReDim Meshes(NumMeshes)
Meshes(1).MeshName = "Hut"
Meshes(2).MeshName = "Grass"
Meshes(3).MeshName = "Stick"
For m = 1 To NumMeshes
Meshes(m).NumMaterials = 0
TextureFile = ""
Set Meshes(m).Mesh = D3DX.LoadMeshFromX(App.Path & "Models" & Meshes(m).MeshName & ".x", D3DXMESH_MANAGED, _
D3DDev, Nothing, MtrlBuffer, Meshes(m).NumMaterials)
If Meshes(m).Mesh Is Nothing Then Exit Function
ReDim Meshes(m).MeshMaterials(Meshes(m).NumMaterials - 1)
ReDim Meshes(m).MeshTextures(Meshes(m).NumMaterials - 1)
For i = 0 To Meshes(m).NumMaterials - 1
D3DX.BufferGetMaterial MtrlBuffer, i, Meshes(m).MeshMaterials(i)
Meshes(m).MeshMaterials(i).Ambient = Meshes(m).MeshMaterials(i).diffuse
TextureFile = D3DX.BufferGetTextureName(MtrlBuffer, i)
If TextureFile <> "" Then
Set Meshes(m).MeshTextures(i) = D3DX.CreateTextureFromFile(D3DDev, App.Path & "Models" & TextureFile)
End If
Next
Next
Set MtrlBuffer = Nothing
InitMeshGeom = True
End Function
'####################################
'In Form
Private Sub Form_Load()
'Init stuff here etc...
Do While bRunning = True
CalcFPS
GetKeyboardInput
'UpdateMatrices
Render
DoEvents
Loop
End Sub
D3DDev.Clear 0, ByVal 0, D3DCLEAR_TARGET Or D3DCLEAR_ZBUFFER, &HFF000080, 1#, 0
D3DDev.BeginScene
UpdateMatrices
DrawText
D3DDev.EndScene
D3DDev.Present ByVal 0, ByVal 0, 0, ByVal 0
End Sub
Private Sub GetKeyboardInput()
DIDev.GetDeviceStateKeyboard DIState
'Move Player 1
'Left / Right
If DIState.Key(DIK_A) Then
P1Pos.x = P1Pos.x - 0.1
End If
If DIState.Key(DIK_D) Then
P1Pos.x = P1Pos.x + 0.1
End If
'Up / down
If DIState.Key(DIK_LSHIFT) Then
P1Pos.y = P1Pos.y + 0.1
End If
If DIState.Key(DIK_LCONTROL) Then
P1Pos.y = P1Pos.y - 0.1
End If
'Forwards / backwards
If DIState.Key(DIK_W) Then
P1Pos.z = P1Pos.z + 0.1
End If
If DIState.Key(DIK_S) Then
P1Pos.z = P1Pos.z - 0.1
End If
End Sub
Private Sub UpdateMatrices()
'###################################################
'## Change World Matrix
'###################################################
'Move world matrix to position objects that have moved
D3DXMatrixIdentity MatWorld
D3DXMatrixTranslation MatWorld, P1Pos.x, P1Pos.y, P1Pos.z
D3DDev.SetTransform D3DTS_WORLD, MatWorld
'Render Moved objects
For i = 0 To Meshes(NumMeshes).NumMaterials - 1
D3DDev.SetMaterial Meshes(NumMeshes).MeshMaterials(i)
D3DDev.SetTexture 0, Meshes(NumMeshes).MeshTextures(i)
Meshes(NumMeshes).Mesh.DrawSubset i
Next
'Reset world matrix back to normal position
D3DXMatrixTranslation MatWorld, 0, 0, 0
D3DDev.SetTransform D3DTS_WORLD, MatWorld
'Render static objects
For m = 1 To NumMeshes - 1
For i = 0 To Meshes(m).NumMaterials - 1
D3DDev.SetMaterial Meshes(m).MeshMaterials(i)
D3DDev.SetTexture 0, Meshes(m).MeshTextures(i)
Meshes(m).Mesh.DrawSubset i
Next
Next
'###################################################
'## Change View Matrix
'###################################################
'Location, Looking at, Up is Y
D3DXMatrixLookAtLH MatView, CamSrc, CamTarget, CamUpDir
'D3DXMatrixLookAtLH MatView, ChangeCam(0, 0, 0), _
ChangeCam(CamSrc, CamSrc, CamSrc), _
ChangeCam(0, 1, 0)
'Set cam changes to device
D3DDev.SetTransform D3DTS_VIEW, MatView
'###################################################
'## Change Projection Matrix
'###################################################
'Not changed, only initialised (for now?)
'Used for zooming in/out? (View Matrix does that?)
'Used for rendering distance (near/far)
End Sub
It all works ok, but is that the normal way of doing it? I've read through quite a few other posts and I think I've got it right. I just want to make sure just incase I run into problems with it later on, if I have done it incorrectly. Will this cause problems if more than one object moves ata time?
Secondly, Where are the co-ordinates of a mesh kept when an x file is first loaded? I'll need to be able to position some meshes in different places from the start. At the moment, I'm having to guess where to position them when I create them in 3DS Max
This might seem a bit of a silly question, but how small/big should I make the meshes? "Does size matter?" I'm thinking the smaller the better in this case or doesn't it matter seeing as the meshes will still contain the same number of faces? If smaller is better, for example, how tall should a person be in a 1st person shooter? Probably sounds like a stupid question, but it's hard to tell now that I've created my first 3D environment, just what size objects should be, as there's nothing to compare them to, if you get what I mean ( I hope).
Most of the time when I create a 3DS file in 3DS Max, then convert it to an x file using conv3ds, it says something about not outputting a dummy frame with the child. What does that mean exactly? What have I done to the mesh to mess it up and how can I put it right/prevent it from happening?
On a slightly different note, I was recently working on a game using DirectDraw with collision detection. I'm just wondering if the way I've done it, is the norm, or if it's too inefficient. Here's part of my code:
Code:
Private Sub MoveBullets()
'Loop through both teams
For t = 1 To NumTeams
'Loop through each unit in the team
For u = 1 To Team(t).TotalUnits
'Loop through each bullet for the unit
For i = 1 To 3
'If bullet is active, then move it and detect collisions
If Team(t).Unit(u).Bullet(i).Active = True Then
'Select to decide which way the bullet goes (left or right)
Select Case t
Case 1
Team(t).Unit(u).Bullet(i).R.Left = Team(t).Unit(u).Bullet(i).R.Left + Team(t).Unit(u).BulletSpeed
Team(t).Unit(u).Bullet(i).R.Right = Team(t).Unit(u).Bullet(i).R.Left + DDBulletDesc.lWidth
Case 2
Team(t).Unit(u).Bullet(i).R.Left = Team(t).Unit(u).Bullet(i).R.Left - Team(t).Unit(u).BulletSpeed
Team(t).Unit(u).Bullet(i).R.Right = Team(t).Unit(u).Bullet(i).R.Left + DDBulletDesc.lWidth
End Select
Team(t).Unit(u).Bullet(i).Distance = Team(t).Unit(u).Bullet(i).Distance + Team(t).Unit(u).BulletSpeed
DetectBulletCol
If Team(t).Unit(u).Bullet(i).Distance - Team(t).Unit(u).Bullet(i).FiredFrom >= Team(t).Unit(u).BulletRange Then
Team(t).Unit(u).Bullet(i).Active = False
Team(t).Unit(u).Bullet(i).Distance = 0
End If
End If
Next
Team(t).Unit(u).FireDelay = Team(t).Unit(u).FireDelay + 1
Next
Next
End Sub
Private Sub DetectBulletCol()
For x = 1 To UBound(FieldObj)
IntRect = IntersectRect(NewRect, Team(t).Unit(u).Bullet(i).R, FieldObj(x).HitRect)
If IntRect = True Then
BulletHit x, 0
End If
Next
'Team 1 Friendly fire
For x = 1 To UBound(Team(t).Unit)
If x <> Team(t).UnitNum Then
IntRect = IntersectRect(NewRect, Team(t).Unit(u).Bullet(i).R, Team(t).Unit(x).HitRect)
If IntRect = True Then
BulletHit x, t
End If
End If
Next
'Select enemy team
Select Case t
Case 1
et = 2
Case 2
et = 1
End Select
'Enemy fire
For x = 1 To UBound(Team(et).Unit)
'If x <> Team(2).UnitNum Then
IntRect = IntersectRect(NewRect, Team(t).Unit(u).Bullet(i).R, Team(et).Unit(x).HitRect)
If IntRect = True Then
BulletHit x, et
End If
'End If
Next
End Sub
Private Sub BulletHit(UnitKilled As Integer, sTeam As Integer)
'0 = Field object hit
If sTeam = 0 Then
BeenHit = "Building hit!"
Exit Sub
End If
Team(sTeam).Unit(UnitKilled).Alive = False
Team(sTeam).Unit(UnitKilled).R.Right = Team(sTeam).Unit(UnitKilled).sWidth * (Team(sTeam).Unit(UnitKilled).Rows)
Team(sTeam).Unit(UnitKilled).R.Left = Team(sTeam).Unit(UnitKilled).R.Right - Team(sTeam).Unit(UnitKilled).sWidth
'Delete hitbox of killed unit
With Team(sTeam).Unit(UnitKilled).HitRect
.Bottom = 0: .Left = 0: .Right = 0: .Top = 0:
End With
Select Case Team(sTeam).Unit(UnitKilled).uType
Case "Artillery"
Team(sTeam).Artillery = Team(sTeam).Artillery - 1
Case "Cavalry"
Team(sTeam).Cavalry = Team(sTeam).Cavalry - 1
Case "Rifleman"
Team(sTeam).Riflemen = Team(sTeam).Riflemen - 1
End Select
'If the unit killed was selected at the time, switch to next unit
If Team(sTeam).UnitNum = UnitKilled Then CycleUnits sTeam
End Sub
.dat File Questions
I am running a ".bat" file for a Access program.
Three questions:
What is a ".bat" file?
Is it sensitive to newlines spaces etc when I edit it in notepad??
Also (if possible) can you advise how I can hide a run (I am running the .bat file on my local NT scheduler) when it is executed in the Task Scheduler? Basically run it in invisible mode on my workstation so that when it runs I wont see it on my workstation?
Here is an example of my ".dat" file where "myMacro4" sends an email out:
"C:Program FilesMicrosoft OfficeOfficeMSACCESS.EXE" "G:mydatabase.mdb" /x:myMacro4
quit
.rtf File Questions..
hi, I have .rtf file on my project. I want to load the rtf to form and the user can alter the rtf file and then update the changes to the original rtf file. I already know how to load the file but I dont know how to update the changes to that file..
File Questions
How would I get an app to rename files
Example: File.txt to readme.txt
File Questions
Is there a way to search through a drive and locate a specific file?
I loaded the microsoft runtime scripting tools and so far can search through evry top lvl subfolders for my file. I, however, can't search through every subfolder I.E. the whole drive. Anyone have any ideas?
Thanks!
Kent
Moving Balls To Moving Images??
Please take a look at this as it is related to my question
Thread
is it possible for the create images to be an image type that is already drawn?
File Questions,newbie!
Sorry up front if these are kinda basic questions. I am trying to create a form that will get certain info from the user in a text box and create,save and on form load ,load the text file and display it in either a textbox or a listbox. Any starter help or answers would be welcomed.
|