how to build delay in lua script

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

how to build delay in lua script

Post by Ryeath_Greystalk »

How can I add a delay between hudPrints in a script?

I tried sleep(), like in the cinematics but it didn't work. I really like the way mahric used delays in hudPrint in his/her mod "The wine merchants basement". I'm using counters and timers right now, but it's gets pretty convoluted. I'm thinking there must be an easier way.

As usual, thanks in advance.
User avatar
Vice Dellos
Posts: 47
Joined: Thu Feb 28, 2013 12:56 pm

Re: how to build delay in lua script

Post by Vice Dellos »

I believe the only way is to use an external timer

so for example

Code: Select all

function helloworld()
  if counter_hello_world:getValue() == 1 then hudPrint("Hello")
        elseif counter_hello_world:getValue() == 0 then hudPrint("world")
           counter_hello_world:reset()
           timer_hello_world:deactivate()
  end
end
and then link an timer to both the counter and the function

but I'm no expert
User avatar
mahric
Posts: 192
Joined: Sun Nov 04, 2012 3:05 pm

Re: how to build delay in lua script

Post by mahric »

Ryeath_Greystalk wrote:How can I add a delay between hudPrints in a script?

I tried sleep(), like in the cinematics but it didn't work. I really like the way mahric used delays in hudPrint in his/her mod "The wine merchants basement". I'm using counters and timers right now, but it's gets pretty convoluted. I'm thinking there must be an easier way.

As usual, thanks in advance.
If there's a lot of text you want to display, take a look at my source from my latest mod, the Awakening of Taarnab.
It features a dialog window you can use with one easy function call. It's all in a script on level 2, top right part of the level, a scriptEntity called "neatDialog".
Please PM me if you need more help with that.

And if you want to stick with hudPrints, a timer and a counter is the shortest way I know of...
Did you visit the Wine Merchant's Basement? And heard about the Awakening of Taarnab?
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: how to build delay in lua script

Post by Drakkan »

if you want hudPrint to be used, then more timers are necessary. Or you can use some scripting like adviced by mahric or some GUI dialogue windows which is similar to it.
Breath from the unpromising waters.
Eye of the Atlantis
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: how to build delay in lua script

Post by Ryeath_Greystalk »

Thanks everyone.

I have been using counters and timers just like in your script Vice Dellos. Just time consuming to set up.

I will check out your source code Mahric and see if it's some simple enough for me to understand. BTW enjoying your Wine Merchants mod. I just fell down the pits into the prison area.
Post Reply