ID:1408969
 
Code:
mob/verb/Vote()
set desc = "Start a vote for?"
switch(input("Start a vote.") in list ("Change Gamemode","Change Battle Conditions"))
if("Change Gamemode")
var/mob/X = input(src, "What would you like to create a vote for?","") in list("Gamemode: Free For All","Gamemode: Heroes vs. Villains","Gamemode: Team Deathmatch","Gamemode: Random")
if(X=="Gamemode: Free For All")
world<<"<u><b><font color=gold>Do you want to change the gamemode to Free For All?"
world<<"<a href=byond://?Yes>Yes: </a></u>[Y]"
world<<"<a href=byond://?No>No: [N]</a></u>"

// the topic

client/Topic(href)
if(href == "Yes")
if(VotedAlready==1)
usr<<"Trying to vote again? You sly dog you."
return
if(CurrentVote=="")
usr<<"There is no vote at this time."
return
usr << "You've voted yes."
Y+=1
if(href == "No")
if(VotedAlready==1)
usr<<"Trying to vote again? You sly dog you."
return
if(CurrentVote=="")
usr<<"There is no vote at this time."
return
usr << "You've voted no."
N+=1
else ..()


Problem description: Neither [Y] or [N] Change in world chat when someone votes.

Where are Y and N defined?
It could possibly be the way he is calling Topic()
In response to Liight
Liight wrote:
It could possibly be the way he is calling Topic()

client/Topic() is generally not called as a procedure; it's invoked during runtime using byond://? links. Everything after the ? gets sent to client/Topic() as the href argument.
In response to Super Saiyan X
Super Saiyan X wrote:
Where are Y and N defined?

Defined?
Yeah, var N, Y ?
The variables Y and N...where is their definition statement, are they under an object, or global or...?
Global.

var/
Y=0
N=0
How are you checking if Y and N change? From the code you've given, the two lines will always output the value of Y and N when you initiate a poll. You don't even clear the votes each time the voting process is initialized.
In response to Super Saiyan X
Super Saiyan X wrote:
How are you checking if Y and N change? From the code you've given, the two lines will always output the value of Y and N when you initiate a poll. You don't even clear the votes each time the voting process is initialized.

I'm working on the clearing process. I was trying to fix this before going into that.
So how can you tell if Y or N changed? Simple output ? There should be another proc that shows Y and N?
I thought it was as simple as outputting both Y/N, but I guess I was wrong. // I tried another proc to call them, it didn't go so well on my attempt. So I deleted it and continued on with other ways at it.
You could output the results of a vote after a certain time, or output each time someone has voted.
I guess I'll try it that way.
var/Yvote = 0, Nvote = 0
var/current_gamemode = ""
mob/var
voted = FALSE

mob/verb
Vote()
set desc = "Start Vote"
if (current_gamemode) return //If already a voting session return

input (src, "Start a vote.") in list ("Change Gamemode")
if ("Change Gamdemode")

var/value = input (src, "What would you like to change it to?") in list ("Free For All")

if (value == "Free For All")

for (var/mob/M in world) //Loops through everyone
if (M.client)
setVote (alert(M, "Change gamemode to FFA?", "Vote", "Yes", "No"))

current_gamemode = value

mob/proc

updateVote()
world << current_gamemode //Prints the results

world << "Vote: Yes [Yvote]"
world << "Vote: No [Nvote]"

setVote(vote)
if (vote == "Yes")
Yvote++

if (vote == "No")
Nvote++

updateVote()
Something like that ^
I did something more dumb down then that x.x
that's a pretty bad example to follow anyways.
Is just an example, is not meant to be copied.
For an example, I think I understand how too do it.
Glad I could help :3