Writing the result of a function on a scroll ?

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
Blichew
Posts: 157
Joined: Thu Sep 27, 2012 12:39 am

Re: Writing the result of a function on a scroll ?

Post by Blichew »

I think you can't set values to object definitions dynamically as definitions load first with init.lua and other scripts and you're setting up the text waaaaaaaay later ingame (I think).

Have you tried setting up in the definition:

Code: Select all

ScrollText = "Sample text that will change later",
and as soon as the scroll is spawned change it via function. Let's assume it this way:

1. put skills_scroll_crom item in game and put it in the alcove. Give it id, like s_s_c_1
2. place floor trigger in front of the alcove.
3. connect floor trigger to function: updateSkillsScroll
4. Let this function have this line only:

Code: Select all

s_s_c_1.scrollitem:setScrollText(yourFunctionThatReturnsYourSkills())
this shoud work i think ... :)
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: Writing the result of a function on a scroll ?

Post by cromcrom »

Sure, there are ways, and thanks a lot for the tips, but it was easier in log1, for this particular thing. However, I am going for the onDrawGui hook, and have made some progress, so everythings are going allright, I kindof found a workaround. thank you again :-)
A trip of a thousand leagues starts with a step.
Post Reply