Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::LUA

Quests::LUA Section regarding LUA scripts, help, questions, answers

Reply
 
Thread Tools Display Modes
  #1  
Old 08-29-2019, 12:34 AM
jsr
Hill Giant
 
Join Date: Aug 2008
Location: melbourne
Posts: 167
Default Adding a pause to scripts

I'm trying to add a pause to an NPC script between statements while preserving the if block. So ideally, without using event_timer.

I tried using the threadmanager's wait function, but it doesn't do anything. I've referenced the example in http://wiki.eqemulator.org/p?Lua_NPC_Examples

This is from the example
Code:
local ThreadManager = require("thread_manager");
local evt;
 
function ability_one()
    evt.self:Emote("begins to cast something electrical");
    ThreadManager:Wait(2.5);
    evt.self:Shout("Feel the thunder!");
end

This is my implementation
Code:
function event_say(e)

	local tm = require("thread_manager")
	
	if e.message:findi("hail") then
	
		e.self:Say("A message")
		tm:Wait(5)
		e.self:Say("B message")
		tm:Wait(5000)
		e.self:Say("C message")
	end
end
A, B, and C message all display at once, and no quest errors are generated. Does anyone know why this wouldn't work?
Reply With Quote
  #2  
Old 09-07-2019, 06:16 PM
Gnowm
Fire Beetle
 
Join Date: Aug 2009
Location: Australia
Posts: 9
Default

Just a guess but punctuation kills me so

Lack of semicolon after tm:Wait(5)

Dont know lua though.
Reply With Quote
  #3  
Old 09-08-2019, 10:33 AM
jsr
Hill Giant
 
Join Date: Aug 2008
Location: melbourne
Posts: 167
Default

Thanks for the response Gnowm.

Lua is forgiving if you don't use semi colons It's actually not good because nearly every other language uses them, and after a few hours of being lazy with Lua I end up missing them when I go back to other projects.

I did work this out in the end, but not with the thread manager, which is probably not fit for purpose in this case. I wound up using qglobals to store a condition, and a heartbeat timer to check for the condition and act accordingly.
Reply With Quote
  #4  
Old 09-08-2019, 06:05 PM
demonstar55
Developer
 
Join Date: Apr 2008
Location: MA
Posts: 1,112
Default

You need to use a timer
Reply With Quote
  #5  
Old 09-08-2019, 08:14 PM
jsr
Hill Giant
 
Join Date: Aug 2008
Location: melbourne
Posts: 167
Default

cheers Demonstar
Reply With Quote
  #6  
Old 09-08-2019, 11:19 PM
demonstar55
Developer
 
Join Date: Apr 2008
Location: MA
Posts: 1,112
Default

PEQ quest repo has a few examples.
Reply With Quote
  #7  
Old 09-09-2019, 12:38 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,021
Default

An example can also be found here on our not yet announced new documentation

https://eqemu.gitbook.io/quest-api/events#event_timer
__________________
Reply With Quote
  #8  
Old 09-09-2019, 12:47 AM
Huppy's Avatar
Huppy
Dragon
 
Join Date: Oct 2010
Location: Canada
Posts: 845
Default

Quote:
Originally Posted by Akkadius View Post
An example can also be found here on our not yet announced new documentation

https://eqemu.gitbook.io/quest-api/events#event_timer
Wow. I am loving the function on those pages. Seeing the examples shown in both perl and lua. Here's a big (not yet announced) Thank You
__________________

Discord - https://discord.gg/R34jK6h
Reply With Quote
  #9  
Old 09-09-2019, 06:57 AM
Gnowm
Fire Beetle
 
Join Date: Aug 2009
Location: Australia
Posts: 9
Default

I cant correctly express my gratitude. Youve basically enabled
this numbskull to learn and play.
Great examples and answers both on the wiki and the forum.

Kudos and thankyou all.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:39 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3