Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 11-26-2011, 02:34 PM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default

Trying to do something pretty funky here, making small amounts of headway and looking for a way of doing this. This is all just testing right now, so I will clean it up before I am completely done. Since I do not know jack about C++, this is 'train as you go'.

Running this query returns 1276 results, but only the id column. I am sure the result amount will be less when I am done. Anyway I want to dump these 1276 results into I guess an array, then run the random number generator on it. I thought about doing the random row thing with MySQL but everyone says that is crap and takes way too long. I figured the best way then would be to get back a small amount of results and let C++ do a random number pull on it. Anyway I do not know jack about arrays in C++, this would be super easy with C# so I am struggling. I want to take the results and put them into something, and then pull a single random and return that item's id.

Code:
if(database.RunQuery(query, MakeAnyLenString(&query,"select `id` from `items` WHERE `classes`= '%i'", class_id), errbuf, &result))
	{
		while((row = mysql_fetch_row(result)))
		{
			int32 result=0;
                        // take result from mysql and pull random number
			return result;
		}
	mysql_free_result(result);
        }
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 07:07 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3