Shoutbox

Help in C. how to... - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: Help in C. how to... (/showthread.php?tid=26356)

Help in C. how to... by crank on 05-30-2004 at 09:15 AM

I'm making a plug-in for the moment but i've got a problem...
It must be simple but I can't find my mistake.
PLEASE HELP!

code:
MPPLUGIN_RETURN_BOOL PublishInfo(/*[out]*/ char *sPluginName,
                                 /*[out]*/ PLUGIN_PUBLISH_LIST* aCommands,
                                 /*[out]*/ PLUGIN_PUBLISH_LIST* aTags)
{
    //Copy the name of the plugin
    strcpy(sPluginName, "EXAMPLE");

    //Set the commands help
    aCommands->nCount = 1;
    strcpy(aCommands->sName[0], "EXAMPLE");
    strcpy(aCommands->sValue[0], "xEXAMPLE");
    strcpy(aCommands->sHelp[0], "EXAMPLE.");
   
    //Set the tags help
    aTags->nCount = 2;
    strcpy(aTags->sName[0], "example");
    strcpy(aTags->sValue[0], "(!xexample)");
   
    //Set the tags help
    aTags->nCount = 2;
    strcpy(aTags->sName[0], "example1");
    strcpy(aTags->sValue[0], "(!xexample1)");

    return TRUE;
}


That code should show a menu.
It does but it only shows:
code:
EXAMPLE
------------
example1

--> It doesn't show the 'example' Tag. I tried to change the nCount Value but it doesn't help. Can anyone help me with this???

Edit: I had an idea I'm trying it now, but if you have a solution please PM me.
I tried this:
code:
    //Set the tags help
    aTags->nCount = 2;
    strcpy(aTags->sName[0], "QT hello");
    strcpy(aTags->sValue[0], "(!XQThello)");
    strcpy(aTags->sName[1], "QT insult");
    strcpy(aTags->sValue[1], "(!XQTinsult)");
Still doesn't work!
RE: Help in C. how to... by Mnjul on 05-30-2004 at 09:18 AM

sName, sValue...etc are arrays, you should increase the array index when assigning different values to different array elements :)

code:
MPPLUGIN_RETURN_BOOL PublishInfo(/*[out]*/ char *sPluginName,
                                 /*[out]*/ PLUGIN_PUBLISH_LIST* aCommands,
                                 /*[out]*/ PLUGIN_PUBLISH_LIST* aTags)
{
    //Copy the name of the plugin
    strcpy(sPluginName, "EXAMPLE");

    //Set the commands help
    aCommands->nCount = 1;
    strcpy(aCommands->sName[0], "EXAMPLE");
    strcpy(aCommands->sValue[0], "xEXAMPLE");
    strcpy(aCommands->sHelp[0], "EXAMPLE.");
   
    //Set the tags help
    aTags->nCount = 2;
    strcpy(aTags->sName[0], "example");
    strcpy(aTags->sValue[0], "(!xexample)");
   
    strcpy(aTags->sName[1], "example1");
    strcpy(aTags->sValue[1], "(!xexample1)");

    return TRUE;
}


RE: Help in C. how to... by crank on 05-30-2004 at 09:23 AM

quote:
Originally posted by Mnjul
sName, sValue...etc are arrays, you should increase the array index when assigning different values to different array elements :)


Thanks...
Do I need to change this to??
code:
if(strcmp(sTag, "(!XQThello)") == 0)
->
code:
if(strcmp(sTag, "(!XQThello)") == 1)

EDIT:
Well it worked without changing this so thanks!
RE: Help in C. how to... by Mnjul on 05-30-2004 at 09:38 AM

The return value of strcmp:

quote:
Originally posted by MSDN Library

The return value for each of these functions indicates the lexicographic relation of string1 to string2.

Value Relationship of string1 to string2
< 0 string1 less than string2
0 string1 identical to string2
> 0 string1 greater than string2


RE: Help in C. how to... by crank on 05-30-2004 at 02:56 PM

Thank you guys but I'm currently having another problem.
I'm wondering how to make Text formatting work.
Ow yeah and is there a way to use the sContactName to output the contacts name in a message??? I tried several ways but nothing worked.

The last one is my biggest isue...