EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=590)
-   -   Say Links (https://www.eqemulator.org/forums/showthread.php?t=27873)

Krugus 06-06-2009 11:37 PM

thanks for the info Cavedude :)

trevius 06-07-2009 03:49 AM

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.

Krugus 06-07-2009 01:31 PM

...
 
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 :)

Sion 06-11-2009 04:46 PM

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):
http://img268.imageshack.us/img268/4...example.th.jpg

trevius 06-11-2009 05:19 PM

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.

Shendare 06-11-2009 05:27 PM

I like the idea of having the option for silent as well as visible saylink responses.

If one is not using silent saylinks, I also like the idea of being able to specify the text being said by the player when they click on the link, instead of making it always the text of the link itself.

"Hail, Player! Would you be interested in helping me with this [task]?"

*click [task]* "What task is that?"

...as opposed to:

*click [task]* "task"

- Shendare

trevius 06-11-2009 06:30 PM

Sion already mentioned a way to do that with Perl, but I do agree that it would be nice to have the option to do it directly with the command.

The only reason to have a table for saylinks is so the server knows what phrase to associate with whichever saylink is being clicked. So, basically whatever gets put into that table is what the server will use to parse (or have the client /say) when the link is clicked.

This means that we should be able to set a second argument for the command that is optional. If the second argument is set, then that second phrase/argument would be the one that appears in the actual link in the text of the NPC. I am not that great with coding optional arguments for quest commands yet, but I can maybe try to add that in as well at some point. Again, most of the code needed for this to work should already be there. Basically, the saylink() command would just need to check for a second argument and if one exists, it uses that argument for creating the actual itemlink, but it still does the query of the saylink table based on the first argument.

If this functionality was added, it should work something like this:
Code:

sub EVENT_SAY {

my $test = quest::saylink(""Yes, I would like to test a saylink","test a saylink");
my $click = quest::saylink("I need to click something?","click");
my $say = quest::saylink("say");

  if($text=~/hail/i)
  {
    quest::say("Hello, $name.  Would you like to [$test]? If so, simply [$click] on the pink text and wait for my response.  You may also simply /$say the message like normal if you prefer that method instead.");
  }

  if($text=~/test a saylink/i)
  {
    quest::say("The test was a huge success!  Well done :P");
  }

  if($text=~/click/i)
  {
    quest::say("Yes, click the pink text exactly like you just did!");
  }

  if($text=~/^say$/i)
  {
    quest::say("Saying or clicking the text is the same thing to me!");
  }

}

Where the values put into the saylink table (as well as what the character would appear to say when clicking the link) would be the first argument and the values in the second argument would be only for the text that shows up in the link itself when the NPC says it.

trevius 07-19-2009 06:53 AM

I added a new bool option for the saylink command to allow them to be silent. More info can be found on the wiki page here about it:

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

trevius 07-21-2009 09:28 AM

Quote:

Originally Posted by Shendare (Post 171942)
I like the idea of having the option for silent as well as visible saylink responses.

If one is not using silent saylinks, I also like the idea of being able to specify the text being said by the player when they click on the link, instead of making it always the text of the link itself.

"Hail, Player! Would you be interested in helping me with this [task]?"

*click [task]* "What task is that?"

...as opposed to:

*click [task]* "task"

- Shendare

I updated Saylinks again so this is now an option. If you wanted to set a saylink to do what Shendare is showing in this quote, you would do this:

Code:

my $task = quest::saylink("What task is that?", 0, "task");

quest::say("Hail, $name! Would you be interested in helping me with this [$task]?");

The 0 in the middle is the bool for being silent or not, so when making different responses from what the link shows, it only makes sense to set it as 0 so the player says the message.


All times are GMT -4. The time now is 02:56 AM.

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