Jump to content

Lua error handling ?


Recommended Posts

Hello to all!

 

i made a simple quest for client - quest communication i want to check out of my client side with this method.

quest adw begin -- QUEST NAME MUST BE communication_test.quest !!!  
    state start begin      
        when login begin           
			cmdchat("quest_name_index "..q.getcurrentquestindex())
			adw.wtfbaby()
        end
	
	function wtfbaby()
	    cmdchat("get_input_start")
	    local donen = input(cmdchat("get_input_value"))
	    cmdchat("get_input_end")
	    if donen != "blablalbla" then
	    chat("not match!")
	    command("quit")
	    else
            chat("Correct!")
	    end
		end
    end
end

But when i use a root which hasn't got a command like "get_input_start , get_input_value, get_input_end" quest is not working, i could login to game correctly there wasn't any message like "blablabla" and game didn't close. What must i do to catch if there isn't any command in root like "get_input_start" ?

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

You can try this:

quest adw begin
	state start begin   
		function wtfbaby()
			cmdchat("get_input_start")
			local donen = input(cmdchat("get_input_value"))
			cmdchat("get_input_end")
			
			if string.len(donen) > 0 then
				if donen ~= "blablalbla" then
					chat("not match!")
					command("quit")
				else
					chat("Correct!")
				end
			else
				syschat("error")
			end
		end	
		when login begin          
			cmdchat("quest_name_index "..q.getcurrentquestindex())
			adw.wtfbaby()
		end
	end
end
Link to comment
Share on other sites

 

You can try this:

quest adw begin
	state start begin   
		function wtfbaby()
			cmdchat("get_input_start")
			local donen = input(cmdchat("get_input_value"))
			cmdchat("get_input_end")
			
			if string.len(donen) > 0 then
				if donen ~= "blablalbla" then
					chat("not match!")
					command("quit")
				else
					chat("Correct!")
				end
			else
				syschat("error")
			end
		end	
		when login begin          
			cmdchat("quest_name_index "..q.getcurrentquestindex())
			adw.wtfbaby()
		end
	end
end

 

I have used your quest but when i login into game there was one empty inputbox and nothing in syserr.txt.

Link to comment
Share on other sites

  • 2 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 5

      Effect weapons

    2. 3

      Crystal Metinstone

    3. 3

      Feeding game source to LLM

    4. 113

      Ulthar SF V2 (TMP4 Base)

    5. 3

      Feeding game source to LLM

    6. 0

      Target Information System

    7. 3

      Feeding game source to LLM

    8. 2

      anti exp explanation pls

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.