If you start a server and join, you can use the print() function to output stuff to the server console. In groundMonster.lua, in function init(), I put in the following code at the end of the function: print("----------START---------") for key,value in pairs(entity) do print (key,value) end print("******END*******") This will print a list for each ground monster initialized, which represents a table of their functions. You can use this to help determine what functions you can call on an entity in lua. There probably more than that, but this is what I found so far. You can also just save and exit and then re-start up your character to reload lua scripts after you modify them. It's a little faster than restarting the game each time. Please add if you've found any more tricks about the lua API for StarBound. moveRight function: 36B33438 setActiveSkillName function: 36B27BD0 staticRandomizeSkillParameter function: 36B350A8 setGravityEnabled function: 36B2A988 currentRotationAngle function: 36B344D8 holdJump function: 36B2DE08 onGround function: 36B36A08 moveLeft function: 36B33630 setFacingDirection function: 36B33080 randomizeParameterRange function: 36B313A0 projectileConfigParameter function: 36B2FB90 setAggressive function: 36B34DD0 facingDirection function: 36B35038 heal function: 36B34270 health function: 36B36ED8 closestItemDrop function: 36B31F38 baseHealth function: 36B2D778 stateNudge function: 36B2A790 isFiring function: 36B37140 currentScale function: 36B34008 setFlipped function: 36B2DF20 isValidTarget function: 36B2E690 setRunning function: 36B33748 setDamageOnTouch function: 36B33710 randomizeSkillParameter function: 36B35428 jump function: 36B36FF0 playSound function: 36B357E0 velocity function: 36B341C8 readyToFire function: 36B357A8 animationStateProperty function: 36B2A6B0 setDeathParticleBurst function: 36B30E28 closestValidTarget function: 36B354D0 moveDown function: 36B360A0 skillConfigParameter function: 36B31170 animationState function: 36B33AC8 dt function: 36B31E90 id function: 36B308E8 setParticleEmitterActive function: 36B329F0 setAnimationState function: 36B31758 playImmediateSound function: 36B30878 fly function: 36B34890 setDeathSound function: 36B334E0 setEffectActive function: 36B35D20 staticRandomizeParameter function: 36B31288 startFiring function: 36B35930 level function: 36B30920 rotateGroup function: 36B369D0 burstParticleEmitter function: 36B2FD18 setFireDirection function: 36B34BD8 anchorPoint function: 36B2ED20 stunned function: 36B345B8 stopFiring function: 36B34F90 configParameter function: 36B35380 setPartTag function: 36B320F8 toAbsolutePosition function: 36B34F20 setGlobalTag function: 36B30F78 distanceToEntity function: 36B30060 randomizeParameter function: 36B312C0 position function: 36B35C78 flyTo function: 36B36688 flySpeed function: 36B33320 randomizeSkillParameterRange function: 36B2FDC0 setVelocity function: 36B30808 entityInSight function: 36B35D90 scaleGroup function: 36B31918 ******END*******
Good info on print(). I'm going to experiment by printing LightLevel, temperature, timeOfDay, and see what values I get from them. I'm trying to make a test tech
Here's a list of the 'world' functions. isMonster function: 3F82C8F0 itemType function: 3F8287C0 entityExists function: 3F82C538 breathable function: 3F82CC38 material function: 3F82CEA0 npcLineQuery function: 3F82C768 spawnMonster function: 3F828670 spawnProjectile function: 3F8286E0 debugLine function: 3F82AE08 liquidAt function: 3F828638 objectLineQuery function: 3F82C730 objectQuery function: 3F82C810 lineCollision function: 3F828590 day function: 3F828558 isNpc function: 3F82CB90 distance function: 3F82CF10 entityName function: 3F82C618 callScriptedEntity function: 3F82C6F8 entityHandItem function: 3F82C6C0 spawnNpc function: 3F8286A8 entityPosition function: 3F82AEE8 entityHealth function: 3F82D5D8 entitySpecies function: 3F82C650 isVisibleToPlayer function: 3F828520 debugPoint function: 3F82D5A0 loungableQuery function: 3F82AE78 time function: 3F828718 collisionBlocksAlongLine function: 3F8287F8 rectCollision function: 3F8284B0 pointCollision function: 3F8285C8 timeOfDay function: 3F828788 monsterQuery function: 3F82ADD0 npcQuery function: 3F82AF20 playerQuery function: 3F82C570 magnitude function: 3F82CF48 underground function: 3F82CDF8 temperature function: 3F827870 entityLineQuery function: 3F82C7D8 windLevel function: 3F8284E8 mod function: 3F82CED8 entityQuery function: 3F82AF58 logInfo function: 3F826840 debugText function: 3F82D530 lightLevel function: 3F828600 loungableOccupied function: 3F82C5A8
I'm having problems viewing printed things in the server console. I have the following code in a function update(args) in a tech: light = world.lightLevel print(light) But I don't see anything being printed in the server console. I see myself joining and quitting, but nothing else. I've also tried print("test") to no avail. Any ideas?
Most of this is already here: http://community.playstarbound.com/...api-exposed-sort-of.41408/page-2#post-1447543 and https://gist.github.com/severedskullz/7884279
The script has to be running. I put in in humanMech, and the script causes you to fire your guns, so I know I'm inside. Dumb question, but the server console is the cmd window that pops up when you click Launch Starbound Server, correct?
Yeah that's the server console. Edit: Sorry didn't read your post very clearly. Not sure why it's not printing at the moment.
Yes, mech.lua, located in assets/tech/mech. I inserted some random non-code words and Starbound crashed, so I know it's looking inside. Now I'm experimenting with making my character say something in a speech bubble.
If you're putting non-code in there, it could crash as the file is being interpreted, meaning that it will crash even without running. It can also give errors the syntax is correct, but you're trying to do something illegal (like trying to access a nil object property), which only happens if the code runs. So I'm not sure if that validates that the code is running. I assume it is, but it's odd that print isn't working. You can try the print command in the monster AI code, in the init function like I did and see if it prints from there. Then you'll at least know you can print.
I tried lightLevel but just get this: Code: Error: Exception while invoking lua method 'onInteraction'. LuaException: [string "/objects/myscripts/mybeacon.lua"]:9: OutOfRange: Out of range, index: 0
Can you paste what code you put in there? Lua indexes start at 1, maybe 0 index means it couldn't find the property or function.
Success! I put in your code in groundMonster.lua and everything printed great! So I tried out light level: light = world.lightLevel print("Light = ") print(light) In the console it printed hexidecimal numbers (I'm assuming). On the surface in day it printed 3C3557D8. When I jumped down a black hole it read 415DAEFO. I wish the script kept iterating as I'd like more data as I jumped in. edit: There must be something about function update(args) in techs that disallows printing, or something...
That appears to be the function address, not the lightLevel value. If you attach it to a monster, it'll give different values for each monster.