]]>
2016-07-26T20:17:06+02:002016-07-26T20:17:06+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35643#p35643you're right the CHR is missing in the script engine. It will be corrected in the next major release.
the work arround is to create the CHR function yourself like bellow. Fully customizable
senso+++
CODE:
function MyCHR(i:integer):Char;const S ='ABCDEFGHIJKLMNOPQRSTUVWXYZ';begin result := S[i-40];end;//////////////////////////////// main proc//////////////////////////////Procedure Process;begin writeln(MyChr(41)+MyChr(42));end;
]]>2016-07-26T19:06:57+02:002016-07-26T19:06:57+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35642#p35642I'll check in my archive for script I made using char and string...
Statistics: Posted by oli_lab — 26 Jul 2016, 19:06
]]>2016-07-26T18:51:01+02:002016-07-26T18:51:01+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35641#p35641 1) appends the ascii value to my string rather than the acsii character 2) StrSet() looks interesting however hh throws an "Unknown declaration "StrSet"" error. Maybe this procedure hasn't been implement in hh? 3) char_arr is, by functional requirement, an array of singles though the values at the relevant index are always converted to integers (as they are ascii vals)
oli:
Same problem as #3 above. The array values are singles and can't be added to a string.
Thanks again for your suggestions. I do appreciate them.
]]>2016-07-26T18:21:11+02:002016-07-26T18:21:11+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35640#p35640S := S + ArrChar ?
Statistics: Posted by oli_lab — 26 Jul 2016, 18:21
]]>2016-07-26T06:49:04+02:002016-07-26T06:49:04+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35639#p35639 There are three approaches I'd experiment with...
(1) Your example with a recast along the way... s := s+inttostr(char_arr);
(2) Loop StrSet's, e.g., StrSet(char_arr, x, s); Don't forget to do a SetLength somewhere in there
(3) Declare char_arr as a string to begin with
Dealing with small integers you may need to recast using trunc() or int() somewhere along the line...
]]>2016-07-26T06:11:06+02:002016-07-26T06:11:06+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35638#p35638 To recap : I have an array of singles where each value represents an acsii character. I'm trying to convert this to a string. So I read each value in the array, round()ing it as I go. Now I want to convert each integer value to a char so I can append it to a string. In Pascal proper I'd use the chr() function but in hh that's not available. I guess my question really is how do I convert a single to a char.
]]>2016-07-25T21:36:16+02:002016-07-25T21:36:16+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35635#p35635 In case you missed it, there's a very handy page on strings in the scripting language tutorial: http://www.sensomusic.org/wiki3/doku.ph ... tutorial05
]]>2016-07-25T14:56:54+02:002016-07-25T14:56:54+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35632#p35632I'm fact you treat the char as single
Var currentChar: single
...
currentChar := GetdataArrayvalue(input, Idx );
...
SetdataArrayvalue (output, Idx, currentChar) ;
Statistics: Posted by oli_lab — 25 Jul 2016, 14:56
]]>2016-07-24T22:55:57+02:002016-07-24T22:55:57+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35626#p35626 Thanks for your help!
]]>BrainModularBrainModular Users Forum2016-07-27T15:32:44+02:00https://brainmodular.org/forums/app.php/feed/topic/54792016-07-27T15:32:44+02:002016-07-27T15:32:44+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35644#p35644Statistics: Posted by ahonoe — 27 Jul 2016, 15:32
]]>2016-07-26T20:17:06+02:002016-07-26T20:17:06+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35643#p35643you're right the CHR is missing in the script engine. It will be corrected in the next major release.
the work arround is to create the CHR function yourself like bellow. Fully customizable
senso+++
CODE:
function MyCHR(i:integer):Char;const S ='ABCDEFGHIJKLMNOPQRSTUVWXYZ';begin result := S[i-40];end;//////////////////////////////// main proc//////////////////////////////Procedure Process;begin writeln(MyChr(41)+MyChr(42));end;
]]>2016-07-26T19:06:57+02:002016-07-26T19:06:57+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35642#p35642I'll check in my archive for script I made using char and string...
Statistics: Posted by oli_lab — 26 Jul 2016, 19:06
]]>2016-07-26T18:51:01+02:002016-07-26T18:51:01+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35641#p35641 1) appends the ascii value to my string rather than the acsii character 2) StrSet() looks interesting however hh throws an "Unknown declaration "StrSet"" error. Maybe this procedure hasn't been implement in hh? 3) char_arr is, by functional requirement, an array of singles though the values at the relevant index are always converted to integers (as they are ascii vals)
oli:
Same problem as #3 above. The array values are singles and can't be added to a string.
Thanks again for your suggestions. I do appreciate them.
]]>2016-07-26T18:21:11+02:002016-07-26T18:21:11+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35640#p35640S := S + ArrChar ?
Statistics: Posted by oli_lab — 26 Jul 2016, 18:21
]]>2016-07-26T06:49:04+02:002016-07-26T06:49:04+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35639#p35639 There are three approaches I'd experiment with...
(1) Your example with a recast along the way... s := s+inttostr(char_arr);
(2) Loop StrSet's, e.g., StrSet(char_arr, x, s); Don't forget to do a SetLength somewhere in there
(3) Declare char_arr as a string to begin with
Dealing with small integers you may need to recast using trunc() or int() somewhere along the line...
]]>2016-07-26T06:11:06+02:002016-07-26T06:11:06+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35638#p35638 To recap : I have an array of singles where each value represents an acsii character. I'm trying to convert this to a string. So I read each value in the array, round()ing it as I go. Now I want to convert each integer value to a char so I can append it to a string. In Pascal proper I'd use the chr() function but in hh that's not available. I guess my question really is how do I convert a single to a char.
]]>2016-07-25T21:36:16+02:002016-07-25T21:36:16+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35635#p35635 In case you missed it, there's a very handy page on strings in the scripting language tutorial: http://www.sensomusic.org/wiki3/doku.ph ... tutorial05
]]>2016-07-25T14:56:54+02:002016-07-25T14:56:54+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35632#p35632I'm fact you treat the char as single
Var currentChar: single
...
currentChar := GetdataArrayvalue(input, Idx );
...
SetdataArrayvalue (output, Idx, currentChar) ;
Statistics: Posted by oli_lab — 25 Jul 2016, 14:56
]]>2016-07-24T22:55:57+02:002016-07-24T22:55:57+02:00https://brainmodular.org/forums/viewtopic.php?t=5479&p=35626#p35626 Thanks for your help!