ID:2218603
 
(See the best response by Lummox JR.)
Code:
obj
Scoreboard
icon = 'Scoreboard.dmi'
Track
layer = 4
IronThrone
icon_state="IronThrone"
screen_loc="scoreboard:1,3"
Click()
beenClicked(usr)

beenClicked(var/mob/Player/clicker)
if(PHASE == "AKBTW-Win")
if(clicker == Highest)
movePlayer(Highest, IronThrone, 1)
world<<"[Highest] has moved to the top of the Iron Throne track."
c_endCardPhase()
s_updateScoreboard()

Fiefdoms
icon_state="Fiefdoms"
screen_loc="scoreboard:1,2"
Click()
beenClicked(usr)

beenClicked(var/mob/Player/clicker)
if(PHASE == "AKBTW-Win")
if(clicker == Highest)
movePlayer(Highest, Fiefdoms, 1)
world<<"[Highest] has moved to the top of the Fiefdoms track."
c_endCardPhase()
else
world<<"got to fiefdoms click: [clicker], PT [PlayerTurn]"
if(PHASE == "AKBTW-Loss")
if(PlayerTurn == clicker)
movePlayer(PlayerTurn, Fiefdoms, Fiefdoms.len)
world<<"[PlayerTurn] has moved to the bottom of the Fiefdoms track."
var/list/others = IronThrone.Copy()
if(!others.Remove(Lowest))
world<<"ERROR - could not remove Lowest bidder: [Lowest] from IronThrone during [PHASE]."
return 0
if(others[others.len]==clicker) // If the last person's turn, then run the penalty for Lowest bidder
PHASE="AKBTW-Lowest"
WACARD.lowestEffect()
s_updateScoreboard()

Raven
icon_state="Raven"
screen_loc="scoreboard:1,1"

Click()
beenClicked(usr)

beenClicked(var/mob/Player/clicker)
world<<"got to Raven click: [clicker], PT [PlayerTurn]"
if(PHASE == "AKBTW-Win")
if(clicker == Highest)
movePlayer(Highest, Raven, 1)
world<<"[Highest] has moved to the top of the Raven track."
c_endCardPhase()
else
if(PHASE == "AKBTW-Loss")
if(PlayerTurn == clicker)
movePlayer(PlayerTurn, Raven, Raven.len)
world<<"[PlayerTurn] has moved to the bottom of the Raven track."
var/list/others = IronThrone.Copy()
if(!others.Remove(Lowest))
world<<"ERROR - could not remove Lowest bidder: [Lowest] from IronThrone during [PHASE]."
return 0
if(others[others.len]==clicker) // If the last person's turn, then run the penalty for Lowest bidder
PHASE="AKBTW-Lowest"
WACARD.lowestEffect()
s_updateScoreboard()


Problem description:

These all work as intended, however the if(PHASE == "AKBTW-Loss") of each one is essentially the same, albeit affecting a different global list.

Is there any way I could pass beenClicked() a different variable depending on which obj/Scoreboard/Track was clicked?



I was gonna mention it last thread, but you really should have been making faction datums rather than cramming all those lists into the global scope.

Your question is a consequence of trying to just use global lists for everything rather than defining a datum and abstracting the behavior.
I'm afraid I don't fully comprehend. I'm not sure what you mean by factions (my Houses? Or the Tracks that store the relative 'positions' of the players: The Raven, Fiefdoms, and Iron Throne?)

Also, besides this application where I could 'locate(tag)' I'm not sure I see the advantage of using a datum instead of three global lists?

I'm not a fan of using a buttload of globals, but this seemed the easiest/fastest way for me to get to the meat of the programming, and get this bloody game out the door.

P.s., my use of the word "bloody" is tongue-in-cheek, most likely due to my Britishness, and not out of any frustration/ire.
Yes, each House should track its win/loss info with a datum. This avoids the need for all that if/else behavior.
I'm sorry, I swear I'm not trying to be stupid, but I still don't follow.

Each of the above Tracks (which aren't Houses, my last post was a little ambiguous so I've edited it) exists as one instance in the world. They are just for keeping the players in three different orders: turn order (Iron Throne), winner of draws in battle (Fiefdoms) and amount of special abilities (Raven).

As far as I can comprehend, they don't have win/loss info.

In a certain phase of the game a card is drawn from a deck, and that card is bid on by all players. The highest bid "wins" and the lowest bid "loses". One of those cards then let's players click on the Tracks to move to the top or bottom, depending if they were a "loser" or a "winner", or something in between.
In response to Ease
Best response
The key here is, moving up and down in a track is something that is happening more than once, so you have repeated code. You have three tracks, each with their own list, and a player can move to the top or the bottom of one of them. But you're using if/else code to decide which list to look at and what message to output, resulting in a lot of repetitive code.

The way this should be organized is either via an associative list of datums, or an associative list of lists. (If the track involves anything besides a list, a datum is a better choice than a list.) Having differently named global vars really doesn't gain you anything but complexity and repetition.
That makes sense, thank you. I'll adopt that.

But, just for my own clarification, the associative list of datums/lists would still essentially be a global var?
Indeed. I see no reason for the main associative list not to be a global. The important thing is that you have the ability to look up whatever list or datum you need by name.