Script Improvement Advice
Ken Ray
kray at sonsothunder.com
Thu Jun 5 00:35:01 EDT 2003
Paul,
First of all, I'd make sure the the fields "ElementNameField" through
"AbundanceField" were sequentially numbered. Then you could do something
like this (assuming it's fields 1 through 18 (pardon the line breaks -
you can make it continuous if you like):
on mouseUp
put "Hydrogen,1,1.008,37,N/A,1,gas,8.9E-5," & \
"-259,-253,0.12,0.90,14.90,0.002,13.60," & \
"0.75,2.2,1400" into tData
repeat with x = 1 to 18
put item x of tData into fld x
end repeat
end mouseUp
I would suggest also storing your data somewhere other than scripts
(like maybe custom properties or a text file), but it's your choice.
Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
> -----Original Message-----
> From: use-revolution-admin at lists.runrev.com
> [mailto:use-revolution-admin at lists.runrev.com] On Behalf Of
> Paul Charlesworth
> Sent: Wednesday, June 04, 2003 11:18 PM
> To: use-revolution at lists.runrev.com
> Subject: Script Improvement Advice
>
>
> Dear All:
>
> I am working on my first ever programming project, a simple periodic
> table, and have created the interface using colored buttons. At the
> bottom of the screen I have an area with elemental
> properties. This is
> basically a Tab area (for future options) and a series of fields for
> each property.
>
> What I would like to know is the most elegant beginners way to script
> the placement of properties into each field on pressing an element
> button. At this point I am adding the following script to each button:
>
> on mouseup
> put "Hydrogen" into field "ElementNameField"
> put "1" into field "AtomicNumberField"
> put "1.008" into field "AtomicMassField"
> put "37" into field "AtomicRadiusField"
> put "N/A" into field "IonicRadiusField"
> put "1" into field "OxidationStatesField"
> put "gas" into field "StateField"
> put "8.9E-5" into field "DensityField"
> put "-259" into field "MeltingPointField"
> put "-253" into field "BoilingPointField"
> put "0.12" into field "HeatFusionField"
> put "0.90" into field "HeatVapField"
> put "14.90" into field "SpecificHeatField"
> put "0.002" into field "ThermalCondField"
> put "13.60" into field "IonizationEnergyField"
> put "0.75" into field "ElectronAffinityField"
> put "2.2" into field "ElectronegativityField"
> put "1400" into field "AbundanceField"
> end mouseup
>
>
> It works great, but I hoping to learn if there was a better way that
> might improve speed or save file size. My next questions will
> probably
> be about icons, about boxes, building, and distribution.
>
> Many thanks,
>
> Paul
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-> revolution
>
More information about the use-livecode
mailing list