HisaoShou 3 Posted December 30, 2017 Share Posted December 30, 2017 I want to make a quest which gives the player any item they want by input. But I have an issue... the "vnum" from give_item2 does not work with my local input variable. The quest I have tried to make looks like this: quest giveItm begin state start begin when login begin say("test") local itm = input() pc.give_item2(itm, 1) say("test2") end end end Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted December 30, 2017 Premium Share Posted December 30, 2017 ? quest giveItem begin state start begin when login begin say("test") local vnum = tonumber(input()); if (vnum == nil or vnum == 0) then return say_reward("Invalid input.[ENTER]"); elseif (mysql_direct_query(string.format("SELECT vnum FROM player.item_proto WHERE vnum = '%d';", vnum)) == 0) then return say_reward(string.format("The item %d doesn't exist in the database.[ENTER]", vnum)) end -- if/elseif pc.give_item2(vnum, 1); say(string.format("The item %d (%s) has been received.", vnum, item_name(vnum))) say_item_vnum(vnum); end -- when end -- state end -- quest 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 More sharing options...
HisaoShou 3 Posted December 30, 2017 Author Share Posted December 30, 2017 Acum 1 oră, Syreldar a spus: ? quest giveItem begin state start begin when login begin say("test") local vnum = tonumber(input()); if (vnum == nil or vnum == 0) then return say_reward("Invalid input.[ENTER]"); elseif (mysql_direct_query(string.format("SELECT vnum FROM player.item_proto WHERE vnum = '%d';", vnum)) == 0) then return say_reward(string.format("The item %d doesn't exist in the database.[ENTER]", vnum)) end -- if/elseif pc.give_item2(vnum, 1); say(string.format("The item %d (%s) has been received.", vnum, item_name(vnum))) say_item_vnum(vnum); end -- when end -- state end -- quest I get this on compile: Calls undeclared function! : mysql_direct_query Abort (core dumped) Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted December 30, 2017 Premium Share Posted December 30, 2017 3 minutes ago, HisaoShou said: I get this on compile: Calls undeclared function! : mysql_direct_query Abort (core dumped) We are almost in 2018 man, don't you know you have to add that to the quest_functions file first? "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 More sharing options...
HisaoShou 3 Posted December 30, 2017 Author Share Posted December 30, 2017 Acum 1 minut, Syreldar a spus: We are almost in 2018 man, don't you know you have to add that to the quest_functions file first? Uhm, i did. But the quest does nothing in game. After I put the item number, nothing happens afterwards Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted December 30, 2017 Premium Share Posted December 30, 2017 Apparently, you don't have the mysql_direct_query functions on your server, sigh. Just remove it from the quest. "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 More sharing options...
HisaoShou 3 Posted December 30, 2017 Author Share Posted December 30, 2017 Acum 12 minute, Syreldar a spus: Apparently, you don't have the mysql_direct_query functions on your server, sigh. Just remove it from the quest. Yes, this still does not work: quest giveItem begin state start begin when login begin say("test") local vnum = tonumber(input()); if (vnum == nil or vnum == 0) then return say_reward("Invalid input.[ENTER]"); end -- if/elseif pc.give_item2(vnum, 1); say(string.format("The item %d (%s) has been received.", vnum, item_name(vnum))) say_item_vnum(vnum); end -- when end -- state end -- quest Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted December 30, 2017 Premium Share Posted December 30, 2017 fix your server ¯\_(ツ)_/¯, unless you are using a wrong vnum that's impossible. "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 More sharing options...
HisaoShou 3 Posted December 30, 2017 Author Share Posted December 30, 2017 Acum 4 minute, Syreldar a spus: fix your server ¯\_(ツ)_/¯ Bruh, don't you have an workaround or something? (;¬_¬) I have no idea how this would be a server issue Link to comment Share on other sites More sharing options...
Premium tierrilopes 452 Posted December 31, 2017 Premium Share Posted December 31, 2017 The question is, why? Why would you do that on a quest? Just change the command /item (do_item) command from GameMaster into player and done, player will be able to do for example: /i 19 or /item 19 to get a sword+9. And if you dont want players to have to know the items id, change the item function and have it read names from the proto, then gettin corresponding vnum and voilá. 1 Link to comment Share on other sites More sharing options...
Developer PACI 921 Posted December 31, 2017 Developer Share Posted December 31, 2017 you can't use any kind of quest function that sends the player into a suspended state (e.g: wait(), input(), select()) with a login statement. if you want to use it that way, add a quick timer, and then do the stuff. when you return 0 and server doesn't boot: Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted December 31, 2017 Premium Share Posted December 31, 2017 9 hours ago, tierrilopes said: The question is, why? Why would you do that on a quest? Just change the command /item (do_item) command from GameMaster into player and done, player will be able to do for example: /i 19 or /item 19 to get a sword+9. And if you dont want players to have to know the items id, change the item function and have it read names from the proto, then gettin corresponding vnum and voilá. 5 ^ "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 More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now