Spawn Scroll and setScrollText
Spawn Scroll and setScrollText
Hello,
I'm trying to spawn a scroll in front of the party and set the text written on the scroll (long text) in Grimrock 2.
local message = spawn("scroll")
message:setScrollText("This is an important\nmessage!")
According to the search this seems to have worked in the editor of Grimrock 1 (have not used that editor).
Unfortunately in Grimrock 2 I get the error message: attempt to call method setScrollText (a nil value).
Does anyone know the solution to this error?
Kind regards,
Joerg
I'm trying to spawn a scroll in front of the party and set the text written on the scroll (long text) in Grimrock 2.
local message = spawn("scroll")
message:setScrollText("This is an important\nmessage!")
According to the search this seems to have worked in the editor of Grimrock 1 (have not used that editor).
Unfortunately in Grimrock 2 I get the error message: attempt to call method setScrollText (a nil value).
Does anyone know the solution to this error?
Kind regards,
Joerg
Re: Spawn Scroll and setScrollText
You almost had it...
Code: Select all
local message = spawn("scroll")
message.scrollitem:setScrollText("This is an important\nmessage!")
Re: Spawn Scroll and setScrollText
Thank you very much!
I'll try it as soon as I get home.
Is there any reference source where I can check the objects? (how did you know the solution?)
Kind regards,
Jörg
I'll try it as soon as I get home.
Is there any reference source where I can check the objects? (how did you know the solution?)
Kind regards,
Jörg
Re: Spawn Scroll and setScrollText
Check out this thread: viewtopic.php?f=22&t=7882. JKos did a fantastic job of finding classes and methods using a hex editor! I copied the text to an editor, searched for "scroll" and found the section:
Note the setScrollText(string) entry. I suspected, from the heading of "ScrollItemComponent" that I really needed just scrollitem, but I verified this by placing a scroll manually, selecting it, and noting the component list. If you do so, you will see model, item, and scrollitem. Also note that you can set the text under scrollitem. So the code simply became <object name>.<component>:<methdod>(<arguments>) - specifically in your case, message.scrollitem:setScrollText("This is an important\nmessage!")
I hope this helps, -Lark
Code: Select all
class ScrollItemComponent
setScrollText(string)
setScrollImage(string)
setTextAlignment(string)
getScrollText
getScrollImage
getTextAlignment
enable
disable
isEnabled
addConnector(string,string,string)
I hope this helps, -Lark
Re: Spawn Scroll and setScrollText
Works perfectly and thank you again for all the information! :)
Re: Spawn Scroll and setScrollText
I am trying to spawn a Note (in a socket) at gamestart. Spawning the note is not the problem - but the text is.
I am trying something like
..but doesn't seem to be right. Does anyone know, how to do this?
I am trying something like
Code: Select all
dungeon_socket_wall_1.socket:addItem(spawn("note").item).scrollitem:setScrollText("This is an important message!")
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: Spawn Scroll and setScrollText
You might want to unroll your script to make it more readable.
Note. The word local is important here to prevent save game issues!
Code: Select all
local note = spawn("note");
note.scrollitem:setScrollText(...);
dungeon_socket_wall_1.socket:addItem(note.item);
Last edited by JohnWordsworth on Sun Feb 01, 2015 8:47 pm, edited 1 time in total.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: Spawn Scroll and setScrollText
Ah . thanks, John.
I still got some errors but could figure out how to manage it:
local note = spawn("note");
note.scrollitem:setScrollText("important note");
dungeon_socket_wall_1.socket:addItem(note.item);
I still got some errors but could figure out how to manage it:
local note = spawn("note");
note.scrollitem:setScrollText("important note");
dungeon_socket_wall_1.socket:addItem(note.item);
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: Spawn Scroll and setScrollText
Ooops - well spotted THOM. I wrote my reply on my iPad. I've updated my post so it's correct .
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: Spawn Scroll and setScrollText
guys how can i spawn some item directly to the "cursor" (like if I grab some item) ? it is possible ? Also it could somehow check that party is not already holding some item (if yes, than spawn the object on the floor before party instead). thanks for any advice