RPTools.net

Discussion and Support

Skip to content

It is currently Mon May 20, 2013 11:14 am 






Reply to topic  [ 4 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Sat Dec 18, 2010 7:51 am
Posts: 1
 Post subject: Exalted Initiative
PostPosted: Sat Dec 18, 2010 10:30 am 
I've written a series of macros for a library token that enable players and GMs to use. In order to do this, I modified zend0g's Exalted dice roller (found here)

The library token was called Lib:roller and I ended up using HP for the number of dice rolled in a join battle, though both these can be changed.
Never to be used directly
myAction
Code:
[h: speed = json.get(macro.args,0)]
[h: currentInit = getInitiative()]
[h: roundInit = getInitiativeRound()]
[r, IF(currentInit ==  roundInit), code:{
    <b>Finished !</b>
    Action Speed: [r:speed]
    [h: setInitiative(currentInit + Speed)]
    [MACRO("SortInit@Lib:roller"): "TurnDone"]
};{
    [assert(0, "<b>Not Your Turn</b>", 0)]
}]


NiceDisplay
Code:
[h: name = json.get(macro.args, 3)]
[h: Roll = json.get(macro.args, 2)]
[h: result = json.get(macro.args, 1)]
[h: successes = json.get(macro.args, 0)]

[h: colour =" "]
[h, IF(result==' Success!'): colour = "green"]
[h, IF(result==' BOTCHED!'): colour = "red"]
[r: name]: <b><font color="[r:colour]">[r:result]</font></b>[r: " "][t ("("+successes+")"):Roll]


Roller
Code:
[h: dataInLength = json.length(macro.args)]
    [h: numDice = json.get(macro.args, 0)]
    [h: difficulty = json.get(macro.args, 1)]
[h, IF(dataInLength >2), CODE:{
    [h: explode = json.get(macro.args, 2)]
}]
    [h: explode = "True"]

[h: i=0][h: diceArray='[]']

[h, while(i <numDice), CODE:{
    [h: theRoll=1d10]
    [h: diceArray=json.append(diceArray,theRoll)]
    [h: i=i+1]
}]

[h: diceArray=json.sort(diceArray)]

[h: txtResult='']
[h: numSuccess=0]
[h: numFail=0]
[h: numFumble=0]
[h: diceResults="("]

[h,count(json.length(diceArray)), CODE:{
    [h: thedie=json.get(diceArray,roll.count)]

    [h,IF(thedie>=difficulty),CODE:{
        [h: numSuccess=numSuccess+1]
    }]

        [h,IF((thedie==10)&&(explode=="True")),CODE:{
            [h: numSuccess=numSuccess+1]
        }]

    [h,IF(thedie ==1),CODE:{
        [h: numFumble=numFumble+1]
    }]

    [h,IF((thedie>=2)&&(thedie<difficulty)),CODE:{
        [h: numFail=numFail+1]
    }]

    [h:diceResults = diceResults + " " + thedie]
}]

    [h,IF(numSuccess>0), CODE:{
        [h: txtResults=' Success!']
    }]
    [h,IF((numFumble>0)&&(numSuccess==0)), CODE:{
        [h: txtResults=' BOTCHED!']
    }]
    [h,IF((numFail>0)&&(numSuccess==0)&&(numFumble==0)), CODE:{
        [h: txtResults=' Failed!']
    }]

[h:diceResults = diceResults + " )"]

[h:returnData = '[]']
[h:returnData = json.append(returnData, numSuccess)]
[h:returnData = json.append(returnData, txtResults)]
[h:returnData = json.append(returnData, diceArray)]
[h:macro.return=returnData]


SortInit
Code:
[h: argsLength = json.length(macro.args)]
[h: initLength = initiativeSize()]
[h: initTick = getInitiativeRound()]
[h: toDo = "Nothing"]

[h, IF(argsLength == 1), CODE:{
    [h: toDo = json.get(macro.args, 0)]
}]
[h, IF(toDo == "Begin"), CODE:{
    [h: setInitiativeRound(0)]
    [h: initTick = getInitiativeRound()]
}]
[h, IF(toDo == "Next"), CODE:{
    [h: initTick = initTick + 1]
    [h: setInitiativeRound(initTick)]
}]

[h: sortInitiative()]
[h: setCurrentInitiative(initLength-1)]

[h: currentTokenID = getInitiativeToken()]
    [h: switchToken(currentTokenID)]
    [h: initTickAction = getInitiative()]
    [h: initDiff = initTickAction - initTick]
    [h: name = getName()]
    [ IF(initDiff == 0), CODE:{
        <br>
        Time for <b>[r:name]</b> to kick donkey
        [h: setInitiativeHold(0)]
    };{}]
    [ IF(initDiff > 0), CODE:{
        <br>
        Time til [r:name] is up: <b>[r:initDiff] Ticks</b><br>
        Anyone moving this tick?
        [h: setInitiativeHold(1)]
    };{}]
    [ IF(initDiff < 0), CODE:{
        <br>
        <b><font color="red">Hold Up !</font></b><br>
        You skipped [r:name] ! Moving back...
        [h: setInitiativeRound(initTickAction)]
    };{}]


GM Macros
Add PCs to Init (because it seems stupid not to have it)
Code:
[h: addAllPCsToInitiative()]


Setup Init
Code:
[h: initList = getInitiativeList() ]
[h: tokens = json.get( initList, "tokens" )]

[h, foreach(token, tokens),code:{
    [h: tokenStr = json.toStrProp(token)]
    [h: varsFromStrProp(tokenStr)]
    [h: tokenInit = json.get(token, "initiative")]
    [if(tokenInit==""), CODE:{
        [h: joinBattle = getProperty("HP", tokenId)]
        [h: jsonData = json.append(joinBattle, 7)]
        [MACRO("Roller@Lib:roller"): jsonData]
        [h: returnData=macro.return]
        [h: successes = json.get(returnData, 0)]
        [h: init = 6 - successes]
        [h: init = max(0, init)]
        [h: init = min(6, init)]
        [h: switchToken(tokenID)]
        [h: setInitiative(init)]
   }]
}]
[MACRO("SortInit@Lib:roller"):"Begin"]


Next Tick
Code:
[MACRO("SortInit@Lib:roller"):"Next"]


Macros for Tokens to Use
Action Performed (players call this and pass it the speed of their action)
Code:
[h: speed = ActionSpeed]
[MACRO("myAction@Lib:roller"): speed]


Exalted Roller (might as well include the interface for the roller)
Code:
[h: status=input(
"name|Roll|Name of Roll?",
"numDice|10|Number of dice?",
"difficulty|7|Target Number?",
"explode|True,False|Double 10s?|LIST|SELECT=0|VALUE=STRING"
)]
[h: abort(status)]

[h:jsonData = json.append(numDice, difficulty, explode)]
[MACRO("Roller@Lib:roller"): jsonData]

[h:returnData=macro.return]
[h:returnData=json.append(returnData, name)]
[MACRO("NiceDisplay@Lib:roller"): returnData]



I'm sure the code could be improved upon, anyway, hope it helps.


Top
 Profile  
 
User avatar  Offline
RPTools Team
 
Joined: Tue Feb 07, 2006 1:07 am
Posts: 1738
Location: Austin, Tx
 Post subject: Re: Exalted Initiative
PostPosted: Tue Jan 25, 2011 1:05 pm 
This is Maptool scripting, which does not work in Init Tool. You should probably post this information their instead.


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 11622
Location: Tampa, FL
 Post subject: Re: Exalted Initiative
PostPosted: Tue Jan 25, 2011 5:48 pm 
Heh, good point. I've moved this from the InitTool forum to the UserCreations forum.

_________________
Interested in Time Magazine's Best Invention of 2008 Unix-powered laptop? No crashes or lockups. In fact, that series of articles has two such machines. The other is a Dell netbook. :)


Top
 Profile  
 
 Offline
Kobold
 
Joined: Thu Feb 10, 2011 3:06 am
Posts: 1
 Post subject: Re: Exalted Initiative
PostPosted: Thu Feb 10, 2011 3:15 am 
I'd like to hear more about how this went. I am working on running an Exalted game via MapTools.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 4 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 3 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman