Re : Initializing variables

2002-03-11 Thread Jan Decroos

Maybe this can help:

we use next handler to initailize variables :
PutInto youValue,"destinationKinds","destinationNames"

with
destinationKinds :  comma separated list of destination kinds
"g" : global,
"c" : card field,
"b" or "f" background field,
"c"  : card field
empty items : repeat previous one
destinationNames : comma separated list of of short names
of the destinations

example :

PutInto empty,"g,c,,b","gName1,cfield1,cfield2,bfield1" equals to
put empty into gName1   -- gName1 = globalName
put empty into card field "cfield1"
put empty into card field "cfield2"
put empty into bg field "bfield1"

PutInto 5,"b","bfield1,bfield2,bfield3,bfield4,bfield5,bfield6" equals to
put 5 into field "bfield1"
put 5 into field "bfield2"
put 5 into field "bfield3"
put 5 into field "bfield4"
put 5 into field "bfield5"
put 5 into field "bfield6"

here's the handler (in DEV, so AS IS...) :
(store it in your stack script, or in the stack script of a 'stackinuse')

**
on PutInto pValue, pKinds, pNames
  put the HCAddressing of this stack into lHCAddr
  set the HCAddressing of this stack to false
  try
put 0 into xx
repeat for each item lName in pNames
  add 1 to xx
  put char 1 of item xx of pKinds into lKind
  if lKind = "" then put lPrevKind into lKind
  if lKind = "g" then do "global "&(lName)&CR&"put pValue into "&lName
  else if lKind = "c" or lKind = "b" or lKind = "f" then put pValue into
fld lName
  put lKind into lPrevKind
end repeat
  catch lMess
answer "PutInto : Cannot handle "&lName&" !"
exit to top
  finally
set the HCAddressing of this stack to lHCAddr
  end try
end PutInto
***

Hope this helps...

Jan

___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution



Re: Initializing variables

2002-03-10 Thread cowhead
 When you have a long list of variables, it might be easier to try an
array instead.
For example:

on mouseUp
global myVar
repeat with i = 1 to 1000
put 0 into myVar[i]
end repeat
end mouseUp

So, instead of calling your variables x,y,z etc...you can simply call
them
myVar[1],myVar[2], etc

good luck,

mark in Japan

Jim wrote:


I have a list of variables, say "x,y,z"
> I would like to set each of these equal to zero. If
> I were to use the
> following:
>
> put "x,y,z" into tList
> repeat with i = 1 to 3
> put 0 into item i of tList
> end repeat

___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Initializing variables

2002-03-09 Thread David Vaughan


On Sunday, March 10, 2002, at 02:11 , Jan Schenkel wrote:

> Hi Jim,
>
>> I have a list of variables, say "x,y,z"
>> I would like to set each of these equal to zero.
>
> You might want to replace the script with the
> following:
>
>  put "x,y,z" into tList
>  repeat with i = 1 to 3
>   do "put 0 into" && item i of tList
>  end repeat

Jim & Jan
A faster approach along the same lines (faster because there is less 
coding to put variables into a list) might be to get the list via the 
localNames() function. and remove the ones you do _not_ want to 
initialise...
cheers
David

>
> Best regards,
>
> Jan Schenkel
>
> "As we grow older, we grow both wiser and more foolish
> at the same time."  (De Rochefoucald)
>


___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution



Initializing variables

2002-03-09 Thread Jim Hurley

I have a list of variables, say "x,y,z"

I would like to set each of these equal to zero. If I were to use the 
following:

put "x,y,z" into tList
repeat with i = 1 to 3
put 0 into item i of tList
end repeat

This would of course replace the list x,y,z by 0,0,0 and not achieve 
my objective.

Instead I want x,y, and z to take on the values 0. I've tried quotes 
and value() without success. My actual list is very long and it would 
be awkward to

put 0 into x
put 0 into y
put 0 into z

Any thoughts on an efficient way of assigning values to variables 
within a list?

Thanks,

Jim Hurley
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution