Git Product home page Git Product logo

redefine's People

Contributors

wipe2238 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

hk47196

redefine's Issues

Strings inside literals

I got this diff

--- scripts_pre/dcanna.ssl	2020-04-04 21:15:45.076130402 +0700
+++ scripts_post/dcanna.ssl	2020-04-04 21:15:49.164016004 +0700
@@ -159,7 +159,7 @@
 	else begin
 		if (obj_is_carrying_obj_pid(self_obj, 252) > 0) then begin
 			debug_msg("dcanna" + ": " + "setting DESTROY_ANNA" + "\n");
-			debug_msg("dcanna" + ": " + " obj_is_carrying_obj_pid(self_obj, PID_ANNA_GOLD_LOCKET) == " + obj_is_carrying_obj_pid(self_obj, 252) + "\n");
+			debug_msg("dcanna" + ": " + " self_item_count(PID_ANNA_GOLD_LOCKET) == " + obj_is_carrying_obj_pid(self_obj, 252) + "\n");
 			debug_msg("dcanna" + ": " + "SETTING DESTROY ANNA" + "\n");
 			set_local_var(4, local_var(4) bwor 512);
 		end

As you can see, ReDefine processed the define inside string. It's harmless, but probably unwanted?

How to use ReDefine

Hi. I couldn't find a separate repo for ReDefine, so I guess this is the only place where I can ask...

I'd like to try ReDefine for UP/RP, in order to reduce code volume further. As far I understand, it automatically processes headers, and replaces what's possible. That looks nice, but I have a few questions (and that's just getting started):

  1. It appears that it does some sort of autoformat. Is it possible to do that separately? Unified code style is good, but I'll like to be able to inspect actual code change, and including whitespace just shows that the whole file is different.
  2. How safe is it? In terms of silently doing a wrong thing which then gets compiled and shipped?
  3. Why multiple macros are specified expllicitly in the config? Does it replace only those specified?
  4. What do I to with this, for example:
    WARNING (IfArgumentIs) function<critter_add_trait> must be added to configuration before using this action : fileline<arroyo\acbrahmn.ssl:128> :: critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_TEAM_NUM,TEAM_ARROYO);
  5. Reasonably, if run on UP/RP codebase without any changes, how well do you think it'll work? What would probably need adjustment/tailoring?

ref BGforgeNet/Fallout2_Unofficial_Patch#33

Docs

  • tldreadme.md
  • command line
  • main config
  • standard replacements (defines/variables/functions)
  • script actions: basics
  • script actions: chaining (timing/priority)
  • script actions: custom
  • examples: simple
  • examples: fancy

Support negating conditions results

To avoid duplicating conditions code (IfEdited+IfNotEdited, IfArgumentValue+IfArgumentNotValue, etc.), it should be possible to add ! before condition name to negate its result.

# Force scripts to use `bwand` instead of `==` when checking if player on worldmap
# get_game_mode ??? WORLDMAP -> get_game_mode bwand WORLDMAP
GetGameModeFix = RunAfter IfVariable:get_game_mode !IfOperatorName:BitwiseAnd IfOperatorValue:WORLDMAP DoOperatorSet:bwand,WORLDMAP

Currently all condition functions returns either true or false, and there is no way to distinguish between failed check or any kind of error (wrong number of If arguments, trying to check arguments when script code part is variable, etc).

Drop [*OPERATOR] config entries

It was fine at start (especially in perl version), now it's simply annoying and clutters config

[Function] should accept following versions:

  • my_func = ARG0_TYPE ? ARG2_TYPE (current)
  • my_func - [RETURN_TYPE] ? ARG1_TYPE
  • my_func = [RETURN_TYPE]

[Variable] should simply accept:

  • my_var = TYPE

Edits:

  • IfReturnType:TYPE
  • DoReturnSetType:TYPE or DoReturnType:TYPE

SCRIPT_FORMAT_UNCHANGED bugs/glitches

  • When 2nd+ argument becomes 1st, it keeps leading whitespace which is it's most likely unwanted. Leading spacing used in original 1st argument should be probably cached and applied in following scenario.
@@ -272,8 +272,8 @@
 end
 procedure Node2217a begin
    if ((item_caps_total(dude_obj)) >= 100) then begin
-      item_caps_adjust(dude_obj, -100);
-      item_caps_adjust(self_obj, 100);
+      dude_caps_adjust( -100);
+      self_caps_adjust( 100);
       critter_heal(dude_obj, -((get_critter_stat(dude_obj,(35))) - (get_critter_stat(dude_obj,(7)))));
       call Node022;
    end else begin
  • Moving argument to end gives ugly results as well
3:1 = RunAfter IfFileName:0301.ssl IfFunction:f DoArgumentsMoveBack:0
@@ : fileline<0301.ssl:1>
<- f(a, b, c);
-> f(b, c,a);

#6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.