B49 Macro Additions

Doc requests, organization, and submissions

Moderators: dorpond, trevor, Azhrei

Craig
Great Wyrm
Posts: 2107
Joined: Sun Jun 22, 2008 7:53 pm
Location: Melbourne, Australia

B49 Macro Additions

Post by Craig »

Bug Fixes
  • The Line parser should now deal with quotes properly.
  • The line parser no longer uses the large regex to search for [] and {}, this will fix a few of the problems with macros being too long causing exceptions.
  • Using Strings like "[W]" or "{Longsword}" inside your macros will no longer cause a null pointer exception, instead if they can not be resolved the string itself will be returned. Where as previously if they could be resolved they would return the result of the expression otherwise an exception.
  • setProperty()/setLibProperty() no longer case errors in token property editor (which make it appear that the property has dissapeared).
  • you can now use <link rel='onChangeToken' type='macro' href='linkToMacro'>
  • Calling abort() from a macro link no longer causes a mesage to be displayed (this was casuing the message "Abort() function called." when using dialogs or other macro links).
  • the meta tags for dialogs for input and temporary should work under all circumstances now.
  • Frames that are updated because of selection/impersonation/token change will no longer maximise.
  • Removed a cheating exploit that can be used to fake rolls using string functions or list functions.
  • Removed a cheating exploit that allowed very easy faking of rolls that has been in the code base for many many builds
  • You will now get sensible feed back about trying to execute an unknown macro or a macro from an unknown lib:token.
On thing to note about the parser changes, you can now do things like the following

Code: Select all

[h: a = '[' + dice + 'd' + sides +']' ] [r:a]
[h: a = '[e:' + dice + 'd' + sides +']' ] [r:a]
Make sure to output the variable with either [r: ] or { } or it will try to reformat the already formatted roll and magle the formating completely.
(Note you could do some tricks like this previously but you would run into a lot of occasions where it would throw up an error).

For reasons on paranioa :) the above can only be done in a trusted macro or if you type it in as GM. If you attempt to do it any other way you will not get the << >> etc.

Notes on the dialog call back for onChangeToken
Since MapTool has no idea about which token(s) you want to know about changes to this call back will be called any time any token changes, and this is not limited to property changes (and may be called even if a change does not occur). So two things should be taken into consideration when using this callback
  • It is for updating displays only, it is NOT a reliable way for tracking if a change was made and acting on it.
  • If you can do it reliably another way (e.g. by appending a dialog update call on the end of modification macros) you should consider doing it that way.
  • Many frames/dialogs open with onChangeToken will slow things down.
  • Did I mention that if you can do it reliably another way you should consider doing it that way.
New Functionality

There are 2 new functions for calling macros. evalMacro() and execMacro() which are similar to the eval() command. They both take a string and evaluate and execute the contents of that string.

Say you had a macro CreateNotes@Lib:Notes that creates a nicely formated HTML display to place in your tokens notes, you could do.

Code: Select all

[h, setNotes('[r,macro('CreateNotes@Lib:Notes'): ""]')
You may want to do this as using macro output to generate html is a lot easier than trying to create HTML in a string.

You can also do something like

Code: Select all

[r:evalMacro(strformat("[%{numDice}d%{sides}]"))]
Not that you would need to to something as simple as that using this method.

The difference between evalMacro() and execMacro() is evalMacro() has access to the variables in the current macro and can modify them, with execMacro() the macro executes with its own set of variables and can not modify (or read) the current macros variables.

Note: You have to be careful with tool tips. If you are planing to to use tool tips or expanded output [e: ] in your generated macro you must use either [r: ] or { } for output. e.g

Code: Select all

[r:evalMacro(strformat("[%{numDice}d%{sides}]"))]
Using any other ouput or capturing the output in a variable and printing it will mangle your tool tips.

New String Functions
  • startsWith(str, substr)
    Returns 1 if str starts with substr or 0 otherwise.
  • endWith(str, substr)
    Returns 1 if str ends with substr or 0 otherwise.


Trusted Macros Updates
Started additions to have macros that completely trusted. This is where the macro is called from a button that the user can not edit and calls no macros that are not trusted. If a macro meets these conditions then there will be a visual indication that the macro has run only code that the GM has written for both /say (which is default if no slash command is used) and /togm, this way the GM will be able to trust any such output. I am hoping for next build for the completion.


Retrieving Tokens
Two new functions
getVisibleTokens(delim)/getVisibleTokenNames(deim)
These two functions return a list of the tokens that are visible to the client that runs the function.

A token is visible if even 1 pixel of it is visible and remember even though your token looks round its image is a square (sorry nothing I can do about this).

JSON
As several people have wanted to be able to enbed property lists within property lists and some of the functionality of property lists depends on the way the work not changing I added a way to create/manipulate JSON objects from within yout MapTool macros. For those of you wanting Javascript macros, sorry they dont ever get executed its just a data structure. For those of you worried about security issues good news they never get executed its just a data structure.

Obviously using json is not as easy to use as it would be in javascript but there are several functions that understand or can return it so depending on what you want to do its not that hard. For thsoe functions that do not understand JSON there are easy ways to convert from String Properties and Lists to JSON objects and Arrays and then convert from JSON to String Properties and Lists.

JSON Functions
  • json.fromStrProp(prop [, delim])
    Converts a String property list into a json object.
    If delim is specified then it will be used as the delimiter for the Proproprty string.

    Example

    Code: Select all

      [json.fromStrProp("a=1;b=44;c=12")]
      
    Returns

    Code: Select all

      {"a":1,"c":12,"b":44}
      
  • json.fromList(list [, delim][/i])
    Convers a list to a json array.
    If delim is specified then it will be used as the delimiter for the list.

    Code: Select all

      [json.fromList("a,1,g,4")]
      
    Produces

    Code: Select all

      ["a",1,"g",4]
      
  • json.toStrProp(jsonString[, delim])
    Converts a json object to a property string using delim as the delimeter if it is specified or ";" if it is not. If json string is an object then the property list contains the field=value from the object, if it is an array then the property list contains index=value from the array.
    Example

    Code: Select all

      [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.toStrProp(a)]
      [h:a=json.fromList("a,1,g,4")][json.toStrProp(a)]
      
    Produces

    Code: Select all

      a=1;c=12;b=44
      0=a;1=1;2=g;3=4
      
  • json.toList(jsonString[, delim])
    Converts a json object to a list delim as the delimeter if it is specified or "," if it is not. If the json string is an array then a list of all the elments are returned, if it is a json object then a list of the keys are returned.

    Code: Select all

      [h:a=json.fromList("a,1,g,4")][json.toList(a)]
      [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.toList(a)]
      
    Produces

    Code: Select all

      a=1;c=12;b=44
      a,c,b
      
  • json.type(jsonString)
    Returns the type of json object contained in a string.
    Returns
    • "ARRAY"
    • "OBJECT"
    • "UNKNOWN"
    Example

    Code: Select all

      [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.type(a)]
      [h:a=json.fromList("a,1,g,4")][json.type(a)]
      [json.type("some thing or other")]
      
    Produces

    Code: Select all

      OBJECT
      ARRAY
      UNKNOWN
      
  • json.get(jsonString, key)
    Gets the field key from the jsonString.

    Code: Select all

      [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.get(a,"b")]
      
    Produces

    Code: Select all

      44
      
  • json.contains(jsonString, key)
    Returns 1 if the json object contains the key 0 if it doesn't.
    If jsonString is an array then it checks to see if the value exsits
    in the array.

    Example

    Code: Select all

      [h:a=json.fromStrProp("a=1;b=44;c=12")] 
      [json.contains(a, "b")]
      [json.contains(a, "z")]
      
    Produces

    Code: Select all

      1
      0
      
  • json.set(jsonString, key, value, ...)
    Sets the value of key in the json object. Value can be a number, or string (including another json string. You can use an empty string to create a new JSON object, you can also specify multiple key/value pairs.

    Example

    Code: Select all

      [json.set("{}", "a", 5)]
      [json.set("", "a", 5, "b", 10)]
      
    Produces

    Code: Select all

      {"a":5}
      {"a":5, "b":10}
      
  • json.fields(pjsonString[, delim])
    Returns the fields (keys) for a json object or the indexes for a json array as a string list. If delim is specified then it is used as a delimeter to the list otherwise the default of "," is used.
    For the special case of a json object if the delim is "json" a json array of the fields will be returned.

    Example

    Code: Select all

      [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.fields(a)]
      [h:a=json.fromList("a,1,g,4")][json.fields(a)]
      [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.fields(a, "json")]
      
    Produces

    Code: Select all

      a,c,b
      0,1,2,3 
      ["a","c","b"]
      <BS>
      
  • json.length(jsonString)
    Returns the number of fields in a json object or number of elements in a json array.

    Example

    Code: Select all

      [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.length(a)]
      [h:a=json.fromList("a,1,g,4")][json.length(a)]
      
    Produces

    Code: Select all

      3
      4
      
  • json.append(jsonString, value, ...)
    Appends a value to the end of a json array. You can use an empty string to create a new json array.

    Examples

    Code: Select all

      [h:a=json.fromList("a,1,g,4")][json.append(a, 55)]
      [json.append("", 1, 4, 5, 6)]
      
    Produces

    Code: Select all

      ["a",1,"g",4,55]
      [1,4,5,6]
      
  • json.remove(jsonString, field)
    Removes a field from a json object, or the value at the specified index from a json array.

    Code: Select all

      [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.remove(a, "c")]
      [h:a=json.fromList("a,1,g,4")][json.remove(a,3)]
      
    Produces

    Code: Select all

      {"a":1,"b":44}
      ["a",1,"g"]
      
Modified Functions
The following functions have been modified to return json arrays or objects if their delim argument is "json", otherwise they will function exactly the same as b48.
  • getPropertyNames([delim])
  • getAllPropertyNames([type [, delim]])
  • getOwners(delim)
  • getLights(type [, delim])
  • getMacros(delim)
  • getMacroProps(index, [, delim])
  • getMacroIndexes(name [, [delim]])
  • getTokens([delim]) / getTokenNames([delim])
  • getSelected([delim]) / getSelectedNames([delim])
  • getPCs([delim]) / getPCNames([delim])
  • getNPCs([delim]) / getNPCNames([delim])
  • getExposedTokens([delim]) / getExposedTokenNames([delim])
  • getVisibleTokens([delim]) / getVisibleTokenNames([delim])
  • getWithState(state [,delim]) / getWithStateNames(state [,delim])
  • getOwned(name [,delim]) / getOwnedNames(state [,delim])
  • getSpeechNames([delim])
setMacroProps(button, props [, delim])
Accepts a json object for props there is no need to specify delim if you pass in a json object.


[foreach(): ]
Works with json objects and arrays. If it is operating on a json object then the loop variable is set to each field in the object. If it is operating on an array then the loop variable is set to each element in the array.


setMacroCommand()
setMacroCommand() is now a trusted function and can only be run from trusted macros.

New Dialog/Frame Functons
  • isDialogVisible(name)
    Returns 1 if the dialog is visible or 0 if it is not.
  • isFrameVisible(name)
    Returns 1 if the frame is visible or 0 if it is not.
  • closeDialog(name)
    Closes the named dialog.
macro links
If a macro link points to a trusted macro (macro on a lib:token that is not owned by any player) and the autoexec flag is set on that macro then the macro will automatically be run by who ever it is sent to (not the sender). The recipient of the link will still see the link in the chat, the tool tip will indicate that it is an auto execute macro link. The link can also be clicked on to rerun the macro so if you do not want players running the link a second time you would have to code something into the macro to stop it from running. In most cases you would want to display/update a dialog/frame from an auto execute macro link so there is some feedback. There is nothing enforcing feedback of macro running or anything stopping you from clicking on them a second time is because the GM must write (or approve the macro) that is running so they are not limited or restricted that way the GM can build in what the checkes they want.


all can be used as a send output to option for macro links, the name of the the target token will be displayed along with the text, just as "/say" works.

executing an unknown macro on a lib:token
When maptool executes a macro on a lib:token it first checks to see if that macro exists, and if it does not then it will look for a macro called "!!unknown-macro!!" and will execute this if it exists. If neither are found then an error is returned. In the body of !!unknown-macro!! getMacroName() will return the name of the macro that was in the macro call.

So if you did

Code: Select all

[macro("foo@Lib:token"): ""]
and the macro foo did not exist, then inside !!unknown-macro!! (assuming it exits) getMacroName() would return foo.

You can use this facility to return a usage/help text for the Lib:Token or dynamically respond to macro calls, for example

Code: Select all


[h: name = getMacroName()]
[h,if(startsWith(name, "get")), code: {
  [type = substring(name, 3)]
  [macro.return = getStrProp(getProperty("stats", type))]
}]
[h,if(startsWith(name, "set")), code {
  [type = substring(name, 3)]
  [props = getProperty("stats", name)]
  [props = setStrProp(props, type, macro.args)]
}]
Would respond to calls like

Code: Select all

[h:macro("setStrength"): 10]
[h:macro("getStrength"): ""][h: str = macro.return]
[h:macro("setDexterity"): 13]
[h:macro("getDexterity"): ""][h: str = macro.return]
Even though get/set/Strength/Dexterity are not defined. This can provide a easy way to create library tokens that manage inventory or all sorts of other things.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: B49 Macro Additions

Post by Rumble »

Just how much of a JSON object can I create? Could I, for instance, create something like this?

Code: Select all

[AttackPowers= {
	"Power0": [{ "name": "Backstab",
			 "attackBonus":4,
			 "damageBonus":"2x",
			 "range": 0,
			 "special": "Must attack from the rear and have hidden during the previous round"}],
			  [{ "name": "Dagger",
			     "attackBonus": 0,
			     "damageBonus": -1,
			     "range": 2,
			     "special": "Melee or ranged"}]}
Embedding multiple nested objects? MapTool didn't seem to like that when I tried earlier, but I'm a rank beginner with JSON, so...


Edit: No, wait, it's growing clearer now: I can't do the above, but I can do:

Code: Select all

[h:Power0 = "Name=Chain Lightning; Targets=One, Two, or Three Creatures; Attack=9; Damage=2d12;"]

[h:AttackPowers=json.set("{ }", "Power0", Power0)]
And thus embed a string property in the JSON object. Way cool!

Craig
Great Wyrm
Posts: 2107
Joined: Sun Jun 22, 2008 7:53 pm
Location: Melbourne, Australia

Re: B49 Macro Additions

Post by Craig »

Rumble wrote:Just how much of a JSON object can I create? Could I, for instance, create something like this?

Code: Select all

[AttackPowers= {
	"Power0": [{ "name": "Backstab",
			 "attackBonus":4,
			 "damageBonus":"2x",
			 "range": 0,
			 "special": "Must attack from the rear and have hidden during the previous round"}],
			  [{ "name": "Dagger",
			     "attackBonus": 0,
			     "damageBonus": -1,
			     "range": 2,
			     "special": "Melee or ranged"}]}
Embedding multiple nested objects? MapTool didn't seem to like that when I tried earlier, but I'm a rank beginner with JSON, so...


Edit: No, wait, it's growing clearer now: I can't do the above, but I can do:

Code: Select all

[h:Power0 = "Name=Chain Lightning; Targets=One, Two, or Three Creatures; Attack=9; Damage=2d12;"]

[h:AttackPowers=json.set("{ }", "Power0", Power0)]
And thus embed a string property in the JSON object. Way cool!
Or you could embed a JSON object in another JSON object

Code: Select all

[h: Power0 = json.set("", "Name", "Chain Lightning", "Targets", "One, Two, or Three Creatures", "Attack", 9, "Damage", "2d12")] [h: AttackPowers=json.set("", "Power0", Power0)] 
Gives you

Code: Select all

{"Power0":{"Name":"Chain Lightning","Targets":"One, Two, or Three Creatures","Attack":9,"Damage":"2d12"}}
or if I indent it for clarity

Code: Select all

{
    "Power0":{
        "Name":"Chain Lightning",
        "Targets":"One, Two, or Three Creatures",
        "Attack":9,
        "Damage":"2d12"
    }
}
You can also use json.append() create arrays.

You can also specify the JSON object using the following method

Code: Select all

[h: AttackPowers = '{
    Power0:{
        Name:"Chain Lightning",
        Targets:"One, Two, or Three Creatures",
        Attack:9,
        Damage:"2d12"
    }
}']
You don't need to use the json.set, json.append methods to create your objects (they are easiest way to modify objects though) but you can if you want to (you can avoid some quote issues you may sometimes have).

Moving to/from JSON to string property lists or string lists is easy with the provided functions so you can store it all as JSON without any worries that you wont be able to use input or whatever :)
Oh and [foreach(): ] works with JSON objects and arrays so no need to turn your object into a list to iterate over it.


User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: B49 Macro Additions

Post by Rumble »

Okay, so...I have the following code:

Code: Select all

[h:powerObj=getProperty("AttackPowers")]
[h:num=json.get(powerObj,"NumPowers")]
[h:firstAvail=num]

[h:status=input(
   "powName|--new name--|Enter Power Name",
   "attBonus|0|Enter Attack Bonus",
   "dmgBonus|0|Enter Dmg Bonus",
   "dmgOperator|Addition,Multiplier|Is the damage bonus an addition or a multiplier to regular damage?|RADIO|SELECT=0",
   "powRange|0|Enter Power Range in squares, or 'melee' for melee powers",
   "powSpec|--none--|Enter special notes or effects of the power"
)]

[h:newPowerString=""]
[h:newPowerString=setStrProp(newPowerString,"Name",powName)]
[h:newPowerString=setStrProp(newPowerString,"Attack",attBonus)]
[h:newPowerString=setStrProp(newPowerString,"Damage",dmgBonus)]
[h:newPowerString=setStrProp(newPowerString,"DmgType",dmgOperator)]
[h:newPowerString=setStrProp(newPowerString,"Range", powRange)]
[h:newPowerString=setStrProp(newPowerString,"Special",powSpec)]

[h:powerObj=json.set(powerObj, "Power"+firstAvail, newPowerString)]

[h:setProperty("AttackPowers",powerObj)]
The process is simply to add new powers to a json object. The property "AttackPowers" on the token is (at this point) this:

Code: Select all

{"NumPowers":0}
When I attempt to execute this macro, I get the error "Could not execute the command: Unknown JSON Object type."

Through a couple other experiments, it seems that no matter what I do, I get either an unknown object type, or the response #ERR (the latter is from a simple attempt to get a macro to display the contents of "AttackPowers"). So, what have I done wrong here?

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: B49 Macro Additions

Post by jfrazierjr »

With the new JSON support which allows for multi level properties(well.. much more easily anyway), is there any chance of modifying the Properties sheet to allow for true hierarchy view and edit?
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

Craig
Great Wyrm
Posts: 2107
Joined: Sun Jun 22, 2008 7:53 pm
Location: Melbourne, Australia

Re: B49 Macro Additions

Post by Craig »

Rumble wrote:Okay, so...I have the following code:

Code: Select all

[h:powerObj=getProperty("AttackPowers")]
[h:num=json.get(powerObj,"NumPowers")]
[h:firstAvail=num]

[h:status=input(
   "powName|--new name--|Enter Power Name",
   "attBonus|0|Enter Attack Bonus",
   "dmgBonus|0|Enter Dmg Bonus",
   "dmgOperator|Addition,Multiplier|Is the damage bonus an addition or a multiplier to regular damage?|RADIO|SELECT=0",
   "powRange|0|Enter Power Range in squares, or 'melee' for melee powers",
   "powSpec|--none--|Enter special notes or effects of the power"
)]

[h:newPowerString=""]
[h:newPowerString=setStrProp(newPowerString,"Name",powName)]
[h:newPowerString=setStrProp(newPowerString,"Attack",attBonus)]
[h:newPowerString=setStrProp(newPowerString,"Damage",dmgBonus)]
[h:newPowerString=setStrProp(newPowerString,"DmgType",dmgOperator)]
[h:newPowerString=setStrProp(newPowerString,"Range", powRange)]
[h:newPowerString=setStrProp(newPowerString,"Special",powSpec)]

[h:powerObj=json.set(powerObj, "Power"+firstAvail, newPowerString)]

[h:setProperty("AttackPowers",powerObj)]
The process is simply to add new powers to a json object. The property "AttackPowers" on the token is (at this point) this:

Code: Select all

{"NumPowers":0}
When I attempt to execute this macro, I get the error "Could not execute the command: Unknown JSON Object type."

Through a couple other experiments, it seems that no matter what I do, I get either an unknown object type, or the response #ERR (the latter is from a simple attempt to get a macro to display the contents of "AttackPowers"). So, what have I done wrong here?
I tried the above code and it worked fine for me. The only thing I can think of is you have {NumPowers: 0} set as a default for the property and getProperty() will not fetch the default value.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: B49 Macro Additions

Post by Rumble »

I tried the above code and it worked fine for me. The only thing I can think of is you have {NumPowers: 0} set as a default for the property and getProperty() will not fetch the default value.
A-HA.

Sneaky default values. Thanks!

User avatar
PyroMancer2k
Dragon
Posts: 925
Joined: Thu Sep 11, 2008 2:04 pm

Re: B49 Macro Additions

Post by PyroMancer2k »

I can't pass json Objects in macroLink(). It always seems to have { as the result in the macro.args :(.

Here is what I've tried.

Macro 1

Code: Select all

[macroLink("TEST LINK", "DisplayArgs@Lib:Test", "self",  json.set("", "Name", "Bob", "Str", 10))]
Macro 2

Code: Select all

[jsonObj =  json.set("", "Name", "Bob", "Str", 10)]
[macroLink("TEST LINK", "DisplayArgs@Lib:Test", "self", jsonObj)]
Lib:Token Macro

Code: Select all

[macro.args]
Not sure what the problem is.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: B49 Macro Additions

Post by Rumble »

Confirmed. You can use encode() on the jsonObj you are passing, and decode() at the other end to work around the problem, but yeah, it doesn't seem to be passing JSON's properly.

Code: Select all

[jsonObj =  json.set("", "Name", "Bob", "Str", 10)]
[macroLink("TEST LINK", "JSON Passing@Lib:Test", "self", encode(jsonObj))]
and

Code: Select all

[decode(macro.args)]
works fine. Did you post this in Bug Reports? (I will go ahead and do it - I'll give you credit for finding it, of course! :D)

User avatar
PyroMancer2k
Dragon
Posts: 925
Joined: Thu Sep 11, 2008 2:04 pm

Re: B49 Macro Additions

Post by PyroMancer2k »

I didn't see it mentioned in the Update notes so I was wondering did you add the option to display to all for macroLink()? I know there is self, gm, and none which is okie but I would really like an all option if one didn't get added. I made a dialog box with a list of you skills and you can click on them to make a skill roll. For now I just settle for gm option since they need to see it but it would be nice to have it display to all.

Craig
Great Wyrm
Posts: 2107
Joined: Sun Jun 22, 2008 7:53 pm
Location: Melbourne, Australia

Re: B49 Macro Additions

Post by Craig »

PyroMancer2k wrote:I didn't see it mentioned in the Update notes so I was wondering did you add the option to display to all for macroLink()? I know there is self, gm, and none which is okie but I would really like an all option if one didn't get added. I made a dialog box with a list of you skills and you can click on them to make a skill roll. For now I just settle for gm option since they need to see it but it would be nice to have it display to all.
Yup, details are in the very last sentence under the macro link heading in the first post.

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: B49 Macro Additions

Post by jfrazierjr »

Ok... I know this has got to be something really really stupid.

Code: Select all

[h: Target1 = json.set("", "AttMod", 0, "DamMod", 0, "Name", "Foo Dog")]
[h: Target2 = json.set("", "AttMod", 1, "DamMod", -2, "Name", "Foo Dog4")]
[h: Targets =  json.set("", "Target1", Target1, "Target2", Target2)]


[h: foo = json.get(Targets, "Target1")]
When I execute this, I get
Could not execute the command: Unknown JSON Object type
Targets is a token property and it DOES get set with what appears to be a valid JSON object structure. Also, this is a brand new token, so it has nothing to do with the token having the same property under a different property set which clashes.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: B49 Macro Additions

Post by Azhrei »

Seems to work fine in b50, so...

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: B49 Macro Additions

Post by jfrazierjr »

Errr... Ok...

I saved the campaign file and opened it back up in b50 dev and it works... :roll: :roll:
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

Post Reply

Return to “Documentation Requests/Discussion”