Skip to content
⌘ NSIS Forum Archive

Super Function Task

16 posts

Afrow UK#

Super Function Task

I have a super task that I would like to see if anyone can do it...

1. It will search for any .wal files listed inside a .map file
2. It will assign the list of .wal files to a string.
2x. There will be more than 1 of the .wal files in the .map file.
3. It will print a list of all .wal files used in the .map.
4. It will check if the .wal files exist in a directory. If they do not, then it will alert the user with a 'texture.wal was not found in textures dir' message.

Seems a task that is very complex!


-Stuart
kichik#
Open the file, read line by line, if the line ends with .wal (StrCpy $0 $1 -4) check if the file exists, and if it doesn't print a warning.

That assumes of course that the files are listed line by line. If they are not just process it. For example, if they are listed in the form of FileSize=filename.wal then just use StrStr to skip the equal sign.
Sunjammer#
I might have a go later tonight, depends if I pass my motorbike test I've got to do sometime in the next few hours 🙂 (depends 'cause if I don't pass I might be miserable :P)
Afrow UK#
Heh!
Good luck, and don't fall off 😛

Btw, my dad used to ride motor bikes till he fell off and did a lot of damage to himself and what ever he went into lol.
Sorry, musn't put you off!

I should try doing this script myself, but I have no idea how or what to do, let alone where to start.

-Stuart 🙂
Afrow UK#
New modified task...

1. Gets list of wal files in map
2. Prints only wal files from list that aren't found in the textures directoy.

Also, the wal files will have directories assigned to them...
e.g.
afrowuk/afrow_wall2.wal

It will then have to check whether textures\afrowuk\afrow_wall2.wal exists or not. If it doesn't then it needs to print a message saying that it doesn't exist.

I still can't think how this would be done.
Some sort of function with a loop in it.
First loop, gets wal file no1 and finds if it exists.
Loops, and goes to next wal file etc

-Stuart 😳
Afrow UK#
????

Goo you really are god you!

Show us the script and I shall give you a prize!!!!

-Stuart 🙂
kichik#
First one:

ClearErrors
FileOpen $0 file.map
IfErrors error
loop:
    FileRead $0 $1
    StrCmp $1 "" done
    StrCpy $2 $1 -4
    StrCmp $2 ".wal" 0 loop
        DetailPrint $1
        IfFileExists "$INSTDIR\\$1" loop
            DetailPrint "Warning: file doesn't exist!"
            Goto loop
error:
    Abort "Error"
done:
    FileClose $0 
Not so hard to get to the second.
Afrow UK#
What comes next?
I tried the script but $1 prints nothing
I have set it to target a definate map file too.

-Stuart
Afrow UK#
Really?
The .map file is what stores all the map structure data including what textures go on which surface.
I shall try the script on a .bsp file instead.

Does that mean the .map file stores the .wal files in an encipted way?

-Stuart
Afrow UK#
Right OK, I found the textures.
They don't have .wal on the end of them...


( -10 2250 664 ) ( -10 2376 664 ) ( 117 2250 664 ) e1u1/sky1 0 2304 0 1.000000 1.000000 0 133 0
The e1u1/sky1 bit is the texture (goes in C:\quake2\baseq2\textures\e1u1\sky1.wal)

This makes it even harder to get only the .wal bits out of it.


I will look at other ways of getting it, for example..

Search for


) path/file

Edit:
.bsp files are the same. They don't have the .wal extension on the ends.

-Stuart