LiveCode: Need help!

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

kjetil403
Posts: 9
Joined: Wed Feb 29, 2012 11:17 pm

LiveCode: Need help!

Post by kjetil403 » Wed Feb 29, 2012 11:21 pm

Hello!

I was wondering if any1 knew how i could control one objekt from an nother using buttons?

Simple control, like right and left in one spesefic area.

Please show coding to, ty!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: LiveCode: Need help!

Post by dunbarx » Wed Feb 29, 2012 11:43 pm

Hi.

It is hard to know what you are asking for. Do you mean move a control around the screen using buttons? Please write back with more details.

Craig Newman

kjetil403
Posts: 9
Joined: Wed Feb 29, 2012 11:17 pm

Re: LiveCode: Need help!

Post by kjetil403 » Thu Mar 01, 2012 7:22 am

oh srry, but yes. To move objekts around the screen with buttons.

I would allso like the objekt that is moving, to move only in one bane/area that i choose. If thats possible.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: LiveCode: Need help!

Post by Mark » Thu Mar 01, 2012 12:02 pm

Hi,

It is obvious that you need help and that your post is related to LiveCode, just like all other posts in this forum. Please, update the title of your post!!!

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: LiveCode: Need help!

Post by dunbarx » Thu Mar 01, 2012 2:51 pm

Everything is possible.

Can you tell us a little about how much experience you have with LiveCode? Have you ever authored a stack or written a script?

So if I told you to make two buttons, one named "mover", and to put this in the script of the other one:

Code: Select all

on mouseStillDown
   get the loc of btn "mover"
   set the loc of btn "mover" to  item 1 of it + 1 & "," & item 2 of it
end mouseStillDown
Would you understand that this?

This is not the best way to do what you want, and it offers very little control. I just need to see where you are with LiveCode skills at the moment.

Craig Newman

kjetil403
Posts: 9
Joined: Wed Feb 29, 2012 11:17 pm

Re: LiveCode: Need help!

Post by kjetil403 » Thu Mar 01, 2012 3:15 pm

Well, i dot not have much experience with LiveCode. I started 2 days ago to be honest. I am planing to make a Iphone Application, i know the basic scrip code for mostly buttons, cards and some action. And yes, i do understand half of the script u showed me, but only when u make the btn a location, but not after that?.. please help

Is there a tutorial vid about controls or ?
Last edited by kjetil403 on Thu Mar 01, 2012 4:59 pm, edited 1 time in total.

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

Re: LiveCode: Need help!

Post by Klaus » Thu Mar 01, 2012 3:18 pm

Hi kjetil403,

please go through these stack to get the basics of LiveCode!
http://www.runrev.com/developers/lesson ... nferences/


Best

Klaus

kjetil403
Posts: 9
Joined: Wed Feb 29, 2012 11:17 pm

Re: LiveCode: Need help!

Post by kjetil403 » Thu Mar 01, 2012 5:44 pm

Hi klaus.

I have went there, but i do not see the answere to my question there. Is there a video, or a similiar link where they talk about controls, like "how to move an object from a button?" and stuff like that.

Thanks

Kjetil

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

Re: LiveCode: Need help!

Post by Klaus » Thu Mar 01, 2012 5:58 pm

Hi Kjetil,

I don't think there are any videos to explaining exactly this.
So we need to THINK about the problem by ourselves to solve it :D

And we need more info about what you want to do exactly, we actually still have no idea!
If you can describe the problem then you can script it in LiveCode!

OK, so you want to:
1. click a button and then WHAT should happen?
2. Move one or more objects around the card?
3. if yes, FROM where TO where?
4. in what time?
OK so far?


Best

Klaus

kjetil403
Posts: 9
Joined: Wed Feb 29, 2012 11:17 pm

Re: LiveCode: Need help!

Post by kjetil403 » Thu Mar 01, 2012 6:21 pm

Hello and thanks for the fast answere:D Ok, so baseicly im new to livecode, i want to make an Game/application with some action.

To answere your questions:
1. Lets say i have a plain, and clear card. I want to have to diffrent buttons that can control one objekt in each direction(right, left) So lets say i click the left button.(the objekt starts in the middle of the card) Then the object should move the hole time(to the left), until the button is unpressed again.But the object should´nt be able to move out of the screen of course, so there has to be a limit.
2. There should only be one object that will be able to move in the card. The objekt should allso be controlled by 2 btns that makes the object go right and left.(read above)
3.Lets say someone presses the right button. Then the object should move right until the end of the screen. Lets say someone decides to press the left button before the object had been able to go to the end of the screen on the right. Then the button should at once, change direction to left from right.
4.I am not sure if i understand this question ritgh :P But if u mean what time the object should move, then that is right away when either right button or left button on the screen gets clicked. If u mean the speed of the movement. Then its should be pretty fast, i dont know any normal movement speed on normal games, but that we talk about later ^^

I hope you understand my meaning and my answere´s. if not ask me again:) Thanks for the help so far!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: LiveCode: Need help!

Post by dunbarx » Thu Mar 01, 2012 7:08 pm

OK. But you have to promise to play around with this until you are an expert.

Make three buttons. Name one "goLeft", another "goRight" and the third "mover"

Place this in the script of button "goLeft":

Code: Select all

on mouseDown
  moveLeft
end mouseDown

on moveLeft
   get the loc of btn "mover"
   
   if the mouse is down then set the loc of btn "mover" to  item 1 of it - 1 & "," & item 2 of it
   else exit to top
   
   if item 1 of the topleft of btn "mover" < 2 then exit to top
   send moveLeft to me in 1
end moveLeft
Can you take this and modify it so that it makes sense in the script of button "goRight"? Please try. Can you see how to change the speed?

Now make what you need to reset the button, if that is important. Write back often.

Craig Newman

kjetil403
Posts: 9
Joined: Wed Feb 29, 2012 11:17 pm

Re: LiveCode: Need help!

Post by kjetil403 » Thu Mar 01, 2012 7:23 pm

WoW, ty very much! i will play around with it, until I and understand it.

kjetil403
Posts: 9
Joined: Wed Feb 29, 2012 11:17 pm

Re: LiveCode: Need help!

Post by kjetil403 » Thu Mar 01, 2012 7:46 pm

Hello again!:)

I have to questions
-how do i change the movementspeed of the button "Move"? i have tried: set movement speed on btn "Move" to 2000
but it doesent work? :S

-And what exactly in the code u posted, is it that makes it go left, and not right?

Im srry about all the questions, but i need to understand :D

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: LiveCode: Need help!

Post by dunbarx » Thu Mar 01, 2012 8:11 pm

Yes, you need to understand. You are jumping in to this at a level that would normally assume you already had many hours of productive learning and experimenting. So the basics are eluding you.

What made you think you could simply write: "set movement on button "move" to 2000"?

This is a new language you have to learn, It has a syntax and vocabulary. You will likely learn quickly, but will stumble as well.

In the line "...set the loc of btn "mover to item 1 of it - 1 & "," & item 2 of it"

Anyway, change the "-1" to "-3" and see what happens. Now please try to understand why.

You must read in the dictionary about EACH ONE of the words in that script. Try to assemble them into an idea about how this all works. Make that "goRight" script.

Craig Newman

kjetil403
Posts: 9
Joined: Wed Feb 29, 2012 11:17 pm

Re: LiveCode: Need help!

Post by kjetil403 » Thu Mar 01, 2012 8:34 pm

okay,what kind of computer language is this called?

-what do you mean "make that "goRight" script"?

how do i make it go right?straight, or up and down? please explain this laast thing, it will mean allot to me :)
after this i will curtently learn the language better.

TY
Last edited by kjetil403 on Thu Mar 01, 2012 8:38 pm, edited 1 time in total.

Post Reply