Git Product home page Git Product logo

epscript's People

Contributors

phu54321 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

epscript's Issues

Reduce overuse of DoActions in basic actions

function afterTriggerExec() {
  while(Bring(P1, AtLeast, 1, "Zerg Drone", "Anywhere")) {
    MoveLocation("loc", "Zerg Drone", P1, "Anywhere");
    RemoveUnitAt(1, "Zerg Drone", "loc", P1);
    CreateUnit(1, "Zerg Mutalisk", "loc", P1);
  }
}

/* __epspy__ makes 3 Triggers for 3 actions, 2 objects are wasted.
def afterTriggerExec():
  if EUDWhile()(Bring(P1, AtLeast, 1, "Zerg Drone", "Anywhere")):
    DoActions(MoveLocation("loc", "Zerg Drone", P1, "Anywhere"))
    DoActions(RemoveUnitAt(1, "Zerg Drone", "loc", P1))
    DoActions(CreateUnit(1, "Zerg Mutalisk", "loc", P1))
  EUDEndWhile()
*/

It should use 1 DoActions in a series of actions for performance and map file size.

Assigning constant value to a module variable from another module makes variable 'int'.

example code)

main.eps

import module;

function afterTriggerExec() {
    module.a = 1;
    module.main();
    py_print(module.a, py_type(module.a));
}

module.eps

var a = 1;

function main() {
    var b = 0;
    a = b;
}

1 <class 'int'>
File "main.eps", line 5, in afterTriggerExec
module.main();
File "module.eps", line 5, in f_main
a = b;
TypeError: unsupported operand type(s) for <<: 'int' and 'EUDVariable'

It raises TypeError, but when module.main(); is called before module.a = 1;, the compile is successful and module.a is still an 'int', causing unexpected behavior.

import module;

function afterTriggerExec() {
    module.main();
    module.a = 1;
    py_print(module.a, py_type(module.a));
}

1 <class 'int'>
[Stage 1/3] CollectObjects
- Collected 681 / 681 objects
[Stage 2/3] AllocObjects
- Preprocessed 681 / 681 objects
- Allocating objects..
[Stage 3/3] ConstructPayload
- Written 681 / 681 objects
Output scenario.chk : 0.909MB
Done!

/= doesn't work on EUDArray, while *= do

function afterTriggerExec()
{
    const a = EUDArray(8);
    a[0] *= 2;
    a[1] /= 2;
}
/*
line 5, in afterTriggerExec
    a[1] /= 2;
AttributeError: '_ARRW' object has no attribute '__ifloordiv__'
*/

In TriggerEditor of EUD Editor 2, P variable is EUDArray with length 8. Action SetVariable uses +=, -=, *=, /= for arithmetic.

Not issue an error on missing semicolon/parentheses after if.

Copied from phu54321/euddraft#14

function afterTriggerExec() {
    var a;
    if(a == 0) {
        a++;
    }
    dbstr_print("lol"
    dbstr_print("lol")
}
/*Saving to example.scx...
 *[Stage 1/3] CollectObjects
 * - Collected 2028 / 2028 objects
 *[Stage 2/3] AllocObjects
 * - Preprocessed 2028 / 2028 objects
 * - Allocating objects..
 *[Stage 3/3] ConstructPayload
 * - Written 2028 / 2028 objects
 *Output scenario.chk : 1.357MB
 *Writing trace file to example.scx.epmap
 *Done!
 */

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.