Jump to content

Github Is Breaking My Creature Scripts


Recommended Posts

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 by Bartimaeus
Link to comment
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.

Link to comment
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.

Link to comment

Look, I just work here, okay? :p

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.

Link to comment
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.

Link to comment

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".

Link to comment
15 hours ago, Bartimaeus said:

Look, I just work here, okay? :p

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.

Link to comment
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?

Link to comment

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.

 

Link to comment

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 by Bartimaeus
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...