Page 1 of 1

equivalent to rbscript

Posted: Sat May 12, 2012 12:27 pm
by cjmj
Please I would need to know the equivalent to RealBasic Scripts in LiveCode. Because I need to create an app where the user could introduce a mathematical function to plot it.
Thank you in advance

Re: equivalent to rbscript

Posted: Sat May 12, 2012 3:13 pm
by Klaus
Hi cjmj,

I don't think that someone will post a more or less complete comparison chart
RB commands <-> LiveCode commands, so if you could be a bit more specific,
we might be able to help you :)

And welcome to the forum!

In the meantime you might want to take a look at these stacks:
http://www.runrev.com/developers/lesson ... nferences/


Best

Klaus

Re: equivalent to rbscript

Posted: Sat May 12, 2012 5:25 pm
by cjmj
Thank you Klaus. I want to create in the stack a text entry field, where the user introduce something like that: "y = x^2 -3x +2", then when the user pushes a button, the program draws it.

Re: equivalent to rbscript

Posted: Sat May 12, 2012 7:46 pm
by BvG
You need math to do that, not a specific programming language, for example:

Code: Select all

put field "formula" into theFormula
repeat with x = 1 to 10
  put theFormula into theTemporary
  replace "x" with x in theTemporary
  put x & comma & value(theTemporary) & return after theData
end repeat
-- draw data here using math

Re: equivalent to rbscript

Posted: Sat May 12, 2012 10:18 pm
by cjmj
Thank you BvG, that´s great!, but I don´t understand what you want to say with "math" in this case.

Re: equivalent to rbscript

Posted: Sun May 13, 2012 1:25 pm
by BvG
Screen coordinates are the same as carthesian coordinates (altho inverted because LC starts at the topleft with 0,0). All things that need positioning on (as in precise on a certain point) a carthesian system are algebra. Algebra is math. You do the math.

Re: equivalent to rbscript

Posted: Sun May 13, 2012 2:32 pm
by cjmj
OK BvG, I understand. By the way, is there any example of code of math graphics on carthesian system?, it would be very useful for me to survey it.
Thanks for your kindness

Re: equivalent to rbscript

Posted: Sun May 13, 2012 5:40 pm
by BvG

Re: equivalent to rbscript

Posted: Sun May 13, 2012 9:35 pm
by cjmj
Sorry BvG I would want to say livecode code.
Thanks

Re: equivalent to rbscript

Posted: Sun May 13, 2012 11:26 pm
by BvG
I don't understand then I guess, didn't I say it's math, and not code?

Re: equivalent to rbscript

Posted: Mon May 14, 2012 6:56 am
by dave_probertGA6e24
Hi cjmj,

I think you need to look in the LC dictionary for the references to "points" in the graphic object.

You can assign the points that are generated by your math functions to lines, which will then be drawn.

Code: Select all

set the points of graphic "fred" to myDataPointsList
where myDataPointsList is an array of x,y values.

That should give you a programmatical start to creating graphs of your data.

Cheers,
Dave

Re: equivalent to rbscript

Posted: Mon May 14, 2012 12:48 pm
by cjmj
I think it is just I need.
I´ll take a look to "point" in the Dictionary
Thanks
Carlos