Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 04-23-2009, 09:01 PM
BWStripes
Sarnak
 
Join Date: Jun 2007
Location: Finland
Posts: 65
Default Quest - fixed unsourced localised emote (quest::echo)

Originally mentioned here: http://www.projecteq.net/phpBB2/viewtopic.php?t=7289

Summary of above:
Neither quest::me or quest::echo works at the moment. I think quest::me is specific to something, but I can't tell what.
The quest::echo code - where does this message go exactly? ~line 193 questmgr.cpp:
Code:
void QuestManager::echo(const char *str) {
   printf("%s\n", str);
}
So, I rewrote the quest::echo function to be more like the quest::ze and quest::we functions, meaning it will allow a colour ID.
I left the quest::me function as it was in case it was intentional:
Code:
void QuestManager::me(const char *str) {
   if (!initiator)
      return;
   entity_list.MessageClose(initiator, false, 200, 10, str);
}
I just made quest::echo work, pretty much identical to the alternative method Trevius posted:
Code:
$entity_list->MessageClose($npc, 1, 200, 15, "You hear a whisper in the wind as if something calls to you from the darkness.");
New usage: quest::echo(#colourID, "Message");

Diffs below. Now, I've had this compiled, tested and working, but I am a complete novice at C coding - I tend to stick to script languages. If someone spots something really stupid, please let me know.

questmgr.cpp
Code:
--- questmgr.cpp	2009-04-23 11:26:57.000000000 +0100
+++ questmgr.newcpp	2009-04-23 10:43:27.000000000 +0100
@@ -190,8 +190,8 @@ void QuestManager::EndQuest() {
 
 
 //quest perl functions
-void QuestManager::echo(const char *str) {
-	printf("%s\n", str);
+void QuestManager::echo(int colour, const char *str) {
+	entity_list.MessageClose(initiator, false, 200, colour, str);
 }
 
 void QuestManager::say(const char *str) {
questmgr.h
Code:
--- questmgr.h	2009-04-23 11:26:57.000000000 +0100
+++ questmgr.newh	2009-04-23 10:43:40.000000000 +0100
@@ -42,7 +42,7 @@ public:
 	void ClearTimers(Mob *who);
 	
 	//quest perl functions
-	void echo(const char *str);
+	void echo(int colour, const char *str);
 	void say(const char *str);
 	void me(const char *str);
 	void summonitem(int32 itemid, uint8 charges = 0);
parser.cpp
Code:
--- parser.cpp	2009-04-23 11:26:57.000000000 +0100
+++ parser.newcpp	2009-04-23 11:07:54.000000000 +0100
@@ -799,7 +799,7 @@ void Parser::ExCommands(string o_command
 			atof(arglist[3]), atof(arglist[4]), atof(arglist[5]), hdng);
 	}
 	else if (!strcmp(command,"echo")) {
-		quest_manager.echo(parms.c_str());
+		quest_manager.echo(atoi(arglist[0]), parms.c_str());
 	}
 	else if (!strcmp(command,"summonitem")) {
 		quest_manager.summonitem(atoi(arglist[0]));
perlparser.cpp
Code:
--- perlparser.cpp	2009-04-23 11:26:57.000000000 +0100
+++ perlparser.newcpp	2009-04-23 11:07:38.000000000 +0100
@@ -210,10 +210,10 @@ XS(XS__echo); // prototype to pass -Wmis
 XS(XS__echo) {
 	dXSARGS;
 
-	if (items != 1)
-		Perl_croak(aTHX_ "Usage: say(str)");
+	if (items != 2)
+		Perl_croak(aTHX_ "Usage: echo(id#, str)");
 
-	quest_manager.echo(SvPV_nolen(ST(0)));
+	quest_manager.echo(SvUV(ST(0)), SvPV_nolen(ST(1)));
 
 	XSRETURN_EMPTY;
 }
Reply With Quote
  #2  
Old 04-24-2009, 11:56 AM
Wesell
Sarnak
 
Join Date: Mar 2009
Location: none
Posts: 30
Default

Quote:
Originally Posted by BWStripes View Post
[...] The quest::echo code - where does this message go exactly? ~line 193 questmgr.cpp:
Code:
void QuestManager::echo(const char *str) {
   printf("%s\n", str);
}
The message prints to the standard output stream for the process (usually the console), it it's not supposed to appear as an in-game message. You could use it to do some rapid debugging of quest scripts or something like that.
Reply With Quote
  #3  
Old 04-24-2009, 02:47 PM
BWStripes
Sarnak
 
Join Date: Jun 2007
Location: Finland
Posts: 65
Default

I can accept that. However, the quest documentation alluded to it being a localised emote, rather than something for potential debugging purposes. I'd seen it used as a localised emote in quest files, hence why I tried to fix it. My own method of debugging is to use quest::say so I know something is happening.
Reply With Quote
  #4  
Old 04-24-2009, 04:24 PM
Wesell
Sarnak
 
Join Date: Mar 2009
Location: none
Posts: 30
Default

All the docs I've checked state that the echo method prints its string to the console.

I don't see any obvious bugs in the me method. One thing to consider when using this method is that initiator is going to be the client who started execution of the script - location of the initiator is the center of the area where the emote is visible.

You could change me to center the emote on the NPC involved in the quest which is probably the behavior most would expect:
Code:
void QuestManager::me(const char *str) {
   entity_list.MessageClose(npc, false, 200, 10, str);
}
Reply With Quote
  #5  
Old 05-03-2009, 04:17 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

This has been committed in Revision 454.
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 06:25 AM.


 

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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3