LunaLua global functions
Jump to navigation
Jump to search
| Global Functions | ||
|---|---|---|
| Function | Return values | Description |
| windowDebug(string debugText) | nil | Writes debugText in a message box and shows it to the user. |
| printText(string text, int x, int y) | nil | Prints text at x, y with font-type 3 |
| printText(string text, int type, int x, int y) | nil | Prints text at x, y with font-type type |
| totalNPC() | int | Returns the number of npcs. |
| npcs() | table of NPC | Returns a array of all NPCs. |
| findnpcs(int ID, string section) | table of NPC | Searches all npcs by ID and Section. Use -1 as a parameter to ingore the given filter. |
| mem(int address, int fieldtype, object value) | nil | Sets the memory of the given type. |
| mem(int address, int fieldtype) | object | Returns the value of the given address of the given type. |
| triggerEvent(string eventName) | nil | Triggers a event by the given name |
| playSFX(int index) | nil | Plays a SMBX Sound by the SMBX Sound ID |
| playSFX(string filename) | nil | Plays a Soundfile (supports WAV only) |
| playSFXSDL(string filename) | nil | Plays a Soundfile via SDL2_mixer (supports WAV, OGG, FLAC, AIFF, VOC) |
| clearSFXBuffer() | nil | Clear SFX buffer and stop all custom sounds which playing via SDL2_mixer |
| playMusic(int section) | nil | Plays the music, which is set by the given section id |
| MusicOpen(string filename) | nil | Loads the custom music file into stream of SDL2_mixer. Current music playback will be halted. Note: to get playback of custom music file in current section, default music should be switched into "none"! |
| MusicPlay() | nil | Plays current file in the music stream of SDL2_mixer. Note: Don't forget open custom track with MusicOpen() function! |
| MusicPlayFadeIn(int milliseconds) | nil | Plays current file in the music stream with fade-IN effect via SDL2_mixer with length in milliseconds |
| MusicStop() | nil | Stops playback of current music stream of SDL2_mixer. |
| MusicStopFadeOut(int milliseconds) | nil | Stops playback of current music stream of SDL2_mixer with fade-out effect with length in milliseconds. |
| MusicVolume(int volume) | nil | Sets current volume level (from 0 to 128) for music stream of SDL2_mixer |
| loadHitboxes(int characterId, int powerUpId, string iniFilename) | nil | Loads the hitbox settings for specific player and it's power-up state from INI file made by Special Calibration tool. Note: GFX-offsets of each frame is overwriting yet. Use image calibration to calibrate position of frame without editing of GFX offsets. |
| loadImage(string filename, int resourceNumber, int transparentColor) | nil | Loads a image in the resource memory at resourceNumber. You can also set the transparent Color. |
| placeSprite(int type, int imgResource, int xPos, int yPos) | nil | Places a sprite from the resource memory and places it at xPos, yPos |
| placeSprite(int type, int imgResource, int xPos, int yPos, string extra) | nil | Places a sprite from the resource memory and places it at xPos, yPos. |
| placeSprite(int type, int imgResource, int xPos, int yPos, string extra, int time) | nil | Places a sprite from the resource memory and places it at xPos, yPos. |
| gravity() | int | Returns the current gravity. |
| gravity(int value) | nil | Sets the current gravity. |
| earthquake() | int | Returns the current earthquake factor. |
| earthquake(int value) | nil | Sets the current earthquake factor. Slowly returns to 0! |
| jumpheight() | int | Returns the current jumpheight factor of all players. |
| jumpheight(int value) | nil | Sets the current jumpheight factor of all players. |
| jumpheightBounce() | int | Returns the current jumpheight factor (when bounced of a enemy) of all players. |
| jumpheightBounce(int value) | nil | Sets the current jumpheight factor (when bounced of a enemy) of all players. |
| blocks() | table of Block | Returns all blocks |
| findblocks(int ID) | table of Block | Returns all blocks with the specific id. |
| npcToCoins() | nil | Converts every npc on screen to coins. (Like you would hit the exit.) |
| animations() | table of Animation | Returns all running animations. |
| exitLevel() | nil | Exit the level. |
| winState() | int | Returns the current state of hitting the goal. If currently not winning then this value is 0. |
| winState(int value) | nil | Sets the current state of hitting the goal. If currently not winning then this value is 0. |
| runAnimation(int id, double x, double y, int extraData) | nil | Runs a effect/animation by id. The parameter extraData should be 0, 1 or 1065353216 (you have to try out). |
| runAnimation(int id, double x, double y, double height, double width, int extraData) | nil | Runs a effect/animation by id. The parameter extraData should be 0, 1 or 1065353216 (you have to try out). |
| runAnimation(int id, double x, double y, double height, double width, double speedX, double speedY, int extraData) | nil | Runs a effect/animation by id. The parameter extraData should be 0, 1 or 1065353216 (you have to try out). |
| getInput() | VBStr | Get the cheat text buffer |
| hud(boolean showHud) | nil | Toggels the hud on/off |
The UserData-Namespace gives your access to the variable bank. With variable bank you can save number-values for other levels and when the game closes.
| Global Functions [UserData Namespace] | ||
|---|---|---|
| Function | Return values | Description |
| UserData.setValue(string key, number value) | nil | Sets a number-value by a specfic key. |
| UserData.getValue(string key) | number or nil | Gets a number-value by a specfic key. If value is not set then nil is returned. |
| UserData.isValueSet(string key) | boolean | If value is not set then false is returned. Otherwise true. |
| UserData.values() | table with key=string value=number | Returns a table with all mapped values of the variable bank. |
| UserData.save() | nil | Writes all the data in the variable txt-file. |