equivalent to rbscript

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
cjmj
Posts: 12
Joined: Tue Mar 08, 2011 6:34 pm

equivalent to rbscript

Post by cjmj » Sat May 12, 2012 12:27 pm

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

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: equivalent to rbscript

Post by Klaus » Sat May 12, 2012 3:13 pm

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

cjmj
Posts: 12
Joined: Tue Mar 08, 2011 6:34 pm

Re: equivalent to rbscript

Post by cjmj » Sat May 12, 2012 5:25 pm

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.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: equivalent to rbscript

Post by BvG » Sat May 12, 2012 7:46 pm

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
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

cjmj
Posts: 12
Joined: Tue Mar 08, 2011 6:34 pm

Re: equivalent to rbscript

Post by cjmj » Sat May 12, 2012 10:18 pm

Thank you BvG, that´s great!, but I don´t understand what you want to say with "math" in this case.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: equivalent to rbscript

Post by BvG » Sun May 13, 2012 1:25 pm

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.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

cjmj
Posts: 12
Joined: Tue Mar 08, 2011 6:34 pm

Re: equivalent to rbscript

Post by cjmj » Sun May 13, 2012 2:32 pm

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

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: equivalent to rbscript

Post by BvG » Sun May 13, 2012 5:40 pm

Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

cjmj
Posts: 12
Joined: Tue Mar 08, 2011 6:34 pm

Re: equivalent to rbscript

Post by cjmj » Sun May 13, 2012 9:35 pm

Sorry BvG I would want to say livecode code.
Thanks

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: equivalent to rbscript

Post by BvG » Sun May 13, 2012 11:26 pm

I don't understand then I guess, didn't I say it's math, and not code?
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Contact:

Re: equivalent to rbscript

Post by dave_probertGA6e24 » Mon May 14, 2012 6:56 am

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
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.

cjmj
Posts: 12
Joined: Tue Mar 08, 2011 6:34 pm

Re: equivalent to rbscript

Post by cjmj » Mon May 14, 2012 12:48 pm

I think it is just I need.
I´ll take a look to "point" in the Dictionary
Thanks
Carlos

Post Reply