Mookie1171 wrote:I think the issue might be with getting the selectTokens() function to use the ID number from the getInitiativeToken() function.
The issue is that your syntax is wrong in a number of places. You need to spend more time looking at working code and reading up on macro writing to get the basics down (check out Wolph's link above).
But, lets take a look at your code, line by line:
No reason for the carriage return there.
You're running this function (which finds the ID of the token that has initiative) and then assigning it to nothing.
You're also not hiding the output and using a carriage return for no reason again.
No reason for this bracket.
Code: Select all
CurrentInitiativeID = [getInitiativeToken()] <br>
Here you are running the same function as above to get the ID of the token with initiative. You're on the right track this time trying to assign it to a variable. But you are doing it wrong. The variable needs to be in the brackets with the function.
It would look like this if done properly:
Proper Code wrote:
[h: currentInitiativeID = getInitiativeToken()]
But, as you will see at the end of this post, you don't need to do that at all.
Code: Select all
[selectTokens("CurrentInitiativeID", 1)] <br>
You're using the
Wiki: selectTokens() function wrong.
First, "CurrentInitiativeID" should be a variable. You're putting it in quotes like it's a string. You need to understand the difference between the two. The function expects an id there.
Second, by using a "1" in the "add" parameter, you're going to be adding the selected token to the previously selected token (i.e. your list of selected tokens will grow). That's not what you want to do.
Another bracket that should not be there.
So, as you can see, you have a lot of syntax errors. It's good that you're getting your feet wet, but you're in for a world of hurt if you don't work on the basics.
However, this is what you said you wanted to do:
Code: Select all
[h: nextInitiative()]
[h: selectTokens(getInitiativeToken())]
Note that I've nested the
Wiki: getInitiativeToken() function into the
Wiki: selectTokens() function. You don't have to assign the ID to a variable unless you're going to use it for something else.