Tutorial: Macro Dialogs and Frames
Moderators: dorpond, trevor, Azhrei
Re: Tutorial: Macro Dialogs and Frames
Heh, well, I'll let someone using Windows ask him. As it's written in C# apparently (or at least, it requires .NET) I won't be downloading and using it any time soon. Although it looks like a pretty simple interface so it might make for a good test of Mono the next time I'm playing around with Kubuntu...
Re: Tutorial: Macro Dialogs and Frames
Ok. So I have quite enough of this. MACROS are simply not working the way it should be. I spent 3 days now fidling around and most of my time was wasted to WRONG SYNTAX. I cant simply make this work. Even slightest change to code harm it somehow, if statements are almost all not working.
currently I am in NextWeaponNumber macro change.
This is simply not working. Expected function:
Add 3 default string properties in Token property "Weapons", All 0 defaults
Getting:
Error in roll for IF option Statement options (if any): h,if(isPropertyEmpty("Zbrane")), code Statement body (first 200 characters): { [h: Weapons = setStrProp(Weapons, "NumWeapons", 0)] [h: Weapons = setStrProp(Weapons, "UsedWeaponLeft", 0)] [h: Weapons = setStrProp(Weapons, "UsedWeaponRight", 0)] [h: numWeapons=1]}; code: { [h: numWea
I guess the parser is not working the way it should be. Also I found strange behaviour when macro was not working due html markup, When I remove several <td>'s it went all-right. Also some html comments makes macro dont work. dont know exactly when, but it certainly do.
and the last thing, please, can you clarify somebody when exactly [h:] and [h,] should be used. I am getting really pissed and SEARCH function is NOT WORKING on this forum. GRRRRRRRRRRRRRRR!!!!!
currently I am in NextWeaponNumber macro change.
Code: Select all
[h,if(isPropertyEmpty("Weapons")), code: {
[h: Weapons = setStrProp(Weapons, "NumWeapons", 0)]
[h: Weapons = setStrProp(Weapons, "UsedWeaponLeft", 0)]
[h: Weapons = setStrProp(Weapons, "UsedWeaponRight", 0)]
[h: numWeapons=1]}; code: {
[h: numWeapons=2]
[h: Weapons = setStrProp(Weapons, "NumWeapons", numWeapons)]
}]
[h: macro.return = numWeapons]
Add 3 default string properties in Token property "Weapons", All 0 defaults
Getting:
Error in roll for IF option Statement options (if any): h,if(isPropertyEmpty("Zbrane")), code Statement body (first 200 characters): { [h: Weapons = setStrProp(Weapons, "NumWeapons", 0)] [h: Weapons = setStrProp(Weapons, "UsedWeaponLeft", 0)] [h: Weapons = setStrProp(Weapons, "UsedWeaponRight", 0)] [h: numWeapons=1]}; code: { [h: numWea
I guess the parser is not working the way it should be. Also I found strange behaviour when macro was not working due html markup, When I remove several <td>'s it went all-right. Also some html comments makes macro dont work. dont know exactly when, but it certainly do.
and the last thing, please, can you clarify somebody when exactly [h:] and [h,] should be used. I am getting really pissed and SEARCH function is NOT WORKING on this forum. GRRRRRRRRRRRRRRR!!!!!
Re: Tutorial: Macro Dialogs and Frames
n3phrit wrote:Ok. So I have quite enough of this. MACROS are simply not working the way it should be. I spent 3 days now fidling around and most of my time was wasted to WRONG SYNTAX. I cant simply make this work. Even slightest change to code harm it somehow, if statements are almost all not working.
currently I am in NextWeaponNumber macro change.
This is simply not working. Expected function:Code: Select all
[h,if(isPropertyEmpty("Weapons")), code: { [h: Weapons = setStrProp(Weapons, "NumWeapons", 0)] [h: Weapons = setStrProp(Weapons, "UsedWeaponLeft", 0)] [h: Weapons = setStrProp(Weapons, "UsedWeaponRight", 0)] [h: numWeapons=1]}; code: { [h: numWeapons=2] [h: Weapons = setStrProp(Weapons, "NumWeapons", numWeapons)] }] [h: macro.return = numWeapons]
Add 3 default string properties in Token property "Weapons", All 0 defaults
Getting:
Error in roll for IF option Statement options (if any): h,if(isPropertyEmpty("Zbrane")), code Statement body (first 200 characters): { [h: Weapons = setStrProp(Weapons, "NumWeapons", 0)] [h: Weapons = setStrProp(Weapons, "UsedWeaponLeft", 0)] [h: Weapons = setStrProp(Weapons, "UsedWeaponRight", 0)] [h: numWeapons=1]}; code: { [h: numWea
I guess the parser is not working the way it should be. Also I found strange behaviour when macro was not working due html markup, When I remove several <td>'s it went all-right. Also some html comments makes macro dont work. dont know exactly when, but it certainly do.
and the last thing, please, can you clarify somebody when exactly [h:] and [h,] should be used. I am getting really pissed and SEARCH function is NOT WORKING on this forum. GRRRRRRRRRRRRRRR!!!!!
Okay, hate to say it, but it's a syntax error. This should be:
Code: Select all
[h,if(isPropertyEmpty("Weapons")), code: {
[h: Weapons = setStrProp(Weapons, "NumWeapons", 0)]
[h: Weapons = setStrProp(Weapons, "UsedWeaponLeft", 0)]
[h: Weapons = setStrProp(Weapons, "UsedWeaponRight", 0)]
[h: numWeapons=1]};
{
[h: numWeapons=2]
[h: Weapons = setStrProp(Weapons, "NumWeapons", numWeapons)]
};]
[h: macro.return = numWeapons]
h, if(isPropertyEmpty("Weapons")), code:
Code does not appear later - it is like a switch that tells the parser "everything enclosed in { } is a block of code to run; there may be multiple blocks, so pay attention).
Also, the second option for IF needs to end with a semicolon, as well. A template IF with code is:
Code: Select all
[IF(condition),CODE:
{
[run some code here]
};
{
[run some other code here]
};]
Re: Tutorial: Macro Dialogs and Frames
Ok thanks, i am going to test it tomorrow. It would be nice, if parser can handle that systax errors with something more debugable in chat window....
and one more thing. I dont know what is this html standard that is supported in dialogs and frames, but many of html directives simply dont work (like size in input fields). And It would be quite handy If there is possibility to see generated html source code, otherwise i cannot trace almost anything.
and one more thing. I dont know what is this html standard that is supported in dialogs and frames, but many of html directives simply dont work (like size in input fields). And It would be quite handy If there is possibility to see generated html source code, otherwise i cannot trace almost anything.
Re: Tutorial: Macro Dialogs and Frames
I have found another bug, isPropertyEmpty() is not working,
if I try to check empty property it returns 0 instead of 1 or something cause I was not able to make condition working. Also the documentation to this function is messy:
I have to change it to: and this works fine
if I try to check empty property it returns 0 instead of 1 or something cause I was not able to make condition
Code: Select all
if(isPropertyEmpty(Weapons)), code...
There should be empty string with (" ") with whitespace, otherwise I dont see any reason why would "" return 0...Returns 1 if the property is empty or 0 if it is not. An empty string ("")
will return 1 as its not an empty ptoperty.
I have to change it to:
Code: Select all
if(getProperty(Weapons)==""), code...
Re: Tutorial: Macro Dialogs and Frames
deleted...my fault
Last edited by n3phrit on Sun Dec 21, 2008 6:35 am, edited 1 time in total.
Re: Tutorial: Macro Dialogs and Frames
Its a bit confusing is you are not used to programing but the documentation is correct. Empty means nothing (or null in java and several other programing languages). An empty string is something so if the property contains an empty string its not nothing (and hence its not empty because it contains something). And my above explanation probably did not help.n3phrit wrote:I have found another bug, isPropertyEmpty() is not working,
if I try to check empty property it returns 0 instead of 1 or something cause I was not able to make conditionworking. Also the documentation to this function is messy:Code: Select all
if(isPropertyEmpty(Weapons)), code...
There should be empty string with (" ") with whitespace, otherwise I dont see any reason why would "" return 0...Returns 1 if the property is empty or 0 if it is not. An empty string ("")
will return 1 as its not an empty ptoperty.
I have to change it to:and this works fineCode: Select all
if(getProperty(Weapons)==""), code...
Think of isPropertyEmpty() returning 1 if nothing has been assigned to the property or 0 if something has been assigned to the property. Since the only way you can get an empty string into a property is by assigning it to the property isPropertyEmpty() will return 0 for an empty string.
Re: Tutorial: Macro Dialogs and Frames
for usability purposes it would be better, if empty string was considered empty, however it is javaish normal. In php empty string is considered empty thus "" returns true if asked for it. I simply think, that in a macro world without variable casting possiblity it is simply bad.An empty string is something so if the property contains an empty string its not nothing (and hence its not empty because it contains something
if i had an option to have
Code: Select all
num = (int) getStrPropt(foo, bar)
I am PHP and Ruby advanced programmer
p.s. and NULL is something different than empty string...
Re: Tutorial: Macro Dialogs and Frames
And this is exactly the point. The property is empty if it is a null, if it is not a null it is not empty. The reason it is not isPropertyNull is because the macro language knows nothing of null. Its isPropertyEmpty, not isStringEmpty so returning 1 if the property contains a zero length string would be semantically wrong. Its use is simply to check if the property is null or not.n3phrit wrote:
p.s. and NULL is something different than empty string...
Re: Tutorial: Macro Dialogs and Frames
It may sounds strange, but than the function should be called
isPropertyInitialized(), as now it only returns 1 if it was not used!
Because now, if you set property to something, no matter what, since that moment it won't be considered empty under any circumstances! Even if you edit it in your token properties and delete all content from it. I used to test the value of property, then deleted it and tried again. This function is not good for such operations.
isPropertyEmpty() should return true if content of property at ANY TIME contains
nothing independent of its scalar type.
isPropertyInitialized(), as now it only returns 1 if it was not used!
Because now, if you set property to something, no matter what, since that moment it won't be considered empty under any circumstances! Even if you edit it in your token properties and delete all content from it. I used to test the value of property, then deleted it and tried again. This function is not good for such operations.
isPropertyEmpty() should return true if content of property at ANY TIME contains
nothing independent of its scalar type.
Re: Tutorial: Macro Dialogs and Frames
If you call resetProperty() then yes it will be considered empty again.n3phrit wrote:It may sounds strange, but than the function should be called
isPropertyInitialized(), as now it only returns 1 if it was not used!
Because now, if you set property to something, no matter what, since that moment it won't be considered empty under any circumstances!
I can't use a hammer to change a light bulb either, but thats because I chose the wrong tool for the job, not because the hammer is broken.Even if you edit it in your token properties and delete all content from it. I used to test the value of property, then deleted it and tried again. This function is not good for such operations.
No it shouldn't, let it go. "Something" is not empty full stop. If you want to check if the scalar type is empty then check the scalar type there are ways to do that. This is the way many computer languages work, if you check if a reference points to something or not you NEVER derefernce it and examine the value, NEVER. I will repeat the functions is isPropertyEmpty() not isPropertysValueEmpty().isPropertyEmpty() should return true if content of property at ANY TIME contains
nothing independent of its scalar type.
Re: Tutorial: Macro Dialogs and Frames
ok, I didnt noticed resetProperty() function, but still think that for many GM especially not programmers this will be issue. I hear a java programmer from you, not a macro designer no offense.
Re: Tutorial: Macro Dialogs and Frames
Following code is not working, SUFFIXED, UNSUFFIXED seems to be broken.
varsFromStrProp accepts only 1 parameter...
returns
varsFromStrProp accepts only 1 parameter...
Code: Select all
[h, macro("GetWeapon@this"): 1]
[h: wProp = macro.return]
[h: varsFromStrProp(wProp, "SUFFIXED") ]
Code: Select all
varsFromStrProp() requires 1 parameters
- PyroMancer2k
- Dragon
- Posts: 925
- Joined: Thu Sep 11, 2008 2:04 pm
Re: Tutorial: Macro Dialogs and Frames
That's cause those changes never went in. You just enter the variable name like so varsFromStrProp(wProp) . It's kinda annoying that the documentation was updated without verifying that the actually changes were in the build. People constantly having trouble with this the other similar non-implemented items.n3phrit wrote:Following code is not working, SUFFIXED, UNSUFFIXED seems to be broken.
varsFromStrProp accepts only 1 parameter...
returnsCode: Select all
[h, macro("GetWeapon@this"): 1] [h: wProp = macro.return] [h: varsFromStrProp(wProp, "SUFFIXED") ]
Code: Select all
varsFromStrProp() requires 1 parameters
Re: Tutorial: Macro Dialogs and Frames
Heh none taken, but the function to check if a property was empty was requested by several non programmers who were having errors occur during macrosn3phrit wrote:ok, I didnt noticed resetProperty() function, but still think that for many GM especially not programmers this will be issue. I hear a java programmer from you, not a macro designer no offense.