Go Back   EQEmulator Home > EQEmulator Forums > Development > Development: Custom Code

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

Reply
 
Thread Tools Display Modes
  #1  
Old 12-13-2012, 01:04 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default passing vector to perl event

i'm attempting to implement a custom quest event. the data i would like to export is stored in two sequences of pairs stored in vectors, and the vectors will likely vary in size.

seeing as how EventPlayer() only takes data as a string and extra data is a numeric value, i need to know the best way to convert and pass the data. i have seen a char sequence built and passed to EVENT_LOOT, then broken up via the Seperator class.

i was considering simply building two non-delimited char sequences, then putting them together in a single string, and passing the length of the first sequence as extradata so i could know where one data set ended and the other began. i could then either pass them both directly to perl and parse the data there (unpack), or break the data up in c++ and try my hand at exporting a hash (like qglobals).

i'm trying to avoid having to run additional database queries in perl by handling things in this manner. i'm still learning c++ (mostly by example, trial, and error), and would appreciate any further insight or suggestions as to the best way to handle this.
Reply With Quote
  #2  
Old 12-13-2012, 10:32 AM
Tabasco's Avatar
Tabasco
Discordant
 
Join Date: Sep 2009
Posts: 269
Default

I don't think I have enough information to suggest a specific course of action here, but there are a lot of possibilities.

Your vectors sound like a sort of linked list, but if that's the case, you would most likely be better off using a std::map. In fact, for the purpose of exporting hashes the prototype for PerlembParser::ExportHash takes a map<string, string>.
If you could store it in mob or client you wouldn't need to pass it at all since you would already have a handle on it.

If it's temporary data that is generated uniquely at event time and then discarded, it has the potential to be a bit more complicated.
Depending on just how large these pairs get, you could send perl a string delineated like a query string and let perl do the work since that's what it's good at.
name=value&name=value&name=value, etc.
Reply With Quote
  #3  
Old 12-13-2012, 11:23 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

it's trade skill recipe data i'm trying to work with. i'm currently iterating over the vectors and building a stringstream with the information i need, passing that to EventPlayer, breaking up parts of it, exporting those to perl as scalars, and then using split() to build hashes from two of those scalars. it's a bit of a hack job, but it looks like it'll work like i wanted without more source modifications. i'm much more comfortable in perl. i just wanted to keep from having to connect to the database to fetch the recipe information when it was already present in the vectors.
Reply With Quote
Reply


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 10:38 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