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

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2009, 11:04 PM
Krugus
Sarnak
 
Join Date: Dec 2005
Location: the Void
Posts: 40
Default is this working?

Just wondering if saylink is working in the Branch version ?

I see the code for it there. Table in the DB is there but its not working for me when I follow the examples in this thread or the wikki you have linked hrmmm.

Just compiled ver 635 of the Instance Branch version today. Guess I'll take a look at the regular SVN and see if there is a difference in code for the saylink.
Reply With Quote
  #2  
Old 06-06-2009, 11:30 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Branch is no longer used, we're back on the trunk.
Reply With Quote
  #3  
Old 06-06-2009, 11:37 PM
Krugus
Sarnak
 
Join Date: Dec 2005
Location: the Void
Posts: 40
Default

thanks for the info Cavedude
Reply With Quote
  #4  
Old 06-07-2009, 03:49 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Have you tried reading the little wiki page on Say Links?

http://www.eqemulator.net/wiki/wikka.php?wakka=SayLink

That might help a bit. They are really easy to use. Once you get the first one working, it is extremely easy to get any extra ones added.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #5  
Old 06-07-2009, 01:31 PM
Krugus
Sarnak
 
Join Date: Dec 2005
Location: the Void
Posts: 40
Default ...

Yes I did, but Cavedude pointed me in the right direction.

Updated and compiled the lastest Rev from the Trunk and saylinks are working now.

Thanks guys for the help
Reply With Quote
  #6  
Old 06-11-2009, 04:46 PM
Sion
Fire Beetle
 
Join Date: Jun 2008
Location: -
Posts: 14
Default

I think it would help a lot if there was at least an option to make the saylink not actually make the player say something. If you combined that with using $client->Message("(npc) says ...") instead of quest::say("..."), you could have completely private/spam-free interactions with npcs. It would also help a lot for my passcode script idea. (see below)

Also, I came up with a kind of cheap way in perl to make the text you click different from the text that is said:

Code:
sub Saylink
{
	my $saylink = quest::saylink($_[0]);
	my $length = length(substr($saylink,46)) - 1;

	if($_[1]) { substr($saylink,46,$length,$_[1]); }
	
	return $saylink;
}
It basically just creates a new saylink with the text you want it to say and then edits the string that quest::saylink() returns to change the text that you click.

So for example you could do $saylink = Saylink("option1","[Ask about the recent attacks.]"); and it would make a saylink titled "[Ask about the recent attacks.]" and when you click it, it would make you say "option1". This can help in some cases but doesn't have much practical use until you get to more advanced stuff: Like my passcode script idea.

-Passcode script idea-
If saylinks didn't actually make the player say something, you could use them for private npc interactions. One example of this would be to set a passcode that is required in order for something to happen (being able to open a door, zone somewhere, summon an item, spawn a mob, enter an instance, etc). I tried doing this in game and it works fine. The script just creates saylinks for the digits (0-9) and then a saylink for resetting the passcode and a saylink for submitting the passcode. When you click one of the digits, it adds that digit to $passcode[$cid] which is an array of passcodes where the index is the character's id (This is so any number of players can use the script at the same time without messing each other up). When you click [reset passcode], it sets $passcode[$cid] back to empty and when you click [submit passcode], it checks $passcode[$cid] against $check, the variable that the correct passcode is stored in. If they match, access is granted and you can flag the player or do whatever you wanted to do. If they don't match, it denies them access.

Code:
$check = 52213; # the passcode to check against: can also load it from a global/file/etc

sub EVENT_SAY
{
	$cid = $client->CharacterID(); # gets the character's id and uses it as the index for the @passcode array
	@args = split(/ /, $text); # split up $text by spaces and store each word/number/etc in the @args array

	if($args[0]=~/hail/i)
	{
		InitSaylinks();
		ShowMenu();
	}
	if($args[0]=~/push/i)
	{
		$passcode[$cid] = $passcode[$cid] . $args[1];
		ShowMenu();
	}
	if($args[0]=~/reset/i)
	{
		$passcode[$cid] = "";
		ShowMenu();
	}
	if($args[0]=~/enter/i)
	{
		if($passcode[$cid] eq $check)
		{
			$client->Message(15, "Access granted!");
			$passcode[$cid] = "";
			# now do whatever you wanted to do: open door, move player to location, move player to another zone, spawn a mob, summon an item, etc
		}
		else 
		{ 
			$client->Message(13, "Wrong passcode! Access denied!"); 
			$passcode[$cid] = "";
			ShowMenu();
		}
	}
}

sub InitSaylinks
{
	my $count = 0;
	while($count < 10) { 
		$sl_push[$count] = Saylink("push " . $count, $count);
		$count++;
	}
	$sl_reset = Saylink("reset","[Reset passcode]");
	$sl_enter = Saylink("enter","[Submit passcode]");
}

sub Saylink
{
	my $saylink = quest::saylink($_[0]);
	my $length = length(substr($saylink,46)) - 1;

	if($_[1] ne "") { substr($saylink,46,$length,$_[1]); }
	
	return $saylink;
}

sub ShowMenu
{
	if($passcode[$cid]) { $client->Message(4, "You have entered: $passcode[$cid]"); }
	$client->Message(4, "Enter passcode: @sl_push $sl_reset $sl_enter");
}
It would end up looking something like this (correct passcode is 52213 in this example):
Reply With Quote
  #7  
Old 06-11-2009, 05:19 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

That passcode idea is pretty neat. I am not sure of any places where I would use something like that, but I always love to see innovative ideas to push the limits of what we can do with the emulator systems available.

As for making the saylinks so they don't actually say what they click, that isn't too hard. I think we can just do the parse of the text right in the place were we currently send the message to the NPC. Though, it might take a bit of extra code to ensure that it doesn't cause other issues. Using the parse at that point is exactly how I originally tested saylinks (mentioned at the beginning of this thread), so I know it works.

I have been thinking about adding in a rule to allow admins to decide whether they want their saylinks to cause the players to actually say the message or not. But, another route might be to add in a second variation to the command. Maybe something like "ssaylink()" for Silent Saylink, or something to that effect. Then, one could chose either type for any scenario instead of having to chose 1 or the other for the entire server. The coding is already all there, so it would mostly just be adding the new command and the parse code. I think to differentiate between the 2 types of saylinks, we could just have the silent saylinks set their item ID to a much higher range. Since normal saylinks are set in the 500k range, the silent ones could be set to use the 1mil range or something like that.

I will try to look into getting this change added sometime soon, but I have a lot on my plate atm as usual, so no ETA. Glad to see people using the saylink system. I think it is a pretty neat little feature.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
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 01:34 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