Bartimaeus Posted May 25, 2020 Share Posted May 25, 2020 (edited) Been investigating why some summonables in SR are having scripting problems that sometimes occur and sometimes don't, and I finally discovered why: github is converting linebreaks of .bcs files to CR+LF (Windows) when BG scripts appear to use just LF (Unix), which is breaking the files. This is especially annoying because they stay with the correct linebreaks on my local system, so it seems like everything's fine on my end, but then other people who download it get broken versions. ...This is less asking for help and more warning everyone else in case anyone else gets weird, mysteriously broken scripts. Edited May 25, 2020 by Bartimaeus Quote Link to comment
Sam. Posted May 26, 2020 Share Posted May 26, 2020 6 hours ago, Bartimaeus said: Been investigating why some summonables in SR are having scripting problems that sometimes occur and sometimes don't, and I finally discovered why: github is converting linebreaks of .bcs files to CR+LF (Windows) when BG scripts appear to use just LF (Unix), which is breaking the files. This is especially annoying because they stay with the correct linebreaks on my local system, so it seems like everything's fine on my end, but then other people who download it get broken versions. ...This is less asking for help and more warning everyone else in case anyone else gets weird, mysteriously broken scripts. My solution is to add *.bcs text eol=lf *.bs text eol=lf to the .gitattributes file. Quote Link to comment
Bartimaeus Posted May 26, 2020 Author Share Posted May 26, 2020 4 minutes ago, Sam. said: My solution is to add *.bcs text eol=lf *.bs text eol=lf to the .gitattributes file. I ended up specifying "autocrlf = input" in my overall gitconfig, which converts everything to just LF instead, but that's okay and has no practical effect for BG as far as I know. Quote Link to comment
DavidW Posted May 26, 2020 Share Posted May 26, 2020 Any reason not to just include the scripts as BAF files and compile them at install time? Quote Link to comment
Bartimaeus Posted May 26, 2020 Author Share Posted May 26, 2020 Look, I just work here, okay? My entire knowledge of modding the Infinity Engine games is based on seeing how the mods I'm interested in tweaking do things and learning from there. IR and SR are the mods I've messed around with the most, and they're both pretty low-tech weidu-wise for the most part, so that's kind of where I'm at (...and most likely where I will stay, since coding is neither my forte, what I enjoy, or my career). SR uses pre-compiled .bcs files for its summonables, so that's what I was editing, haha. Quote Link to comment
Mike1072 Posted May 26, 2020 Share Posted May 26, 2020 4 hours ago, DavidW said: Any reason not to just include the scripts as BAF files and compile them at install time? I don't think there was any particular reason they were stored as .bcs files. Demi probably got them in that format or created them in NI and copied them out of the override once they were working. They could easily be decompiled into .baf files using NI or WeiDU. 6 hours ago, Sam. said: My solution is to add *.bcs text eol=lf *.bs text eol=lf to the .gitattributes file. In my most recent .gitattributes (not yet published as best practices), I have .bcs files set as binary. Diffs for the format aren't super useful, because it isn't really human readable, and I prefer that git not try to merge changes to them as though they were text. I expect setting them as binary prevents the line endings being changed when pushed to GitHub. Quote Link to comment
Guest Piquero Posted May 26, 2020 Share Posted May 26, 2020 Is that the reason the summoned planetars were doing shit? Quote Link to comment
lynx Posted May 26, 2020 Share Posted May 26, 2020 Oh, indeed, file reports them as plaintext. No magic at the front, I guess. Github has nothing to do with it, it's all git. Mike: you can have external diff tools, eg. in this case to get bcs decompiled and then that gets diffed instead. ielister works fine for that (search for iediff), though bcs is not particularly common as a "source". Quote Link to comment
DavidW Posted May 26, 2020 Share Posted May 26, 2020 15 hours ago, Bartimaeus said: Look, I just work here, okay? My entire knowledge of modding the Infinity Engine games is based on seeing how the mods I'm interested in tweaking do things and learning from there. IR and SR are the mods I've messed around with the most, and they're both pretty low-tech weidu-wise for the most part, so that's kind of where I'm at (...and most likely where I will stay, since coding is neither my forte, what I enjoy, or my career). SR uses pre-compiled .bcs files for its summonables, so that's what I was editing, haha. Fair enough! But if you want the low-tech way to implement my suggestion: - open the script in near infinity - copy-paste it into a textfile, and name it myscript.baf, and put it in mymod/myscripts - include COMPILE "mymod/myscripts/myscript.baf" in your weidu I in turn find Git completely incomprehensible, so I have no idea whether that's easier or harder than persuading git to handle baf files correctly. Quote Link to comment
Bartimaeus Posted May 26, 2020 Author Share Posted May 26, 2020 3 hours ago, DavidW said: Fair enough! But if you want the low-tech way to implement my suggestion: - open the script in near infinity - copy-paste it into a textfile, and name it myscript.baf, and put it in mymod/myscripts - include COMPILE "mymod/myscripts/myscript.baf" in your weidu I in turn find Git completely incomprehensible, so I have no idea whether that's easier or harder than persuading git to handle baf files correctly. Thanks, sounds pretty simple. Though...what're the benefits of doing it this way, github issues notwithstanding? What's the fundamental benefit of compiling the script at install rather than having it pre-compiled? Quote Link to comment
subtledoctor Posted May 26, 2020 Share Posted May 26, 2020 2 minutes ago, Bartimaeus said: What's the fundamental benefit of compiling the script at install rather than having it pre-compiled Among other things, it can be edited with a text editor instead of needing something like NI/DLTCEP. Very human-readable and easy to deal with. Quote Link to comment
DavidW Posted May 26, 2020 Share Posted May 26, 2020 Human-readability of the file, basically. If you compile at install time, you can tweak or debug just by editing the text file; if you precompile, editing the script requires you to open it in. Ear Infinity or similar. Also, if you want to include new text strings, compiling at install time is pretty much required. Quote Link to comment
Bartimaeus Posted May 26, 2020 Author Share Posted May 26, 2020 (edited) That all makes sense, thank you! 14 hours ago, Guest Piquero said: Is that the reason the summoned planetars were doing shit? Yes. Bizarrely, it was also causing my modified wyvern scripts to attack their summoners, among a few other things. Not really sure how the game was interpreting the wrong linebreak scripts, but it was clearly not correctly. Edited May 26, 2020 by Bartimaeus Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.