Scripting cheat sheet
Scripting cheat sheet
Hi,
I made a cheat sheet for LoG scripting:
https://sites.google.com/site/jkosgrimr ... heat-sheet
I think it could be useful to someone else too.
I made a cheat sheet for LoG scripting:
https://sites.google.com/site/jkosgrimr ... heat-sheet
I think it could be useful to someone else too.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450
Re: Scripting cheat sheet
This is super useful JKos. I'm constantly using references for specific syntax or commands. This is perfect!
Currently conspiring with many modders on the "Legends of the Northern Realms"project.
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Re: Scripting cheat sheet
Very useful indeed! Thanks, this will save us a lot of time.
Re: Scripting cheat sheet
yes! very concise and complete, love it!
Finished Dungeons - complete mods to play
Re: Scripting cheat sheet
An excellent resource. Thanks for sharing!
Puzzle Frameworks - http://www.grimrock.net/forum/viewtopic.php?f=14&t=4564
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Re: Scripting cheat sheet
Fantastic! Will definitely use it!
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
Re: Scripting cheat sheet
Thanks for the great response. I got an idea for another cheat sheet: It would be nice to have a lua syntax/tips/warnings cheat sheet for LoG specific lua scripting because like we all know the lua support is a bit limited and there is also some restrictions. But because it's much more work than just copy pasting functions from documentation I was thinking that maybe we could make it together, just write your (short) lua tips/tricks here and I will make a another cheat sheet of them.
I can start of course so you get the idea.
STRINGS
TABLES
SCRIPT ENTITIES
OBJECT ORIENTED
WARNINGS (works in editor but not in the game)
Storing entities to "global" variables
Undefined "global" variables
Upvalues
I can start of course so you get the idea.
STRINGS
Code: Select all
"a".."b" == "ab"
"a"..0 == "a0"
Code: Select all
multiLineString = [[
Hello
Grimrock!
]]
multiLineString = "Hello\nGrimrock!"
TABLES
Code: Select all
table1 = {'a','b','c'}
table1[1] == "a"
table2 = {key1='value1'}
table2.key1 == 'value1'
Code: Select all
property = "a"
function getProperty()
return property
end
function setProperty(value)
property = value
end
entity_id.getProperty() == "a"
entity_id.setProperty('c') (ok)
entity_id:getProperty() == "c"
entity_id:setProperty('c') (error)
OBJECT ORIENTED
Code: Select all
local obj = {}
obj.property = "a"
obj.method = function(self)
return self.property
end
obj:method() == "a"
obj:method() == obj.method(obj)
obj.method() (error)
Code: Select all
-- magic self
local obj2 = {}
obj2.property = 'b'
function obj2:method()
return self.property
end
obj:method() == 'b'
obj.method() (error)
Storing entities to "global" variables
Code: Select all
variable = snail_1 (serialization error on save game)
variable = snail_1.id (ok)
local variable = snail_1 (ok)
Code: Select all
function breakTheGame()
undefinedGlobal = 'crash'
end
Code: Select all
myMethods = {}
function breakTheGame()
local upvalue = "causes serialization error"
myMethods.useExternalLocalVariable = function()
print(upvalue)
end
end
breakTheGame()
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450
Re: Scripting cheat sheet
Holy heck this is extremely valuable. I'm only just starting to get a grasp on most of this stuff, so thank you!
Finished Dungeons - complete mods to play