Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
Is there a way to print to a text/log file instead of the screen? I understand, that if there was, it would be a problem with compiled modules (exported) and modders potentially could write something malicious but looking for something that would only work in a development setting (the editor).
- QuintinStone
- Posts: 72
- Joined: Sat Nov 01, 2014 9:58 pm
Re: Ask a simple question, get a simple answer
JohnWordsworth's script to get object definitions does something pretty brilliant.NutJob wrote:Is there a way to print to a text/log file instead of the screen? I understand, that if there was, it would be a problem with compiled modules (exported) and modders potentially could write something malicious but looking for something that would only work in a development setting (the editor).
viewtopic.php?f=22&t=8439
It dumps the text into a script object definition so that while running the dungeon in preview mode, you can place that script object into your map. When you view the source of the object, all the text appears and it can be copy-pasted to any text editor outside the game.
Crypt of Zulfar
- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: Ask a simple question, get a simple answer
What do I use to define a large group of assets instead of this which doesn't seem to work for grimrock 2.
for i in allEntities(party.level) do
for i in allEntities(party.level) do
Re: Ask a simple question, get a simple answer
for i in party.map:allEntities() do
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: Ask a simple question, get a simple answer
Don't know what I'm doing wrong, or why the scripting ref changed so much.
function massopenpit()
for i in party.map:allEntities() do
if i.id:sub(1,8) == "tomb_pit" then
if i:isOpen() then
i:close()
else
i:open()
end
end
end
end
PitComponent:isOpen() also doesn't work
function massopenpit()
for i in party.map:allEntities() do
if i.id:sub(1,8) == "tomb_pit" then
if i:isOpen() then
i:close()
else
i:open()
end
end
end
end
PitComponent:isOpen() also doesn't work
-
- Posts: 168
- Joined: Thu Oct 30, 2014 1:56 am
Re: Ask a simple question, get a simple answer
function massopenpit()
for i in party.map:allEntities() do
if i.id:sub(1,8) == "tomb_pit" then
if i.pit:isOpen() then
i.pit:close()
else
i.pit:open()
end
end
end
end
Always take off the "Component" when looking at the scripting reference
for i in party.map:allEntities() do
if i.id:sub(1,8) == "tomb_pit" then
if i.pit:isOpen() then
i.pit:close()
else
i.pit:open()
end
end
end
end
Always take off the "Component" when looking at the scripting reference
Re: Ask a simple question, get a simple answer
You're trying to call methods that don't exist.Soaponarope wrote:Don't know what I'm doing wrong
Because it's Grimrock 2 and not Grimrock 1.Soaponarope wrote:or why the scripting ref changed so much.
Because GameObject doesn't have an isOpen() method, GameObject doesn't have a close() method, GameObject doesn't have an open() method, and "PitComponent" is the name of the class, not an actual instance of it. You probably wanted to call i.pit:isOpen(), i.pit:close(), etc. All of this information is in the scripting reference.Soaponarope wrote:function massopenpit()
for i in party.map:allEntities() do
if i.id:sub(1,8) == "tomb_pit" then
if i:isOpen() then
i:close()
else
i:open()
end
end
end
end
PitComponent:isOpen() also doesn't work
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: Ask a simple question, get a simple answer
Thank you both, working now.
I am using the scripting reference, but I don't know scripting and I'm sometimes not sure what I'm looking for.(like taking off the "component")
I am using the scripting reference, but I don't know scripting and I'm sometimes not sure what I'm looking for.(like taking off the "component")
Re: Ask a simple question, get a simple answer
I just can't get delayedCall to work. I've combed through the various posts regarding it in other threads and the brief mention of it in the scripting ref but I think I'm completely misunderstanding it. I've tried many things to get a script function to be ran after X seconds and sometimes the editor crashes on delayedCall() and sometimes it passes through it fine but gives me an invalidconnector warning onscreen and nothing else happens.
If I have entityID with a functionName I want to run after X seconds, is that something this can do?
If I have entityID with a functionName I want to run after X seconds, is that something this can do?
Writer and sometimes artist of the very slightly acclaimed comic series Scrambled Circuits. A comic series about a robot written by a human.
Grimrock 2 socketSystem: viewtopic.php?f=22&t=8546 / Github
Grimrock 2 socketSystem: viewtopic.php?f=22&t=8546 / Github
- QuintinStone
- Posts: 72
- Joined: Sat Nov 01, 2014 9:58 pm
Re: Ask a simple question, get a simple answer
I'm currently having problems too. I'm trying to call the stop() method on an object's controller component.cameronC wrote:I just can't get delayedCall to work. I've combed through the various posts regarding it in other threads and the brief mention of it in the scripting ref but I think I'm completely misunderstanding it. I've tried many things to get a script function to be ran after X seconds and sometimes the editor crashes on delayedCall() and sometimes it passes through it fine but gives me an invalidconnector warning onscreen and nothing else happens.
If I have entityID with a functionName I want to run after X seconds, is that something this can do?
delayedCall(obj.go.id, 1, "stop") produces no results
delayedCall(obj.go.id, 1, "controller:stop") produces no results
Crypt of Zulfar