Taking Turns

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
Sydious
Giant
Posts: 155
Joined: Sun Aug 21, 2011 2:27 am

Taking Turns

Post by Sydious »

I have been troubleshooting this since wednesday, and I can't see what I am doing wrong. The more I read the more I think I may be loosing token focus for my macros to work maybe, but I am not really sure if that is the issue or not.

I'm trying to control turn order.

I use 1 macro to start the game - stored on the Lib:token clicked by the GM.This initializes variables on the Lib:token. It scans for connected players and logs that as a list on the Lib:token. It then fires a macro using the macro roll option to roll for turn order.

Code: Select all

[h, macro("rollTurnOrder@Lib:DQ"):outputPlayer]
The rollForTurnOrder macro - looks at the Lib:token for the current player prop and sends that (The GM is player 0 in the connected players list of course) which pops a dialog up and has them click a submit button that rolls a d6 for turn order by firing the processRoll macro using

Code: Select all

[h: processorLink = macroLinkText("processTurnOrderRoll@Lib:DQ", "all", macro.args)]
The processRoll Macro - rolls a d6 (and a d999999999 for tie breaks) and then checks what player number its on. It then sends a dialog window to the current player until all the players have rolled. It logs the rolls and players and puts them in order from highest to lowest and stores it on the Lib:token as a list of names. It then fires the setTurn Macro using

Code: Select all

[r, macro("startCharSelect@Lib:DQ"):""]
startCharSelect macro - basically just broadcasts that char selection is starting, and then determins what player won the roll and fires the charSelect macro using:

Code: Select all

[r: broadcast( macroLink("", "charSelect@Lib:DQ", "none", outputPlayer), outputPlayer)]
charSelect macro - is a dialog of checkboxes for each player to select and press a submit button. form action fires the processCharSelect macro.

Code: Select all

[h: processorLink = macroLinkText("processCharSelect@Lib:DQ", "all")]
and finally the processCharSelect macro - checks the current player and start building a list of players and char names and stores it on the lib:token. I then want to fire the next steps and so on.

I have screwed up my code somewhere, and when I get to the last macro. Everything stops. Seems like sometimes it works correctly and sometimes it bombs out and stops.

Sorry for the lengthy post, but I am wondering if maybe I am doing things the hard way again, and loosing focus somewhere or something by broadcasting macrolink and passing the "responsibility" of fireing the next macro in line to a the next player. So sometimes the gm fires the macro that would move to the next step in the macro chain, and sometimes its one of the other players. I assume this could cause issues if each player is esentially updating the Lib:token on thier turn.

Should I or is there a "smarter" or "safer" way to be doing this?

Like should some of this be handled through UDF or something?

Post Reply

Return to “Macros”