I think I know what you're trying to do, but I think there are better ways to do it using states and boolean variables. Nevertheless, I saw this as a bit of a challenge, so let's see what I came up with...
First up, let me say that I don't think you can do what you're trying to do using strings because there are no (documented) string functions in Adventuron that allow you to extract substrings. However, you can do the same thing if you use an integer rather than a string. Each digit in the integer corresponds to a character in your strings s1, s2 and so on.
First of all, set up the placeholders for your integers. index is the index used to select which of the integers to use. s1, s2 & s3 are the integers. (Add more as needed.) number is which of those integers was selected. (This will be modified during the extraction process.) digit is the digit that you're looking for in number. temp is a temporary variable used during the extraction process.
integers {
index : integer "2";
s1 : integer "1234";
s2 : integer "0204";
s3 : integer "3579";
number : integer "0";
digit : integer "3";
temp : integer "0";
}
Secondly, create a boolean to store the result. This will return true if the digit is in number and false if it is not in the number.
booleans {
result : boolean "false";
}
Thirdly, we need a bit of code in your on_command {} section to set the index, integers s1, s2 & s3, and the digit that you want to test (not shown here, because I don't know how you want to set these up) and a call to the subroutine that will do the work.
on_command {
: match "test me" {
: gosub "contains_digit";
: if (result) {
: print "Contains digit.";
}
: else {
: print "Does not contain digit.";
}
: done;
}
}
Finally, we need a subroutine to do the grunt work.
subroutines {
contains_digit : subroutine {
: if (index == 1) {
: set_integer var = "number" {(s1)}
}
: else_if (index == 2) {
: set_integer var = "number" {(s2)}
}
: else {
: set_integer var = "number" {(s3)}
}
: while (number != 0) {
: set_integer var = "temp" {(number % 10)}
: if (temp == digit) {
: set_true "result";
: return;
}
: set_integer var = "number" {(number / 10)}
}
: set_false "result";
: return;
}
}
I hope this does what you want. (And I'm pretty sure this is 8-bit compatible, though I haven't tried it.)