Mike1072 Posted December 5, 2019 Share Posted December 5, 2019 2 hours ago, Sam. said: Is there an analog to OUTER_SET tmp = (~%prefix%~ STRING_EQUAL_CASE ~MOS~ = 1) ? 0 : 1 that uses the ternary operator but with strings instead of numbers? Something like: OUTER_TEXT_SPRINT tmp EVAL ((~%prefix%~ STRING_EQUAL_CASE ~MOS~ = 1) ? ~zero~ : ~one~) (except that doesn't work). Nope. You'd have to use an IF statement. Quote Link to comment
Sam. Posted January 15, 2021 Author Share Posted January 15, 2021 I'm looking for a function to clone all of an extended header's effects into global effects (for an item). I thought I had seen such a function posted somewhere, but I don't remember where and didn't see it here. Any suggestions? I could probably write my own, but would prefer not to reinvent the wheel if an existing solution exists. Quote Link to comment
Sam. Posted August 27, 2021 Author Share Posted August 27, 2021 When I run ACTION_DEFINE_ARRAY foo BEGIN 1 2 3 END DEFINE_ACTION_FUNCTION xyz STR_VAR foo = "" BEGIN ACTION_PHP_EACH foo AS k => v BEGIN PRINT ~%v%~ // should print 1, 2 and 3 END END LAF xyz STR_VAR foo END with the MODDER flag on, I get this warning Quote Installing [Test Array Functions] [v0.0.0] WARNING: WARNING: possible missing EVALUATE_BUFFER in [array name at $"foo"("0")] 1 WARNING: WARNING: possible missing EVALUATE_BUFFER in [array name at $"foo"("1")] 2 WARNING: WARNING: possible missing EVALUATE_BUFFER in [array name at $"foo"("2")] 3 INSTALLED WITH WARNINGS Test Array Functions but if I run ACTION_DEFINE_ARRAY bar BEGIN 1 2 3 END DEFINE_ACTION_FUNCTION xyz STR_VAR foo = "" BEGIN ACTION_PHP_EACH foo AS k => v BEGIN PRINT ~%v%~ // should print 1, 2 and 3 END END LAF xyz STR_VAR foo = bar END there are no warnings but 1 2 3 are not printed. What am I missing? Quote Link to comment
subtledoctor Posted August 28, 2021 Share Posted August 28, 2021 Did you try STR_VAR foo = EVAL ~%bar%~ END ? I mean I don’t know enough about this stuff to try plugging an array into a function. But that’s how I usually handle string variables. (Unless you’re using AUTO_EVAL_STRINGS or whatever it is?) Quote Link to comment
kjeron Posted August 28, 2021 Share Posted August 28, 2021 ACTION_PHP_EACH does not evaluate the array name, so the "bar" array is never considered. You would need to use: ACTION_PHP_EACH ~%foo%~ AS k => v BEGIN Quote Link to comment
Sam. Posted August 28, 2021 Author Share Posted August 28, 2021 Thank you both, I have gotten it working. Another question: is there a COPY_LARGE version of COPY_EXISTING? Or more to the point, is there a way to get the filesize of a biffed file too large to patch? 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.