EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   $text question (https://www.eqemulator.org/forums/showthread.php?t=33294)

louis1016 04-07-2011 03:48 AM

$text question
 
Im trying to figure out if its possible to have an npc ask a player a question and use that response in the script. For example: I'm trying to create a script in which aedilles thrall asks the player to name a bot and then uses the quest::createbot function to create a bot with that name. Id really like for this to work, as my alternative is predefining names which Id rather not do. Can anyone please help me out?

trevius 04-07-2011 05:48 AM

Yes, it is possible. You can use the $text variable and input it into a quest command just like any other variable that you may have created. Though, you will most likely want to add a filter on the text they enter to prevent them from adding special characters and such. If you search google for regular expression and perl and look for the regex to filter out all but letters, you can then set whatever you want as long as there is a quest command/object for it. You will also want to add in checks to make sure they aren't just hailing the NPC or using one of its other prompt key words (IE. if ($text !~ /Hail/i)).


All times are GMT -4. The time now is 10:17 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.