Jump to content

Maximum SDF value?


Handyman

Recommended Posts

You're right. I found the SDF range in the BoA editor documentation appendix:

 

Quote:
void inc_flag(short a,short b,short how_much) - Changes SDF(a,B) by how_much (which can be negative). Note the legal range of values for a flag is 0..255.

I was probably thinking of the original (shareware) version of BoE, where certain special one-shot encounters could set an SDF to 250. Though those SDFs probably had a range of 0-255 too; the original BoE scenario editor documentation doesn't say.

Link to comment
Share on other sites

Indeed, but it takes a bit of care. (The linked to method actually stores signed 16-bit numbers, rather than unsigned, since Avernumscript only has signed int variables.) One could implement arbitrary precision arithmetic if one really wanted to, I think, but I can't imagine it being at all practical.

Link to comment
Share on other sites

Originally Posted By: Niemand
That would be silly, since 2^8-1 = 255, and to my knowledge Jeff enforces no such silliness.
Still need to be careful, there are some odd gotchas in BoA. For instance, one usually assumes that strings in scripting languages based on C can be 255 characters long (not including the null character). But in BoA, they can only be 254 characters (been a while since I tested this, but I'm pretty sure it's true, despite documentation saying otherwise).
Link to comment
Share on other sites

Yes, but in this case I know with good certainty that SDFs work sensibly. (As I noted, it wouldn't have been totally surprising if Jeff had done something odd here, but he didn't.)

 

You are correct about the maximum string length. I really don't quite know what Jeff was thinking here, particularly since, in a rare fit of modernity, he doesn't put the strings into fixed sized buffers anyway. (In fact, he even uses operator new[] to allocate the buffers, rather than direct malloc![^1]) It's possible that the limitation to 254 characters stems from mistakenly writing >=255 (when checking for disallowed lengths), rather than just >255. Another possibility is that he had the number 255 in mind rather that 256 as the base as a result of having to deal with Pascal strings.

 

[^1]: For anyone curious, there's enough of the script system left in the editor in global.h and EdParser.cpp to see how a lot of it works. The implementation is actually complete enough to run simple scripts that only do arithmetic and flow control.

Link to comment
Share on other sites

I think we eventually came to the conclusion that 254 was the result of having 256 characters but having "begin" and "end" be two of the characters. (The open quotes and close quotes actually count as characters, so "Run!" would be six characters, not four.)

 

Would explain the otherwise arbitrary 38 on the text bubbles (was actually 40, but includes the quotes).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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