Author Topic: Client Sided Polls  (Read 1281 times)

This code won't work. I am not good with STR functions.

Code: [Select]
package AdamBotPoll
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
if(getSubStr(%msg,0,15) $= "--AdamBot_Poll")
{
%Poll = getSubStr(%msg,15,strLen(%msg));
CommandToServer('MessageSent',"There is a poll for: " @ %poll @ " say VoteYes or VoteNo for your vote. No punctuation. You have 30 seconds to vote.");
$Vote = 0;
switch$(%msg)
{
case "VoteYes": $Vote++;
case "VoteNo": $Vote--;
}
schedule(30000,0,"EndPoll()",%client);
}
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
}
};
activatePackage(AdamBotPoll);
« Last Edit: February 01, 2012, 08:15:15 AM by adam savage »

I'm not sure if it would work anyway. A clientsided mod would only be on your client, not anyone else's, so it would only work if you said VoteYes.

I'm not sure if it would work anyway. A clientsided mod would only be on your client, not anyone else's, so it would only work if you said VoteYes.

no, that isn't how client code works



I see a %msg and a %message out of nowhere.  That is probably why.

no, that isn't how client code works



I see a %msg and a %message out of nowhere.  That is probably why.
Woops. Lol. Fixed that up. still doesn't work.

I'm not sure if it would work anyway. A clientsided mod would only be on your client, not anyone else's, so it would only work if you said VoteYes.
Brian Smith can do it. Its possible.
« Last Edit: February 01, 2012, 08:15:31 AM by adam savage »

it is 100% possible, yet it would be much more complicated than this.

it is 100% possible, yet it would be much more complicated than this.
actually, you are 100% wrong.

Code: [Select]
package pollBot
{
function clientCmdChatMessage(%c,%a,%b,%fmsg,%cp,%name,%cs,%msg)
{
%return = parent::clientCmdChatMessage(%c,%a,%b,%fmsg,%cs,%name,%cp,%msg);
if(getWord(%msg,0) !$= "--AdamBot_Poll")
{
%topic = getWords(%msg,1);
commandToServer(‘messageSent’, "New Poll! Topic: \”” @ %topic @ “\”! Say \”Yes\” to vote for it, \”No\” to vote against it! The poll will end in 60 seconds. (The owner may type cancelVote to stop the vote)”);
$Vote::Tide=0;
$Vote::Owner = %name;
$Vote::Sched = schedule(60000,0,endVote);
}
else if(getWord(%msg,0) $= “Yes”)
$Vote::Tide++;
else if(getWord(%msg,0) $= “No”)
$Vote::Tide--;
else if(getWord(%msg,0) $= “cancelVote” && %name $= $Vote::Owner)
{
cancel($Vote::Sched);
$Vote::Tide=0;
commandToServer(‘messageSent’,”Vote canceled!”);
}
return %return;
}
function endVote()
{
if($Vote::Tide > 0)
commandToServer(‘messageSent’,”Voting on \”” @ $Vote::Topic @ “\” has concluded! Yes has won!”);
if($Vote::Tide < 0)
commandToServer(‘messageSent’,”Voting on \”” @ $Vote::Topic @ “\” has concluded! No has won!”);
if($Vote::Tide == 0)
commandToServer(‘messageSent’,”Voting on \”” @ $Vote::Topic @ “\” has concluded! It’s a tie!”);
}
}
activatePackage(pollBot);
Note: I'm in class and really bored, iPhone grammar may have broken something. Also, untested.
« Last Edit: February 05, 2012, 01:21:59 AM by Slicksilver »

actually, you are 100% wrong.
Nay, you are 100% wrong, I just made one today that works fine.

Nay, you are 100% wrong, I just made one today that works fine.
And I just made one using pretty much the same method as the OP that I can almost guarantee works.

Edit: and pretending you know more than me when 50% of the topics in coding help are yours is laughable
« Last Edit: February 01, 2012, 02:38:21 PM by Slicksilver »

And I just made one using pretty much the same method as the OP that I can almost guarantee works.
You said he was 100% wrong which was incorrect because he said it is possible and then you said he was 100% wrong which is implying that it is not possible.


And I just made one using pretty much the same method as the OP that I can almost guarantee works.

Edit: and pretending you know more than me when 50% of the topics in coding help are yours is laughable
There is nothing wrong with acquiring more knowledge and I do not "pretend" to know more then you.

i think slicksilver is having a bad day

I think you're misunderstanding the concept that the function is called every time someone chats.

You said he was 100% wrong which was incorrect because he said it is possible and then you said he was 100% wrong which is implying that it is not possible.
No, it implies that it wouldn't be more complicated. I didn't read the guys code but his method is similar to mine it just uses switches.