collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: creating a chatcmd that references another chatcmd - need help  (Read 2506 times)

0 Members and 1 Guest are viewing this topic.

Offline Shelly

  • BeBot Apprentice
  • ***
  • Posts: 192
  • Karma: +0/-0
creating a chatcmd that references another chatcmd - need help
« on: October 10, 2009, 08:15:53 pm »
I am trying to create a module that will interface with the current Loot.php module.

I want to be able to supply a referenced item via a clickable link that then calls a chatcmd to add the item to the loot list.

I can do it so that the text is displayed, but can't seem to get a link setup so someone can see the details of the item. Neither of the $addlink methods below seen to work correctly.

Here is a snippit of my code:
Code: [Select]
        function show_loot($name, $boss)
        {
                if(!empty($boss))
                {
                        //List all loot for a given boss.
                        $query = "SELECT id, name, ref, img FROM #___Loot WHERE boss = '$boss'";
                        $loots = $this -> bot -> db -> select($query, MYSQL_ASSOC);
                        if(!empty($ploots))
                        {
                                $num = 0;

                                $window = "<header>##highlight##::::: BOSS Loot :::::##end##<end>\n\n\n";
                                $window .= "##highlight##$boss##end##\n\n";
                                foreach($loots as $ploot)
                                {
                                        $num++;
                                        $ref = $ploot[ref];
                                        $img = $ploot[img];
                                        $pname = $ploot[name];
                                        $addlink = $this -> bot -> core("tools") -> chatcmd("loot add [<a href=\'itemref://{$ref}/{$ref}/300\'></a>]", "Add to Loot List", 0);
                                        //$addlink = "<a href='chatcmd:///tell ".$this -> bot -> botname." <pre> loot add [<a href=\'itemref://{$ref}/{$ref}/300\'></a>] . '>' . "Add to Loot List" . '</a>";
                                        $window .= "<a href='itemref://{$ref}/{$ref}/300><img src=rdb://{$img}></a>\nItem: <highlight><a href='itemref://{$ref}/{$ref}/300'>$pname</a><end>\n".$addlink."\n";
                                        $window .= "\n";

                                }
                                return $this -> bot -> core("tools") -> make_blob("Availible BOSS loot for $boss", $window);
                        }
 
I am running the 0.6.5 BeBot and PHP 5.2.6

Offline Shelly

  • BeBot Apprentice
  • ***
  • Posts: 192
  • Karma: +0/-0
Re: creating a chatcmd that references another chatcmd - need help
« Reply #1 on: October 12, 2009, 01:05:54 am »
Update to the code:
Code: [Select]
                                $window = "<header>##highlight##::::: $command BOSS Loot :::::##end##<end>\n\n\n";
                                $window .= "##highlight##\t\t$boss##end##\n\n";
                                //echo "found pande loot";
                                foreach($rloots as $rloot)
                                {
                                        $num++;
                                        $addt = "Add above to Loot Roll";
                                        $ref = $rloot[ref];
                                        $img = $rloot[img];
                                        $pname = $rloot[name];
                                        $pref  = "<a href='itemref://{$ref}/{$ref}/300";

                //Works Text Mode ->    $addlink = $this -> bot -> core("tools") -> chatcmd("loot \"$pname\"", "Add to Loot List", 0);
                                        //$addlink = $this -> bot -> core("tools") -> chatcmd("loot \"$pname\"", "Add to Loot List", 0);
                //works sorta ->        $addlink = $this -> bot -> core("tools") -> chatcmd("loot <a href=\\\'itemref://{$ref}/{$ref}/300>", "$pname", 0);
                                        //$addlink = $this -> bot -> core("tools") -> chatcmd("loot <a href=itemref://{$ref}/{$ref}/300", "$pname", 0);
                //Informational ->      "<a href='itemref://257964/257964/1'>Visible Light Remodulation Device</a> "
                /* Active */            $addlink = "<a href='chatcmd:///tell ".$this -> bot -> botname." loot <a href=itemref://{$ref}/{$ref}/300>Add $pname to loot roll</a>'</a><br><br>";
/*Testing Code ->*/                     echo "$num = $addlink\n";

                //Works Text Mode ->    $window .= $this -> bot -> core("tools") -> chatcmd("loot <a href='itemref://{$ref}/{$ref}/300", "$pname", 0);
                //Basic Works ->        $window .= "<a href='itemref://{$ref}/{$ref}/300><img src=rdb://{$img}></a>\nItem: <highlight><a href='itemref://{$ref}/{$ref}/300'>$pname</a><end>\n".$addlink."\n";
                //Works Mode Text ->    $window .= "<a href='itemref://{$ref}/{$ref}/300><img src=rdb://{$img}></a>\nItem: <highlight><a href='itemref://{$ref}/{$ref}/300'>$pname</a><end>\n\t\tAdd ".$addlink."\n";
                /* Active */            $window .= "<a href='itemref://{$ref}/{$ref}/300><img src=rdb://{$img}></a><highlight><a href='itemref://{$ref}/{$ref}/300'>$pname</a><end>\n";
                /* Active */            $window .= $addlink;
                /* Active */            $window .= "\n\n";
/*Testing Code ->*/                     echo "$num = $window\n";

                                }
                //Works ->      return $this -> bot -> core("tools") -> make_blob("Availible $command loot for $boss", $window);
                //Informational -> return "<a href=\"text://" . $content . "\">" . $title . "</a>";
                /* Active */    return "<a href=\"text://" . $window . "\">Availible $command loot for $boss</a>";

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: creating a chatcmd that references another chatcmd - need help
« Reply #2 on: October 13, 2009, 01:37:41 pm »
I haven't really checked your 2nd post, but if you want working item references and a link to add the item to loot you need to use two seperate links.

First create the item reference as always, and afterwards but completely seperated create the ADD link offering the chat command. I don't think the parser can seperate the links otherwise.

Something like (extremely shortened):
Code: [Select]
<a href='itemref:...'>Itemname</a> <a href='chatcmd=...'>[ADD]</a>

Offline Shelly

  • BeBot Apprentice
  • ***
  • Posts: 192
  • Karma: +0/-0
Re: creating a chatcmd that references another chatcmd - need help
« Reply #3 on: October 21, 2009, 02:43:24 am »
Thanks,

I did try to do that and really got a lot of mixed results... examples are in the 2nd code snippet.

I still have not figured out a way to do what I want to do... But I keep searching and testing.  :D

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 765
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal