Can anyone help me please
Moderators: dorpond, trevor, Azhrei, Gamerdude
Can anyone help me please
Ok,
I have tried figuring this out, how do I get a macro to give a list of possible enemy targets so a player can select which target to attack?
Next once I get this how do I get a defense number from said target?
Thanks for the help guys, this will also help with a couple of other questions but the second question will answer enough so I can figure out coding for other things.
I am creating a campaign based on the anime "Is it wrong to try to pick up girls in a dungeon".
Players won't know any of the bonus's their stats get and am trying to automate most things so they can't figure it out.
ralstad
I have tried figuring this out, how do I get a macro to give a list of possible enemy targets so a player can select which target to attack?
Next once I get this how do I get a defense number from said target?
Thanks for the help guys, this will also help with a couple of other questions but the second question will answer enough so I can figure out coding for other things.
I am creating a campaign based on the anime "Is it wrong to try to pick up girls in a dungeon".
Players won't know any of the bonus's their stats get and am trying to automate most things so they can't figure it out.
ralstad
Re: Can anyone help me please
There are several examples for targeting (here is one: http://forums.rptools.net/viewtopic.php ... 52#p257652)
To get data from a token I recommend using Wiki: switchToken() and getProperty.
To get data from a token I recommend using Wiki: switchToken() and getProperty.
Fun anime. Second season airs in April, but not sure when English sub/dub will come out to US though.I am creating a campaign based on the anime "Is it wrong to try to pick up girls in a dungeon".
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Can anyone help me please
Ya, I loved the anime it was fantastic.
I thought it might be fun to play a D&D type game in that world.
The only thing the characters are going to know is just like in the anime they are going to know their ranking in their stats and any special abilities they gain over time and magic but not what anything really does.
The biggest problem is none of the frameworks I have seen work anywhere with this type of game, so building from the ground up.
I did a lot of VB programming and have a good hold on that and it seems a decent amount of the coding is similar but just not quite enough to truly start coding.
I have a quick question for anyone that will answer here is the formula I use to figure the number of attack a character will have
[R: (floor(if((Agility>799),round(Agility/200),floor(Agility/200))+if((Dexterity>799),round(Dexterity/200),floor(Dexterity/200))/6)+1)]
Now to explain in this formula you take the agility and dexterity modifiers, the ifs figure this part out, and add them together then divide them by 6 and add the starting 1 attack everyone starts with but for some reason on one character I tested it on with a dexterity of 300 and an agility of 400 it is totaling it out to 3 attacks but it should only be one, rounded down of course.
Thanks
I thought it might be fun to play a D&D type game in that world.
The only thing the characters are going to know is just like in the anime they are going to know their ranking in their stats and any special abilities they gain over time and magic but not what anything really does.
The biggest problem is none of the frameworks I have seen work anywhere with this type of game, so building from the ground up.
I did a lot of VB programming and have a good hold on that and it seems a decent amount of the coding is similar but just not quite enough to truly start coding.
I have a quick question for anyone that will answer here is the formula I use to figure the number of attack a character will have
[R: (floor(if((Agility>799),round(Agility/200),floor(Agility/200))+if((Dexterity>799),round(Dexterity/200),floor(Dexterity/200))/6)+1)]
Now to explain in this formula you take the agility and dexterity modifiers, the ifs figure this part out, and add them together then divide them by 6 and add the starting 1 attack everyone starts with but for some reason on one character I tested it on with a dexterity of 300 and an agility of 400 it is totaling it out to 3 attacks but it should only be one, rounded down of course.
Thanks
Re: Can anyone help me please
How about something like this:
So, dex 300 gives 1/6, agility 400 gives 2/6 and you add 1 which is 1.5 and floors to 1. Your formula didn't 1/6th the agility.
I like to break complex formulas up on multiple lines for an easy read and if needed, convert it to a single formula if speed seems to be a factor.
Code: Select all
[H: agilityMod = if(Agility >= 800,round(Agility/200)/6,floor(Agility/200)/6)]
[H: dexterityMod = if(Dexterity >= 800,round(Dexterity/200)/6,floor(Dexterity/200)/6)]
[H: numberOfAttacks = floor(agilityMod + dexterityMod + 1)]
I like to break complex formulas up on multiple lines for an easy read and if needed, convert it to a single formula if speed seems to be a factor.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Can anyone help me please
Thanks for the help. I took your parts and used them to correct what was wrong. I couldn't use it the way you set it up because it is on each token as a property.
I do have another question, I went to the page you suggested for targeting and used that macro but all it does is pop up a picture in the chat window and next to the token picture it gives the name of the token like it is trying to type something.
Is there something I need to change to make this work?
I do have another question, I went to the page you suggested for targeting and used that macro but all it does is pop up a picture in the chat window and next to the token picture it gives the name of the token like it is trying to type something.
Code: Select all
<!-- getSeenTokens(options,source): json array or object
options (strprop or json object)
pc - 0 any token, 1 - PC only
npc - 0 any token, 1 - NPC only
range - upto this distance in grid units (ie feet, and not grid squares); 0 - any range
self - 0 do not include self, 1 include self
source = source token, defaults to currentToken
This function will get a list of tokenIds based on the current tokens vision
-->
[H, if(argCount()): options = lower(arg(0)); options = "{}"]
[H, if(argCount() >= 2): sourceToken = arg(1); sourceToken = currentToken()]
<!-- verify token is on current map -->
[H: sourceToken = findToken(sourceToken)]
[H: assert(! json.isEmpty(sourceToken),"<b>getSeenTokens(options,source):</b> Token not found on current map.",0)]
<!-- define options locally -->
[H: defaults = json.set("{}","pc",0,"npc",0,"range",0,"self",0)]
[H, if(json.type(options) == "UNKNOWN" && ! json.isEmpty(options)): options = json.fromStrProp(options)]
[H, if(json.isEmpty(options)): options = defaults; options = json.merge(defaults,options)]
[H: varsFromStrProp(json.toStrProp(options))]
<!-- get token ids -->
[H: conditions = "{}"]
[H, if(npc && ! pc): conditions = json.set(conditions,"npc",npc)]
[H, if(! npc && pc): conditions = json.set(conditions,"pc",pc)]
[H, if(range): conditions = json.set(conditions,"range",json.set("{}","token",sourceToken,"upto",range,"distancePerCell",1))]
[H, if(! json.isEmpty(conditions)): tokenIds = getTokens("json",conditions); tokenIds = getTokens("json")]
<!-- exclude self if set -->
[H, if(self), code: {
[H, if(! json.isEmpty(tokenIds)): tokenIds = json.union(tokenIds,json.append("",sourceToken)); tokenIds = json.append("",sourceToken)]
};{
[H, if(! json.isEmpty(tokenIds)): tokenIds = json.difference(tokenIds,json.append("",sourceToken)); tokenIds = "[]"]
}]
<!-- check each id for name and visible -->
[H: targets = "[]"]
[H: hasSight = hasSight()]
[H, if(! hasSight()): setHasSight(1)] <!-- this works for NPC tokens too -->
[H, foreach(tokenId,tokenIds), code: {
[H: canSee = ! json.isEmpty(canSeeToken(tokenId))]
[H, if(canSee): targets = json.append(targets,tokenId)]
}]
[H, if(hasSight != hasSight()): setHasSight(hasSight)]
[H: macro.return = targets]
Is there something I need to change to make this work?
Re: Can anyone help me please
this is a function macro. That means that you can use it in your code, however in order to do that you first need to create a userdefinedfunction: "getSeenTokens" in the onCampaignLoad macro. When you've done that you can do e.g.:
untested.
Code: Select all
[h:me = getSelectedNames()]
[h:assert(listCount(me)==1,"Make sure (only) one token is selected",0)]
[h:seenTokens = getSeenTokens('["pc=0;npc=1;self=0;range=30"]')]
The NPC you can see in a vicinity of 30 is [r:seenTokens]
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Can anyone help me please
So I create a new macro called onCampaignLoad then put
in the command box and that will allow me to use it?
Code: Select all
[h:me = getSelectedNames()]
[h:assert(listCount(me)==1,"Make sure (only) one token is selected",0)]
[h:seenTokens = getSeenTokens('["pc=0;npc=1;self=0;range=30"]')]
Re: Can anyone help me please
Unless your leaving out stuff, I'm guessing: no. Read this first: http://www.lmwcs.com/rptools/wiki/Calli ... d_Function
Did you do that?
Did you do that?
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Can anyone help me please
I think I understand. Lets see.
Ok, I placed a token on my map called "Lib:Token" then
in the token I created 2 macros
1st being "onCampaignLoad"
2nd being "getSeenTokens"
with the code above
then i created a macro to call the "getSeenTokens" called "target" in my campaign macrosusing your code
is that correct?
ok tested what i did above and get an error of
What am I missing?
Ok, I placed a token on my map called "Lib:Token" then
in the token I created 2 macros
1st being "onCampaignLoad"
Code: Select all
[defineFunction("getSeenTokens", "getSeenTokens@Lib:Token")]
with the code above
then i created a macro to call the "getSeenTokens" called "target" in my campaign macrosusing your code
Code: Select all
[h:me = getSelectedNames()]
[h:assert(listCount(me)==1,"Make sure (only) one token is selected",0)]
[h:seenTokens = getSeenTokens('["pc=0;npc=1;self=0;range=30"]')]
The NPC you can see in a vicinity of 30 is [r:seenTokens]
ok tested what i did above and get an error of
Code: Select all
Error in body of roll.
Statement options (if any): h
Statement Body : seenTokens = getSeenTokens('["pc=0;npc=1;self=0;range=30"]')
Re: Can anyone help me please
Did you run oncampaignload once or saved and restarted the campaign?
And I think it's
getSeenTokens("pc=0;npc=1;self=0;range=30")]
And I think it's
getSeenTokens("pc=0;npc=1;self=0;range=30")]
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Can anyone help me please
I prefer
json formatting uses : and not =. You should almost always use the constructor to build your json.
Code: Select all
[H: options = json.set("{}","pc",0,"npc",1,"self",0,"range",30)]
[H: seenTokens = getSeenTokens(options)]
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Can anyone help me please
ok, saved reloaded.
then ran the "target" macro from my campaign macros with the following code
and I get.
What am I messing up?
I am looking at the "target" macro does this call the "getSeenTokens" macro?
I don't see where it calls that macro to run is this where my problem is coming in at?
then ran the "target" macro from my campaign macros with the following code
Code: Select all
[H: options = json.set("{}","pc",0,"npc",1,"self",0,"range",30)]
[H: seenTokens = getSeenTokens(options)]
Code: Select all
Error in body of roll.
Statement options (if any): H
Statement Body : seenTokens = getSeenTokens(options)
I am looking at the "target" macro does this call the "getSeenTokens" macro?
Code: Select all
[H: seenTokens = getSeenTokens(options)]
Re: Can anyone help me please
Make sure getSeenTokens has the allow players to edit unchecked (preferences of macro). Unfortunately, the default is to always have it on. That's one reason why I use RPEdit because it turns it off by default.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Can anyone help me please
Thanks for your guys help on the function I tried to use but couldn't get it to work right.
I found a macro that will give me what I want.
I used the targeting macro from
http://lmwcs.com/rptools/wiki/Forms_tutorial#Click-based_Target_selection
Now the question I have is changing the button in this code
To a button that used the image of a d20 in the default resources folder.
I found a macro that will give me what I want.
I used the targeting macro from
http://lmwcs.com/rptools/wiki/Forms_tutorial#Click-based_Target_selection
Now the question I have is changing the button in this code
Code: Select all
<input type="submit" name="btn_submit" value="Perform action">