How to start this project...
Jim Ault
JimAultWins at yahoo.com
Tue Oct 3 17:11:16 EDT 2006
Sorry about the quick response in the previous email, as I was trying to
give an example of a repeat loop, and being a bit inaccurate. I did not get
what you were trying to accomplish...I am still not sure what you are trying
to do...., but here is one way of joining tasks...
--assuming this would be a desired result
input = "ABC"
edit field ="ACB"
output = "132"
-----thus use the following
on mouseup
repeat for each char CH in fld editField
put lookupchar(CH, fld input) after newString
end repeat
put newString into fld output
answer "You bidding has been done, Master" & cr & \
fld editField & " has been decoded to " & cr & \
fld ouput
end mouseup
function lookupchar tchar
--get offset (tchar,field "input")
-- if it = 0 then return tchar else \
--return char it of field "Output"
-- this line does not make sense to me
return offset (tchar,field "input")
end lookupchar
On 10/3/06 1:29 PM, "Jim Ault" <JimAultWins at yahoo.com> wrote:
> If you are replacing each char, then you need a repeat loop that calls the
> lookup function once for each char.
>
> --button script
> on mouseup
> repeat for each char CH in fld input
> put lookupchar(CH) after newString
> end repeat
> put newString into fld output
> answer "You bidding has been done, Master" & cr & \
> fld input & " has been converted to " & cr & \
> fld ouput
> end mouseup
>
> Jim Ault
> Las Vegas
>
> On 10/3/06 10:51 AM, "Adrian Williams" <adrian at clubtype.co.uk> wrote:
>
>> I decided to start with a simple function,
>> before getting involved with what to do with the return value....
>>
>> On 2 Oct 2006, at 10:47, Martin Blackman wrote:
>>
>>> Jacqueline covered it much better than me there. The lookupchar
>>> function was indeed intended as a separate function for you to write.
>>> eg. you might do something like this
>>>
>>> -- field "input" contains list of chars which should be replaced, eg
>>> "ABC"
>>> -- field "output" contains your desired output chars in matching
>>> order, eg "123"
>>>
>>> function lookupchar tchar
>>> get offset (tchar,field "input")
>>> if it = 0 then return tchar else \
>>> return char it of field "Output"
>>> end lookupchar
>>>
>> So... I made a new main Stack: lookup.rev,
>> created three fields: editedText, input, output,
>> and a button to run the script.
>>
>> ABC is first line of 'input' field.
>> 123 is first line of output filed.
>> in field editedText, ABC is entered.
>> Button is pressed.
>> Result: "Error in handler"
>> Hint: function.
>>
>> This function should work in its own right - yes?
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list