Jump to content
  • 0

Lua error handling ?


oguzhankrcby

Question

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
  • Answers 4
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

4 answers to this question

Recommended Posts

  • 0

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
  • 0

 

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • 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.