Author Topic: How would I go about setting responses to YesNoMsgBox?  (Read 1580 times)

I just thought about how would a messageBoxYesNo would work, and I don't know how, could some one explain?

function servercmdTest(%client)
{
   commandtoclient(%client, 'messageBoxYesNo', "Testing.", "\c6Are you gay?");
}

Quote from: Changelog 10 to 11
Added clientCmds for messageboxYesNo and messageBoxOKCancel
    clientCmdMessageBoxOKCancel(%title, %message, %okServerCmd)
        %okServerCmd is a tagged string that will be sent as a commandtoserver of the user clicks "ok". If they click "Cancel" commandToServer('MessageBoxCancel'); will be sent.
    clientCmdMessageBoxYesNo(%title, %message, %yesServerCmd)
        %yesServerCmd is a tagged string that will be sent as a commandtoserver of the user clicks "yes". If they click "no" commandToServer('MessageBoxNo'); will be sent.

Still a bit confused.

Code: [Select]
function servercmdTest(%client)
{
    %client.AreYouGayBox = 1;
    commandtoclient(%client, 'messageBoxYesNo', "Testing.", "\c6Are you gay?", 'YesIAm');
}
function servercmdYesIAm(%client)
{
    if(!%client.AreYouGayBox) return;
    %client.AreYouGayBox = 0;
    messageClient(%client,'',"What the forget");
}

function servercmdMessageBoxNo(%client)
{
    if(!%client.AreYouGayBox) return;
    %client.AreYouGayBox = 0;
    messageClient(%client,'',"Phew");
}

Don't know why he didn't just let us use a dynamic 'no' callback and forced us to put all the 'no' responses into a single function.