Battlezone Universe

Battlezone Universe => Battlezone 2 => Maps and Modding => Topic started by: TheJamsh on January 28, 2009, 10:47:47 PM

Title: DLL & AUTOREG trickery
Post by: TheJamsh on January 28, 2009, 10:47:47 PM
Im no programmer outside of the PIC chip programmer and the BZII dll scriptor. But i have a question

I want recycler variants to become available in my mod when you pass certain missions. The most effective way i think this can be done is to 'write' an AUTOREG file in the rootdir when certain parts of the mission/storyline are passed. Hell you could have plenty of fun with it.

I suspect it's do-able, albeit far outside the scope of the BZII scriptor. My question is, can it be done? and if so (to a programming noob), how?
Title: Re: DLL & AUTOREG trickery
Post by: Nielk1 on January 28, 2009, 10:52:26 PM
Easily. Interesting Idea. Another option is to yell at a person who uses a rec they can't. Yes, you can load such things, but it would be the server with all the control of the MP game, and someone could bypass it rather easily.
Title: Re: DLL & AUTOREG trickery
Post by: GSH on January 28, 2009, 11:32:15 PM
Writing out files to C:\Program Files\Games\Battlezone II\ (or anything under program files) is going to fail, miserably, under Vista or Win7 when not run as an admin. Please don't go that route.

A very similar issue came up a few weeks ago, with another modder. (Some work does get done on irc, even if nobody else uses it.) Writing an access key to the registry (under HKEY_CURRENT_USER\...) is a way that'll work on all systems; the DLL just needs to check the access, and early-exit if the user's using the wrong thing. I put up a really small sample in the area for private testers.

-- GSH
Title: Re: DLL & AUTOREG trickery
Post by: Nielk1 on January 29, 2009, 12:00:42 AM
So we go for the 2nd option, yell at the user... :-P
Title: Re: DLL & AUTOREG trickery
Post by: TheJamsh on January 29, 2009, 07:58:14 PM
aww =[

i wanted certain recs to 'unlock' when missions were passed.

maybe a 'use after mission no = ##' entry in autoreg files =] =] =] =]
Title: Re: DLL & AUTOREG trickery
Post by: GSH on January 29, 2009, 08:17:39 PM
Autoreg are used by IA/MPI. There is not concept of mission progression in bzone.exe for IA/MPI.

-- GSH
Title: Re: DLL & AUTOREG trickery
Post by: TheJamsh on January 29, 2009, 08:29:50 PM
yeh its a shame but im sure i can work around it. if a .dll can write an autoreg file (a mission .dll BTW) then the idea can be pulled off.
Title: Re: DLL & AUTOREG trickery
Post by: Red Devil on January 29, 2009, 08:33:10 PM
TJ, just make custom maps like in SP and place your variant recyclers on them and set missions.odf to point to the maps.  That's what stock SP does.
Title: Re: DLL & AUTOREG trickery
Post by: GSH on January 29, 2009, 09:05:22 PM
Quote
yeh its a shame but im sure i can work around it. if a .dll can write an autoreg file (a mission .dll BTW) then the idea can be pulled off.

Already said so earlier this thread: that idea is full of FAIL on Vista/Win7 if BZ2 is under C:\Program Files\ . DLLs can write to the *registry* very easily, and insta-fail the mission if they don't like the access level and the chosen recy.  At that point, you're better off just manually spawning the user's recy and ignoring the chosen item.

-- GSH
Title: Re: DLL & AUTOREG trickery
Post by: TheJamsh on January 29, 2009, 09:58:53 PM
the idea is that the recy variants become available for IA & MPI when you unlock new technology in the campaign... i dont really like people being able to jump straight in. might be a bit much.

custom maps of course... could work in the same way with a custom .dll removing the 'spawn recycler' part of the code...
Title: Re: DLL & AUTOREG trickery
Post by: Red Devil on January 30, 2009, 04:20:11 AM
Hmmm....

I'm thinking that the dll could write out/modify a map's .inf file on the server with its varbs set depending on the outcome, but, as GSH says, where it writes it to would be problematic.
Title: Re: DLL & AUTOREG trickery
Post by: bigbadbogie on January 30, 2009, 04:36:43 AM
What about cfgs?

Can the dll write to those files? Because I know it can read them.
Title: Re: DLL & AUTOREG trickery
Post by: Nielk1 on January 30, 2009, 05:12:49 AM
Yes the DLL can write files.

No, it is not good for Vista.
Title: Re: DLL & AUTOREG trickery
Post by: TheJamsh on January 30, 2009, 08:52:39 PM
unless you run in Admin mode...

great. fahkin vista screring stuff up as usual
Title: Re: DLL & AUTOREG trickery
Post by: GSH on January 30, 2009, 09:00:19 PM
Stop thinking you can write files to C:\Program Files! You've lost this battle when MS decided that user's files do not belong there. I agree with them -- on all my unix boxes, I don't have write access to /usr/bin when running as me.

Instead, start thinking about all of the options I've already mentioned (hint, hint, REGISTRY) this thread. See http://msdn.microsoft.com/en-us/library/bb756940.aspx for MS's recommended places to read and write things. As it says, ${MyDocs}/My Games/Battlezone II is possible, but you MUST not hardcode that path, but use http://msdn.microsoft.com/en-us/library/bb762188(VS.85).aspx to query its path.

-- GSH
Title: Re: DLL & AUTOREG trickery
Post by: Nielk1 on January 30, 2009, 09:24:25 PM
Which would work for recorded info yes, but modifying something read by the game pre-mission is not possible. Then again, editing anything IMO is a bad idea.
Title: Re: DLL & AUTOREG trickery
Post by: TheJamsh on January 30, 2009, 10:20:44 PM
im getting really confused, but things cant be written to C, only registry, fair enough.

Niek1 understands it seems, ill get help later. i CANT code in C++ or any REAL programming code used. BZII dll scriptor is as far as i go!