Re: [NTLK] NewtonScript Question

From: Varun Mehta (varun_at_mehtasw.com)
Date: Tue Nov 12 2002 - 06:36:10 EST


On 11/12/02 3:12 AM, "Paul Guyot" <pguyot_at_kallisys.net> wrote:

>=20
> =C0 (At) 18:21 -0500 11/11/02, Varun Mehta =E9crivait (wrote) :
>> Well, if anyone still cares
>=20
> If you post the source code, we can help. If you only describe what
> happens, we cannot.
>=20
> Imagine that I say: hey, can you please help, I put an ATA card in
> the eMate and then it restarts. :)
>=20
>> numberInt :=3D Rint(StringToNumber(GetSlot(NumBox, 'text)));
>=20
> GetSlot isn't really useful here. You can make the code more readable
> (IMHO) with:
> numberInt :=3D Rint(StringToNumber(NumBox.text));
>=20
> Also, please note that Rint returns a float number. What you probably
> want is RintToL.
>=20
>> SetValue(ResultText,'text,NumberStr(Random(numberInt,typeInt*numberInt))=
);
>=20
> Random expects integers, not floats. So it is probably here that an
> exception was thrown. If you had used RintToL, it probably would have
> worked.

>=20
> Paul
Ah, I understand now. Sorry if I come off as sarcastic, it's one of the
problems of being a teenager, sarcasm creeps in when you don't want it to ;=
)

I see what was wrong. I couldn't find RintToL in the docs, chalk it up to
carelessness.

I think I get the basics now, thank you for your help.

-- 
This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries
List FAQ/Etiquette/Terms: http://www.newtontalk.net/faq.html
Official Newton FAQ: http://www.chuma.org/newton/faq/



This archive was generated by hypermail 2.1.2 : Mon Dec 02 2002 - 22:02:33 EST