Author Topic: Bernd Liefert --- The game I'm working on. (yeah this is an old topic)  (Read 2445 times)

Its how the lua functions know what robot is sending them.
So all robots share global state?

So all robots share global state?
Yes, not the best way, but it dosent cause problems.

Hopefully if I have time ill fix and upload it tonight.

link added because I fixed the memory leaks and it seems to preform well
even though it's barly started

Download link seems down. Nvm, just really slow.
« Last Edit: January 11, 2013, 04:58:21 PM by DontCare4Free »


Last bump for the day, but ill update it tomarrow.

consider using moonscript? it's an extension of Lua, while being like a weird python/ruby/lua hybrid. seems like something a lot of people would like.

also, with the AI script you posted on the front page, you could just throw all of the comments at the top in a block comment

--[[
example ai file

Command dump:

Action commands:
fire(robotID)
jump(robotID)
fall(robotID)
stop(robotID)
moveRight(robotID)
moveLeft(robotID)

Status commands:
getRuntime()
getHealth(robotID)
getPosX(robotID)
getPosY(robotID)
getVelX(robotID)
getVelY(robotID)
getTile(x,y)
getPlayerX()
getPlayerY()

Other:
echo(message)
setRobotVar(robotID,variableName,variableValue)
getRobotVar(robotID,variableName)

The script below will only fire if the player is close enough.
It will also change directions to face the player.
]]

playerx = getPlayerX()
playery = getPlayerY()
botx = getPosX(robotID)
boty = getPosY(robotID)

distancex = math.abs(playerx-botx)
distancey = math.abs(playery-boty)

totaldistance = distancex+distancey

if totaldistance < 500 then
 fire(robotID)
end

if playerx > botx then
 moveRight(robotID)
else
moveLeft(robotID)
 end
stop(robotID)

consider using moonscript? it's an extension of Lua, while being like a weird python/ruby/lua hybrid. seems like something a lot of people would like.

also, with the AI script you posted on the front page, you could just throw all of the comments at the top in a block comment

--[[
example ai file

Command dump:

Action commands:
fire(robotID)
jump(robotID)
fall(robotID)
stop(robotID)
moveRight(robotID)
moveLeft(robotID)

Status commands:
getRuntime()
getHealth(robotID)
getPosX(robotID)
getPosY(robotID)
getVelX(robotID)
getVelY(robotID)
getTile(x,y)
getPlayerX()
getPlayerY()

Other:
echo(message)
setRobotVar(robotID,variableName,variableValue)
getRobotVar(robotID,variableName)

The script below will only fire if the player is close enough.
It will also change directions to face the player.
]]

playerx = getPlayerX()
playery = getPlayerY()
botx = getPosX(robotID)
boty = getPosY(robotID)

distancex = math.abs(playerx-botx)
distancey = math.abs(playery-boty)

totaldistance = distancex+distancey

if totaldistance < 500 then
 fire(robotID)
end

if playerx > botx then
 moveRight(robotID)
else
moveLeft(robotID)
 end
stop(robotID)

Funny how nobody can really decide on the block comment syntax for "--"-comments. SQL (other than T-SQL) doesn't seem to support any blocks, Haskell uses  {- ... -}, and lua uses --[[ ... ]]. Any other versions?

Funny how nobody can really decide on the block comment syntax for "--"-comments. SQL (other than T-SQL) doesn't seem to support any blocks, Haskell uses  {- ... -}, and lua uses --[[ ... ]]. Any other versions?
/*
comment here
*/
for c++

consider using moonscript? it's an extension of Lua, while being like a weird python/ruby/lua hybrid. seems like something a lot of people would like.
Does it have a C++ libary?

Funny how nobody can really decide on the block comment syntax for "--"-comments. SQL (other than T-SQL) doesn't seem to support any blocks, Haskell uses  {- ... -}, and lua uses --[[ ... ]]. Any other versions?
i think python uses """ """

Does it have a C++ libary?
correct me if i'm wrong, but i think it was made with lua, so it would need a lua library if anything

EDIT: looking at the source, at some point it seems as though he started developing moonscript with moonscript

dafuq

EDIT2: i think he just compiled all of the lua to moonscript, so you could use the moonscript library within moonscript. makes sense.
« Last Edit: January 11, 2013, 06:41:17 PM by Kingdaro »

/*
comment here
*/
for c++
I was talking specifically about the languages that insist on using "--" to delimit comments.

Does it have a C++ libary?
Pretty sure you'd just load it through an extra lua library on the lua "side".

i think python uses """ """
Python doesn't have any real block comments either, that's the syntax for multi-line strings.

Python doesn't have any real block comments either, that's the syntax for multi-line strings.
codeacademy lied to me then :C

EDIT: looking at the source, at some point it seems as though he started developing moonscript with moonscript

dafuq
Actually a pretty common thing to do, it's called self-hosted languages. Scala does this too (at least partially), as well as CoffeeScript. There was a project to do this for C# too, although I don't think it's actually used in VS (yet).

codeacademy lied to me then :C
That said, literals as lone statements in Python are no-ops, so for all intents and purposes they behave like multi-line comments, EXCEPT for if they're the first thing at the start of a new function/class (in which case they're something called "docstrings" which means that they're stored in __doc__ for the object).

EXCEPT for if they're the first thing at the start of a new function/class (in which case they're something called "docstrings" which means that they're stored in __doc__ for the object).
that is something codeacademy taught me, yes.