SCRMaps
/
Sign in

The plugins worth knowing

Before writing it, check whether it already exists.

10 min read

euddraft ships with a number of plugins, and the things people commonly need are usually already there. Spending days writing something that was one line in the eds file happens more often than you would think.

The ones you will use
eudTurboCuts the trigger polling interval. Nearly every EUD map uses it.
unitlooperWalks the units for you.
customTextMakes the on-screen text easier to handle.
MSQCThe mouse and screen side - what a clickable menu is built on.
dataDumperLoads a file to a memory address - how a custom AI or a replaced tbl gets in.
freezeMap protection.
bgmplayerLoops background music for you - a path and a length in seconds, and that is the whole configuration.
cammoveMakes the camera follow a location you move, with inertia and a maximum speed.
noAirCollisionStops air units pushing each other apart - effectively required for anything bullet-hell shaped.
unlimiterRaises the sprite, image, bullet and order limits. The 1,700 units and the 500 placed sprites do not move.
chatEventRecognises what a player types in chat. Pair a message with a number and that number lands at an address you name the moment someone types it.

Listing a plugin in the eds and using it in code are two different things. A bracketed line puts the plugin in the map and runs it every cycle; calling its functions from your script needs an import. The modules themselves are the *.py files in euddraft's lib folder.

import unitlooper;            // unitlooper 라는 이름 그대로
import unitlooper as ul;      // ul 이라는 짧은 이름으로

function beforeTriggerExec() {
    foreach(ptr, epd : EUDLoopNewUnit()) {
        // 이번 사이클에 새로 생긴 유닛마다 한 번 / once per unit created this cycle
    }
}
After the import you call through the module name. The iterator over units created this cycle is eudplib's own EUDLoopNewUnit(allowance=2); the plugin has a similarly named function of its own, and a shared name does not mean a shared signature - check the one you are calling.

Libraries ship alongside the plugins. Open the folder before building something: the thing you are about to write is often already there.

chatEvent needs a little more explanation. It is what you use to give a map commands, and the configuration is the command list.

[chatEvent]
__addr__          : 값이 들어올 주소 / where the matched value lands
__lenaddr__       : (선택) 메시지 길이
__ptraddr__       : (선택) 메시지 포인터
__patternaddr__   : (선택) 몇 번 패턴이 맞았는지

-start            : 2
^give .* to .*$   : 5
An exact message is up to 78 bytes and its value must be greater than 1. A pattern starts with ^, ends with $, contains exactly two .*, and its value only has to be greater than 0.

Matching is done by hash, so adding more commands does not make it slower - it is not comparing strings one by one every cycle.

The libraries that ship with it
soundlooperPlays music cut into pieces as a loop. It reads each piece's real length out of the Ogg header, so nothing has to be timed by hand - the first piece is the intro, the last the bridge, and you choose where it loops back to.
drawDraws circles, regular polygons, stars, polygons and lines out of dots. Inside it is the Scanner Sweep technique, and a spreading ring is a change of radius rather than new code.
The unit iterators
EUDLoopUnit()Follows the unit list, so it runs once per living unit.
EUDLoopUnit2() · EUDLoopCUnit()Walks all 1700 slots instead of following the list. The official note says "slightly faster", and measured with epTrace it is not that simple: around 24 at some 30 units, rising to 97 past 500. The same work through a UnitGroup measures 10 and then 9 - essentially flat. On anything that runs every cycle, reach for a UnitGroup rather than an iterator.
EUDLoopPlayerUnit(p) · EUDLoopPlayerCUnit(p)Only that player's units.
EUDLoopNewUnit(n) · EUDLoopNewCUnit(n)Only the units created this cycle. The argument means "stop after this many consecutive already-known units" and defaults to 2 - raise it in a system that creates several units a cycle, or it misses some.
EUDLoopList(header, break?)Walks any doubly linked list - sprites, images and bullets have the same shape.
EUDLoopRange(start, end?) · EUDLoopN()A numeric range at run time, as opposed to the foreach that unrolls at compile time.

customText does the one thing DisplayText cannot: print a string with values mixed into it. A short line goes through print; a long one whose pieces depend on conditions is built in a buffer and sent once.

import customText as ct;

ct.print("\x04마린 데스값: \x06", dwread_epd(0));   // 값과 문자열을 섞어서

ct.makeText("\x04현재 자원: ");                     // 버퍼를 시작하고
ct.addText("\x1F미네랄 ", ore);                     // 조건마다 덧붙인 다음
ct.displayText();                                  // 한 번에 출력
print, printP and printAll send at once; makeText, addText and displayText build a line and then send it.

Adding a plugin means thinking about the order in the eds, because that is the load order. A plugin that writes to the screen, listed after your script, draws over what you drew.

The eds file