PDA

View Full Version : Code request



VenomousFiligree
October 4th, 2011, 23:19
My cut and paste skills are being tested to the extreme and have been found lacking.... :(

I would like a player editable string attached to a modifier, so that when the modifier is double clicked or dragged, I get the text attached to a 2d6 role + the modifier.

If anyone has the time, it would be greatly appreciated! :D

joshuha
October 5th, 2011, 00:47
This is how I did a FATE Diefield that uses the numberfield to make a die roll on double-click or drag. Instead of using the description XML tag you could use the .getValue of another stringfield (or goto the DB if its on another page).




<template name="fateNumber">
<numberfield>
<frame>
<name>modifier</name>
<offset>5,5,5,5</offset>
</frame>
<font>sheetnumber</font>
<min>0</min>
<script>
function onDragStart(button,x,y,dragdata)
dragdata.setType("dice")
dragdata.setDieList({"dF","dF","dF","dF"})
dragdata.setNumberData(getValue())
dragdata.setDescription(description[1])

return true
end
function onDoubleClick()
ChatManager.control.throwDice("dice", {"dF","dF","dF","dF"}, getValue(),description[1]);
end
</script>
</numberfield>
</template>

VenomousFiligree
October 5th, 2011, 06:54
Thanks Joshuha

It's the .getValue() for the stringfield that I've been having trouble with, how would I go about getting that? :confused:

Thanks in advance :D

joshuha
October 5th, 2011, 15:05
If it's on the same page something like


dragdata.setDescription(window.mystringfieldname.g etValue())

should work.

VenomousFiligree
October 5th, 2011, 18:42
Thanks :)

I couldn't get the die rolling to work (it didn't like throwDice) however I managed too get the string field attached to the dice code I had already :D