Hey, we have forums!

Author Topic: Lua function list  (Read 14702 times)

0 Members and 1 Guest are viewing this topic.

Offline Dolphin's Cry

  • Bit Bit
  • ****
  • Posts: 61
    • View Profile
Lua function list
« on: December 11, 2007, 02:44:22 pm »
I finished the game yesterday and decided to take a look at the next big adventure: the level editor.  ;) Seeing how scripting is my best skill (my graphics skill is abysmal...), I looked for a list of Lua functions. The one in the modding guide is quite incomplete, so I searched the forum and the example moods and came up with the list below. Now, there are a lot of unclear spots in there: parameters with unclear meaning, or optional parameters I haven't seen, as well as unknown enumeration values. I hope someone (Alec?) can fill those in over time.

Note: The format is for an API file for SciTE, my favorite text editor.

Code: [Select]
animationKey(me, key)
avatar_fallOffWall()
avatar_isBursting()
avatar_isOnWall()
avatar_isRolling()
avatar_isShieldActive()
avatar_setBlockSinging(bool)
bone_alpha(bone, alpha) Set bone alpha level (opacity).
bone_getWorldPosition(bone)
bone_scale(eye, x?, y?, time?)
bone_setColor(shell, r, g, b, t)
bone_setSegs(bone, ...?)
cam_toEntity(ent) Make the camera follow ent.
castSong(index) Callback in songs.lua.
chance(?)
changeForm(form) Form can be FORM_NORMAL, ...
clearControlHint()
clearShots()
createEntity(name, str?, x, y) Returns entity ID.
createShot(name, ent, entTarget, x, y) Returns shot ID.
damage(me, attacker, bone, dmgType, dmgAmount)
debugLog(text) Output text to the console. Press ~ (tilde) to open the console.
dofile(filename) Filename is relative to the application/mod root directory.
emote(type) Type can be EMOTE_NAIJASIGH, EMOTE_NAIJAUGH, EMOTE_NAIJAWOW, ...
enterState(me, state) called after a state is entered
entity_alpha(ent, alpha) Set entities alpha level (opacity).
entity_animate(me, strAnimName, loops)
entity_addTargetPoint(ent, x, y)
entity_addVel(ent, vx, vy)
entity_clearTargetPoints(ent)
entity_clearVel(ent)
entity_color(ent, r, g, b[, time, loops, pingpong, ease])
entity_damage(ent, entAttacker, dmgAmount)
entity_disableMotionBlur(ent) See also entity_disableMotionBlut().
entity_doCollisionAvoidance(me, range)
entity_doGlint(ent, glintName, blend) glintName can be "glint". blend can be BLEND_ADD.
entity_doEntityAvoidance(me, range)
entity_doSpellAvoidance(me, range)
entity_enableMotionBlur(ent)
entity_generateCollisionMask(ent)
entity_getAnimationName(ent)
entity_getBoneByName(ent, boneName)
entity_getHealth(ent)
entity_getPosition(ent) Return two values, the x any y coordinates of entity.
entity_getRotation(ent)
entity_getScale(ent)
entity_getState(ent)
entity_getVectorToEntity(ent, entOthe)
entity_handleShotCollisions(ent)
entity_handleShotCollisionsSkeletal(ent)
entity_idle(ent)
entity_findTarget(me, range)
entity_flipToSame(ent, entToMimic)
entity_hasTarget(ent)
entity_heal(ent, amount)
entity_initSkeletal(ent, strFile)
entity_isEntityInRange(ent, entOther, range)
entity_isTargetInRange(ent, range)
entity_isState(ent, state)
entity_moveTowardsTarget(me, range)
entity_offset(ent, x, y[, time?, loop, ?])
entity_push(ent, x, y, ?)
entity_rotate(ent, angle, time, loop)
entity_rotateToVec(ent, vx, vy, time, angle_offset)
entity_rotateToVel(ent, time, angle_offset)
entity_scale(ent, x, y[, time, loops, pingpong, ease])
entity_setBounceType(ent, type) Type can be BOUNCE_REAL, ...
entity_setDamageTarget(ent, type, bool) Type can be DT_AVATAR_SHOCK, ...
entity_setDeathParticleEffect(ent, particleEffectName)
entity_setDeathScene(ent, bool)
entity_setDropChance(ent, ?, ?)
entity_setEntityType(ent, type) Type can be ET_ENEMY, ET_NEUTRAL, ...
entity_setInvincible(ent, bool)
entity_setMaxSpeed(ent, speed)
entity_setPosition(ent, x, y[, time, loops, pingpong, ease])
entity_setSegs(me, 2, 8, 0.3, 0.1, -0.018, 0, 6, 0)
entity_setState(ent, state[, delay?])
entity_setStateTime(ent, time)
entity_setTarget(ent, entTarget)
entity_setTargetPriority(ent, ?)
entity_setTargetRange(ent, range)
entity_sound(ent, soundName, frequency, fadeOut)
entity_stopInterpolating(ent)
entity_swimToNode(ent, node)
entity_touchAvatarDamage(ent, collideRradius, dmgAmount, speed, pustime, collideX, collideY)
entity_updateMovement(ent, dt) Updates the position/velocity based on movement of the entity. If this function is not called, the entity will not move (unless it is being told to move along a surface).
entity_updateCurrents(ent, dt) Takes into account currents. If this function is not called, the entity will ignore the currents.
entity_watchForPath(ent)
entity_x(ent)
entity_y(ent)
exitState(me, state) called before a state is left
fade(out, time[, r, g, b])
fadeOut(time)
fadeOutMusic(time)
getFirstEntity() Starts entity enumeration. See also getNextEntity().
getForm() Get Naija's current form.
getLastCollidePosition()
getNaija()
getNextEntity() Continues entity enmeration.
getNodeByName(name)
getStringFlag(name) See also setStringGFlag().
getWallNormal(px, py)
hitSurface(me) called when entity bumps into a wall
init(me) called when the entity is first being created
isLeftMouse()
isRightMouse()
learnSong(song)
loadMap(name)
loadSound(name)
msg(me, string, number) receives a message from another source (see entity_msg()). sometimes used by entities as a way to communicate.
musicVolume(volume, time)
node_getName(node)
node_getNearestEntity(node, name)
node_getNumEntitiesIn(node, name)
node_isEntityIn(node, ent)
node_setCursorActivation(node, bool)
node_x(node)
node_y(node)
overrideZoom(zoom[, time]) Set zoom to 0 to remove the override.
pickupGem(name)
playMusic(soundName, frequency)
playSfx(soundName, frequency)
postInit(me) called after all the entities have been created (including Naija)
savePoint(ent) Opens save game dialog.
setControlHint(text, leftButton, rightButton, middleButton, time)
setStringFlag(name, value) See also getStringGFlag().
setupEntity(me) call this in init()
setupBasicEntity(ent, texture, health, manaBallAmount, exp, money, collideRadius, initState, spriteWidth, spriteHeight, particleExplosionType, flagHitOtherEntities, updateCull)
shakeCamera(strength?, time?)
shiftWorlds(ent, old, new) Callback.
shot_setAimVector(shot, vx, vy)
spawnIngredient(name, x, y)
spawnManaBall(x, y, manaAmount)
spawnParticleEffect(name, n, y)
song(me, song)
songNote(me, note)
songNoteDone(me, note, time)
update(me, dt) main update function
updateMusic()
vector_setLength(x, y, length) Returns x and y of scaled vector.
wait(time)
wakeUp(ent) Callback.
watch(time)

By the way, the guert_mod is partially broken: learning the songs does not work.
Can you hear the dolphin's cry?

Offline Alec

  • Administrator
  • Dream Bit
  • **********
  • Posts: 2211
    • View Profile
Re: Lua function list
« Reply #1 on: December 11, 2007, 02:45:14 pm »
Nice!

Guert has a new version of his mod, but I haven't put it up yet. :)

Offline broknecho

  • Bit
  • ***
  • Posts: 42
    • View Profile
Re: Lua function list
« Reply #2 on: December 13, 2007, 02:28:13 am »
I'm going to create an intellisense for Notepadd++ for these functions.....i'll post a link when I get it done.

Offline broknecho

  • Bit
  • ***
  • Posts: 42
    • View Profile
Re: Lua function list
« Reply #3 on: December 14, 2007, 07:30:39 am »
Well this was a lot easier then I thought it would be:

1- Copy and paste the list Dolphin's Cry has made from this post into an empty text document.
2- Save the document as lua.api and place it in the following directory:
      <Notepad++ Instalation Folder>\plugins\APIs\
3- Open up a new lua script file and press ctrl+space to bring up the auto complete menu with all the Aquaria functions.

I left all the comments in so that there was a little description beside some of the functions.

Thanks Dolphin for the list  :)

Offline Dolphin's Cry

  • Bit Bit
  • ****
  • Posts: 61
    • View Profile
Re: Lua function list
« Reply #4 on: December 14, 2007, 10:23:05 am »
There is now a much more complete list in the wiki. This list contains all the functions from Burton's list as well as signature information from mine, and also some new information we learned from Alec on IRC. I haven't updated my API file with all the new stuff; my idea is to use a (Lua) script to transform the wiki source into an API file.
Can you hear the dolphin's cry?

Offline Yogoda

  • Extra Bit
  • *****
  • Posts: 144
    • View Profile
Re: Lua function list
« Reply #5 on: November 07, 2009, 03:40:36 pm »
It seems the file format for Notepad++ intellisense have changed, it is now xml.

I've made a file will all the functions from the Wiki, if someone needs :

http://aquariawiki.ryanballantyne.name/wiki/index.php/Scripting_tools

Put it in : C:\Program Files\Notepad++\plugins\APIs\lua.xml if it is where your Notepad++ is

Then in the menu preference, activate auto-completion for functions. You will have the list of functions when starting to type something.
« Last Edit: November 11, 2009, 05:12:45 pm by Yogoda »