View Single Post
Old 12-09-2017, 12:00 PM   #9
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,785
Default

Quote:
Originally Posted by fundorin View Post
Could you, please, be so kind an just teach me of how to generate variable names like this "text[1]" and store info in them, like arrays with EEL2?
The string slots are accessed just by the numbers that are their addresses. EEL knows them from normal number as they are used as arguments for string functions or by the "#" operator for named strings inhabitating additional slots, or (as a special syntax candy) with the += operator being mapped to strcat(), while the = operator (like any other) simply works on the numbers.

In my OSCII-Bot script I do:

Code:
@init:
l2s           = 0;                        // strings base slot
l22           = 0;                        // array midi CC messages msg2 base


n = 0;

// Main Fader  <-> 0x24
  strcpy(n+l2s,  "/lr/mix/fader");
  l22[n]        = 0x24;
  n += 1;

// Fader 4 <-> 0x1d
  strcpy(n+l2s,  "/ch/04/mix/fader");
  l22[n]        = 0x1d;
  n += 1;
  
// Fader 5 <-> 0x1e
  strcpy(n+l2s,  "/ch/05/mix/fader");
  l22[n]        = 0x1e;
  n += 1;
  
// Fader 6 <-> 0x1f
  strcpy(n+l2s,  "/ch/06/mix/fader");
  l22[n]        = 0x1f;
  n += 1;
...


@timer
!t ? (
t -= 1;
ti ? (
  ti -= 1;		
  l2o[ti] = -1;
  oscsend(XR18, ti+l2s);
  printf("-> %s\n", ti+l2s);
);
-Michael

Last edited by mschnell; 12-09-2017 at 12:50 PM.
mschnell is online now   Reply With Quote