Sorry, I can't speak English.
I don't have the ability to explain this bug.
Even with the Google Translator.
So my report will helplessly simple.
[switch(1), CODE:
case "1":{
[if(1==1), CODE:{
[strformat('{"arg_lvl":0}')]
(very long jobj will continue. so i want to use strformat instead json.set for speed.)
};{}]
}]
Please try this command and give me answer.
At least I can read. So you don't need to worry about it.
And Thank you for your great works.
[b91] [Solved] Bug Report - swich, if, jobj
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice, MapTool BugReport Manager
Forum rules
Posts that do not conform to the READ ME FIRST sticky thread are subject to deletion.
Posts that do not conform to the READ ME FIRST sticky thread are subject to deletion.
-
- Kobold
- Posts: 6
- Joined: Thu Jun 11, 2015 9:22 pm
[b91] [Solved] Bug Report - swich, if, jobj
Last edited by emforhsdpdlw on Fri Jun 12, 2015 7:34 am, edited 1 time in total.
Re: [b91] Bug Report - swich, if, jobj
The parser thinks you have 3 {} which isn't allowed because it counts {} inside single quotes ('). If you change ' to " then it works. But I still recommend using json.set.
json.set works very well with long arguments. It's too easy to make mistakes creating a json object manually and the difference in speed isn't that much unless you have many nested objects which I also don't recommend.
Code: Select all
[switch(1), code:
case "1":{
[if(1 == 1), CODE: {
[strformat("{'arg_lvl':0}")]
};{}]
}
]
Code: Select all
[switch(1), code:
case "1":{
[if(1 == 1), CODE: {
[json.set("{}","arg_1",0,"arg_2",0,"arg_3",0,"arg_4",0)]
};{}]
}
]
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
-
- Kobold
- Posts: 6
- Joined: Thu Jun 11, 2015 9:22 pm
Re: [b91] Bug Report - swich, if, jobj
Thank you for your answer to my silly report.aliasmask wrote:The parser thinks you have 3 {} which isn't allowed because it counts {} inside single quotes ('). If you change ' to " then it works. But I still recommend using json.set.
json.set works very well with long arguments. It's too easy to make mistakes creating a json object manually and the difference in speed isn't that much unless you have many nested objects which I also don't recommend.Code: Select all
[switch(1), code: case "1":{ [if(1 == 1), CODE: { [strformat("{'arg_lvl':0}")] };{}] } ]
Code: Select all
[switch(1), code: case "1":{ [if(1 == 1), CODE: { [json.set("{}","arg_1",0,"arg_2",0,"arg_3",0,"arg_4",0)] };{}] } ]
I'll take your advice.
Anyway, This post has been resolved.
But I don't know how to edit subject.
Re: [b91] Bug Report - swich, if, jobj
You need two posts to have permission to update. You can now edit your posts.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools