Jump to content

Problem with LUA Quest


Go to solution Solved by Syreldar,

Recommended Posts

  • Premium

Hi,
I am editing a quest for shop. But I have a problem running. And Pre_Qc is not very smart.

" Error occured on quest ./pre_qc/itemshop_newnew.lua "

Syntax Quest:

1) Kostýmové itemy -- Costume items
    a) Kostýmové zbraně --Costume weapons
    b) Kostýmy (brnění) --Costumes (Armor)
    c) Zavřít --Close

2) Kostýmové účesy --Costume Hairstyles
3) Mazlíčci --Pets
4) Jezdecká zvířata --Mounth
5) Prémium --Premium
6) Ostatní --Other
7) Zavřít nabídku --Close

--------------------------------------------------------

Code:

Spoiler

 

This is the hidden content, please

 

 

 

Uploaded to Github for correct syntax.

Thank you for help!

  • Metin2 Dev 21
  • Eyes 1
  • Not Good 1
  • Sad 1
  • Good 5
  • Love 9
Link to comment
Share on other sites

  • Premium

The same variable redeclared multiple times, Czech code, bad indentation, calling variables out of their own scope.I see multiple issues there.

This is still a bad code snippet, but at least it will fix your issue.

 

quest itemshop begin
	state start begin
		function open_shop_vnum(vnum)
			itemshop.open_shop_vnum(vnum);
			setskin(NOWINDOW);
		end -- function
	
		when 20094.click begin
			say_title("Itemshop:[ENTER]")
			say("Mince si lze dobít po přihlášení na našem webu:")
			
			say_green("URL WEBSITE:[ENTER]")
			say("Výběr kategorie:")
			
			local category = select("Kostýmové itemy", "Kostýmové účesy", "Mazlíčci", "Jezdecká zvířata", "Prémium", "Ostatní ", "Zavřít nabídku")
			if (category == 1) then
				say_title("Itemshop:[ENTER]")
				say("Výběr podkategorie:")
				
				local subcat = select("Kostýmové zbraně", "Kostýmy (brnění)", "Zavřít");
				if (subcat == 1) then
					say_title("Itemshop:[ENTER]")
					say("Výběr podkategorie: Kostýmových itemů:")
					local options = select("Meče", "Obouruční meče", "Luky", "Dýky", "Zvony/Hole", "Vějíře", "Zavřít");
					if (options == 1) then
						itemshop.open_shop_vnum(11); -- Meče
						
					elseif (options == 2) then
						itemshop.open_shop_vnum(13); -- Obouruční meče
						
					elseif (options == 3) then
						itemshop.open_shop_vnum(14); -- Luky
						
					elseif (options == 4) then
						itemshop.open_shop_vnum(15); -- Dýky
						
					elseif (options == 5) then
						itemshop.open_shop_vnum(16); --Zvony/Hole
						
					elseif (options == 6) then
						itemshop.open_shop_vnum(17); --Vějíře
					end -- if/elseif
					
				elseif subcat == 2 then
					itemshop.open_shop_vnum(18); --Kostýmy (brnění)
				end -- if/elseif
					
			elseif (category == 2) then
				itemshop.open_shop_vnum(82); --Kostýmové účesy
				
			elseif (category == 3) then
				itemshop.open_shop_vnum(83); --Mazlíčci
				
			elseif (category == 4) then
				itemshop.open_shop_vnum(84); --Jezdecká zvířata
				
			elseif (category == 5) then 
				itemshop.open_shop_vnum(85); --premium
				
			elseif (category == 6) then 
				itemshop.open_shop_vnum(85); --ostatní
			end -- if/elseif
		end -- when
	end -- state
end -- quest

 

 
 

This is still a bad code snippet, but at least it will fix your issue.

  • Love 3

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Premium
6 minutes ago, Syreldar said:

Same redeclared multiple times, Czech code, bad indentation, calling variables out of their own scope.I see multiple issues there.

 

  Hide contents

 



quest itemshop begin
	state start begin
		function open_shop_vnum(vnum)
			item_shop.open_shop_vnum(vnum);
			setskin(NOWINDOW);
		end -- function
	
		when 20094.click begin
			say_title("Itemshop:[ENTER]")
			say("Mince si lze dobít po přihlášení na našem webu:")
			
			say_green("URL WEBSITE:[ENTER]")
			say("Výběr kategorie:")
			
			local category = select("Kostýmové itemy", "Kostýmové účesy", "Mazlíčci", "Jezdecká zvířata", "Prémium", "Ostatní", "Zavřít nabídku")
			if (category == 1) then
				say_title("Itemshop:[ENTER]")
				say("Výběr podkategorie:")
				
				local subcat = select("Kostýmové zbraně", "Kostýmy (brnění)", "Zavřít");
				if (subcat == 1) then
					say_title("Itemshop:[ENTER]")
					say("Výběr podkategorie: Kostýmových itemů:")
					local options = select("Meče", "Obouruční meče", "Luky", "Dýky", "Zvony/Hole", "Vějíře", "Zavřít");
					if (options == 1) then
						itemshop.open_shop_vnum(11); -- Meče
						
					elseif (options == 2) then
						item_shop.open_shop_vnum(13); -- Obouruční meče
						
					elseif (options == 3) then
						item_shop.open_shop_vnum(14); -- Luky
						
					elseif (options == 4) then
						item_shop.open_shop_vnum(15); -- Dýky
						
					elseif (options == 5) then
						item_shop.open_shop_vnum(16); --Zvony/Hole
						
					elseif (options == 6) then
						item_shop.open_shop_vnum(17); --Vějíře
					end -- if/elseif
					
				elseif subcat == 2 then
					item_shop.open_shop_vnum(18); --Kostýmy (brnění)
				end -- if/elseif
					
			elseif (category == 2) then
				item_shop.open_shop_vnum(82); --Kostýmové účesy
				
			elseif (category == 3) then
				item_shop.open_shop_vnum(83); --Mazlíčci
				
			elseif (category == 4) then
				item_shop.open_shop_vnum(84); --Jezdecká zvířata
				
			elseif (category == 5) then 
				item_shop.open_shop_vnum(85); --premium
				
			elseif (category == 6) then 
				item_shop.open_shop_vnum(85); --ostatní
			end -- if/elseif
		end -- when
	end -- state
end -- quest

 

This is still a bad code snippet, but at least it will fix your issue.

 

 

mm same problem :( " Error occured on quest ./pre_qc/itemshop_newnew.lua "

Link to comment
Share on other sites

  • Premium
2 minutes ago, matyasvane said:

 

mm same problem :( " Error occured on quest ./pre_qc/itemshop_newnew.lua "

That's not an error, compile it without the pre_qc.

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Premium

Open the terminal from your quest folder and write:

./qc itemshop_newnew.lua

 

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Premium
8 minutes ago, Syreldar said:

Open the terminal from your quest folder and write:


./qc itemshop_newnew.lua

 

fixxxx@m:xxxxxx/czech/quest # ./qc itemshop_newnew.lua
QUEST : itemshop
STATE : start
FUNCTION open_shop_vnum(vnum)
WHEN  : 20094.click

reset server, but quest dont load..

Link to comment
Share on other sites

  • Premium

There is no error in the script as you can see. If it doesn't work then the problem is somewhere else.

Try to use TEST_SERVER and see what's wrong.

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Premium
1 hour ago, Syreldar said:

There is no error in the script as you can see. If it doesn't work then the problem is somewhere else.

Try to use TEST_SERVER and see what's wrong.

Yes, now work. But i cant open all shops in quest..
 

                    if (options == 1) then
                        itemshop.open_shop_vnum(11); --Meče

DB SHOP_ITEM:

11    10    1
11    18    1
11    29    1

DB SHOP

11    itemshop    20094

Serversyssr:

SYSERR: Apr  7 23:34:29 :: RunState: LUA_ERROR: [string "itemshop"]:33: attempt to index global `item_shop' (a nil value)
SYSERR: Apr  7 23:34:29 :: WriteRunningStateToSyserr: LUA_ERROR: quest itemshop.start click

quest/object/state/itemshop

 

itemshop={["start"]=0,open_shop_vnum= function (vnum)item_shop . open_shop_vnum ( vnum ) ; 
setskin ( NOWINDOW ) ; 
end }

 

Link to comment
Share on other sites

  • Premium

copypaste my quest again, recompile it, then type /reload q in game and try again.

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Premium
42 minutes ago, matyasvane said:

again: Error occured on quest ./pre_qc/itemshop_newnew.lua

I told you to not use pre_qc.. Do you even read what I write?

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Premium
  • Solution
34 minutes ago, matyasvane said:

Problem fixed. Thank you @Syreldar

Np, btw you don't have to write thank you messages, giving likes is enough.

Use the upvote button to make my answer the most visible so people know what the problem was and contact a mod to close the topic.

  • Love 2

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



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