Note Puzzle Help

For problems with creating games or for reporting bugs of the Tool.
Post Reply
StarLite
An Adventure Creator
Posts: 446
Joined: 02 Jul 2005, 18:32
Contact:

Note Puzzle Help

Post: # 75243Post StarLite
18 Feb 2010, 20:15

Good day everyone

Well I'm nearing the end of Roanoke and this is the very last puzzle. I hope. I am trying to construct a torn note puzzle where you have to put the pieces together. I am using the sliderbars tutorial script.

1. What I want to try to do is. When I move the note piece to it's correct spot I don't want to be able to move it again once it is in place.

2. When all the pieces are in place correctly I want to be able to go into the next room which shows the assembled note when it is put together

3. I can move the first piece of puzzle, no problem, but when I try to drag the second piece, it just moves by itself and stays in the one spot as you can see in the pic below

Image

Ok, here is the script for the start cutscene

Code: Select all

realtime (true)
loadroom (Room2)

setnum (N1x ; 559)
setnum (N1y ; 559)
setnum (N2x ; 345)
setnum (N2y ; 345)
setnum (N3x ; 166)
setnum (N3y ; 166)
setnum (N4x ; 467)
setnum (N4y ; 467)
setnum (N5x ; 283)
setnum (N5y ; 467)
setnum (N6x ; 482)
setnum (N6y ; 467)
setnum (N7x ; 41)
setnum (N7y ; 467)
setnum (N8x ; 187)
setnum (N8y ; 467)
Here is the script for the puzzle room

Code: Select all

on (loop1)
  if_num (Note_1 ; 1)
  {
  setnum (x ; 0)
  setnum (y ; 0)
  setnum (x ; [mousex] -[mx])
  setnum (y ; [mousey] -[my])
  setnum (N1x ; +[x])
  moveobj (Note_1; +[x] ; +[y]; 0)

  setnum (mx ; [mousex])
  setnum (my ; [mousey])
  }
 if_num (Note_2 ; 1)
  {
  setnum (x ; 0)
  setnum (y ; 0)
  setnum (x ; [mousex] -[mx])
  setnum (y ; [mousey] -[my])
  setnum (N2x ; +[x])
  moveobj (Note_2 ; +[x] ; +[y]; 0)

  setnum (mx ; [mousex])
  setnum (my ; [mousey])
  }
 if_num (Note_3 ; 1)
  {
  setnum (x ; 0)
  setnum (y ; 0)
  setnum (x ; [mousex] -[mx])
  setnum (y ; [mousey] -[my])
  setnum (N3x ; +[x])
  moveobj (Note_3 ; +[x] ; +[y]; 0)

  setnum (mx ; [mousex])
  setnum (my ; [mousey])
  }
 if_num (Note_4 ; 1)
  {
  setnum (x ; 0)
  setnum (y ; 0)
  setnum (x ; [mousex] -[mx])
  setnum (y ; [mousey] -[my])
  setnum (N4x ; +[x])
  moveobj (Note_4 ; +[x] ; +[y]; 0)

  setnum (mx ; [mousex])
  setnum (my ; [mousey])
  }
  if_num (Note_5 ; 1)
  {
  setnum (x ; 0)
  setnum (y ; 0)
  setnum (x ; [mousex] -[mx])
  setnum (y ; [mousey] -[my])
  setnum (N5x ; +[x])
  moveobj (Note_5 ; +[x] ; +[y]; 0)

  setnum (mx ; [mousex])
  setnum (my ; [mousey])
  }
  if_num (Note_6 ; 1)
  {
  setnum (x ; 0)
  setnum (y ; 0)
  setnum (x ; [mousex] -[mx])
  setnum (y ; [mousey] -[my])
  setnum (N6x ; +[x])
  moveobj (Note_6 ; +[x] ; +[y]; 0)

  setnum (mx ; [mousex])
  setnum (my ; [mousey])
  }
  if_num (Note_7 ; 1)
  {
  setnum (x ; 0)
  setnum (y ; 0)
  setnum (x ; [mousex] -[mx])
  setnum (y ; [mousey] -[my])
  setnum (N7x ; +[x])
  moveobj (Note_7 ; +[x] ; +[y]; 0)

  setnum (mx ; [mousex])
  setnum (my ; [mousey])
  }
  if_num (Note_8 ; 1)
  {
  setnum (x ; 0)
  setnum (y ; 0)
  setnum (x ; [mousex] -[mx])
  setnum (y ; [mousey] -[my])
  setnum (N8x ; +[x])
  moveobj (Note_8 ; +[x] ; +[y]; 0)

  setnum (mx ; [mousex])
  setnum (my ; [mousey])
  }
Here is the script for the first Note piece

Code: Select all

on (click)
 {
 setnum (Note_1 ; 1)
 setnum (mx ; [mousex])
 setnum (my ; [mousey])
 }

on (release)
 {
 if_yobj (Note_1 ; <195)
  setnum (ypos ; 1)
 if_yobj (Note_1 ; >194)
  setnum (ypos ; 2)

 setnum (xpos ; 0)
 setnum (xpos ; [N1x])
 setnum (xpos ; [xpos]/152)
 if_num (xpos ; <1)
  setnum (xpos ; 1)
 if_num (xpos ; >4)
  setnum (xpos ; 4)

 setnum (ok ; 0)
 if_num (Note_2x ; [xpos])
  if_num (Note_2y ; [ypos])
   setnum (ok ; 99)
 if_num (Note_3x ; [xpos])
  if_num (Note_3y ; [ypos])
   setnum (ok ; 99)
 if_num (Note_4x ; [xpos])
  if_num (Note_4y ; [ypos])
   setnum (ok ; 99)

 if_num (ok ; 0)
  {
  setnum (Note_1x ; [xpos])
  setnum (Note_1y ; [ypos])
  }
 if_num (ok ; 99)
   playsound (wrong)


  if_num (Note_1y ; 1)
  setnum (ypos ; 69)
 if_num (Note_1y ; 2)
  setnum (ypos ; 243)
 setnum (N1x ; [Note_1x] * 152 + 4)
 moveobj (Note_1 ; [N1x] ; [ypos] ; 0)
 setnum (Note_1 ; 0)
 }
And here is the code for the second Note Piece which I am having trouble moving

Code: Select all

on (click)
 {
 setnum (Note_2 ; 1)
 setnum (mx ; [mousex])
 setnum (my ; [mousey])
 }

on (release)
 {

 if_yobj (Note_2 ; <195)
  setnum (ypos ; 1)
 if_yobj (Note_2 ; >194)
  setnum (ypos ; 2)

 setnum (xpos ; [N2x])
 setnum (xpos ; [xpos]/240)
 if_num (xpos ; <1)
  setnum (xpos ; 1)
 if_num (xpos ; >4)
  setnum (xpos ; 4)

 setnum (ok ; 0)
 if_num (Note_4x ; [xpos])
  if_num (Note_4y ; [ypos])
   setnum (ok ; 99)
 if_num (Note_3x ; [xpos])
  if_num (Note_3y ; [ypos])
   setnum (ok ; 99)
 if_num (Note_1x ; [xpos])
  if_num (Note_1y ; [ypos])
   setnum (ok ; 99)

 if_num (ok ; 0)
  {
  setnum (Note_2x ; [xpos])
  setnum (Note_2y ; [ypos])
  }
 if_num (ok ; 99)
   playsound (wrong)


  if_num (Note_2y ; 1)
  setnum (ypos ; 69)
 if_num (Note_2y ; 2)
  setnum (ypos ; 243)
 setnum (N2x ; [Note_2x] * 240 + 4)
 moveobj (Note_2 ; [N2x] ; [ypos] ; 0)
 setnum (Note_2 ; 0)
 }
Any help would be greatly appreciated. Once I get this puzzle solved and the rest of the male voices in, then the game will be ready to be released. Please help me
StarLite Moon's Creators Haven

http://starlite-moon.freeforums.net

Schiman
PaC-DK God
Posts: 1177
Joined: 20 Dec 2006, 21:48
Contact:

Re: Note Puzzle Help

Post: # 75244Post Schiman
19 Feb 2010, 08:22

Hi StarLite,

first of all I have to say that you do a lot of unnecessary work :shock: .
I recommend you to parameterize your functions as much as you can. This means to make your function depending on a certain number of Variables and the rest should be exactly the same.

The Script for the puzzle room (loop1) for example is sooo huge, but it can be so small...
I would'nt use the on(loop1) at all. I would write a new function called "papermove" for example.
Here is the code which I would use in "papermove":

Code: Select all

setnum(MoveX;[mousex]-[xDifference])
setnum(MoveY;[mousey]-[yDifference])  
moveobj(Note_[NoteNumber];[MoveX];[MoveY];0)
Now the script for EVERY Note:

Code: Select all

on(click)
 {
   setnum (NoteNumber ; 1)   (*This Number should be set in every Note (in this example it's Note_1*)   
   setnum(xDifference;[mousex]-[objx:Note_[NoteNumber]])  (*This differences are necessary, because you want to drag the papernotes as you would drag them in the real word.*)
   setnum(yDifference;[mousey]-[objy:Note_[NoteNumber]])
   function(papermove;infinit)  (*"papermove" makes the Note follow your mouse.*)
 }

on (release)
 {
   stopfunction(papermove) (*You have to stop the movement of the note when the mousebutton is released.*)
   
   (*I didn't understand the rest of your code ;-( .*)
 }

Well, sorry, but I didn't understand the on(release)-part of your Note-Scripts. I think you made something wrong there, but I absolutely don't understand the sript at all XD.

StarLite
An Adventure Creator
Posts: 446
Joined: 02 Jul 2005, 18:32
Contact:

Post: # 75254Post StarLite
19 Feb 2010, 20:03

Hi Schiman

First of all I'm very grateful for your help. This puzzle finishes the game

I'm sorry I'm not very good with script, I know I should be a lot better especially given the length of time I've been doing this. I'm not very good at learning on my own. It usually takes about 3 or 4 times before I catch on when someone explains things to me. Although I am eager to learn.

Well, sorry, but I didn't understand the on(release)-part of your Note-Scripts. I think you made something wrong there, but I absolutely don't understand the sript at all
To tell the truth I don't have any idea either. I just used the slderbar script and hoped for the best.

What I was trying to achieve was, each note piece has it's own space it fits into. I just tried your function script and it worked perfect, but what I need to do is when I put each piece into it's proper place, I should not be able to put a note piece in the same place as another. The way it is now, I can stack all the note pieces on top of each other instead of spelling out the message on the note. Then once the note is assembled I want to go to the next room which is the assembled note. Sorry I hope this makes sense. I'm about as good at explaining things as I am at script

The picture below is how the note should look as it is assembled.

The other script you gave me for the computer screen worked great. Thank you once again. Hopefully you'll be playing this game sometime next week, if all goes well script and health wise.

[img][img]http://img705.imageshack.us/img705/2348/noteh.jpg[/img]
[/img]
StarLite Moon's Creators Haven

http://starlite-moon.freeforums.net

StarLite
An Adventure Creator
Posts: 446
Joined: 02 Jul 2005, 18:32
Contact:

Post: # 75289Post StarLite
26 Feb 2010, 22:45

Good day all

Well I've been hard at this pain in neck puzzle since I've posted this message. I managed to get things semi working but here is the problem now. I want to drag the note pieces to their proper places. But what is happening is when you click on a note piece instead of dragging it to it's proper place, it goes there on it's own. I know the problem is with this line

Code: Select all

 moveobj (Note_[NoteNumber] ; [n1x] ; [ypos] ; 0)
But I can't figure out where. This is the last puzzle in the game, all that's left is the voices and that's it. Could someone please help me with this, I would greatly appreciate it. Thank you
StarLite Moon's Creators Haven

http://starlite-moon.freeforums.net

Schiman
PaC-DK God
Posts: 1177
Joined: 20 Dec 2006, 21:48
Contact:

Post: # 75290Post Schiman
26 Feb 2010, 22:54

Could you please post more than this one line^^. I personally can't help you without the code.

StarLite
An Adventure Creator
Posts: 446
Joined: 02 Jul 2005, 18:32
Contact:

Post: # 75291Post StarLite
27 Feb 2010, 00:41

Hi Schiman,

Thanks for the reply. Don't get mad at me, I know you told me to shorten the script but this is the best way I know how to do this puzzle. I took the script from the sliderbar tutorial and just added what I needed. I hope you can figure this out. Here is all the script for the 1st piece of the note. There are 8 note pieces 2 lines with 4 pieces each line

Code: Select all

on(click)
 {
   setnum (NoteNumber ; 1)
   setnum(xDifference;[mousex]-[objx:Note_[NoteNumber]])
   setnum(yDifference;[mousey]-[objy:Note_[NoteNumber]])
   function(papermove;infinit)
 }

 on (release)
  {
 if_yobj (Note_[NoteNumber] ; <202)
  setnum (ypos ; 1)
 if_yobj (Note_[NoteNumber] ; >201)
  setnum (ypos ; 2)
 setnum (xpos ; 0)
 setnum (xpos ; [NoteNumberx])
 setnum (xpos ; [xpos]/159)
 if_num (xpos ; <1)
  setnum (xpos ; 1)
 if_num (xpos ; >1)
  setnum (xpos ; 1)
 setnum (ok ; 0)
 if_num (Note_4x ; [xpos])
  if_num (Note_4y ; [ypos])
   setnum (ok ; 99)
 if_num (Note_3x ; [xpos])
  if_num (Note_3y ; [ypos])
   setnum (ok ; 99)
 if_num (Note_2x ; [xpos])
  if_num (Note_2y ; [ypos])
   setnum (ok ; 99)
 if_num (ok ; 0)
  {
  playsound(button;100)
  setnum (NoteNumberx ; [xpos])
  setnum (NoteNumbery ; [ypos])
  }
 if_num (ok ; 99)
   playsound (wrong)

 if_num (NoteNumbery ; 1)
  setnum (ypos ; 76)
 if_num (NoteNumbery ; 2)
  setnum (ypos ; 76)
 setnum (n1x ; [NoteNumberx] * 159 + 1)
 moveobj (Note_[NoteNumber] ; [n1x] ; [ypos] ; 0)
 setnum (NoteNumber ; 0)
 stopfunction(papermove)
 }
When I click on the note piece it moves by itself. I want to be able to drag it into it's right place and not be able to move the piece once it is in place. Then when I put the next piece of puzzle in I don't want to be able to put the piece in another puzzle piece's slot. I hope this makes sense. Sorry
StarLite Moon's Creators Haven

http://starlite-moon.freeforums.net

Schiman
PaC-DK God
Posts: 1177
Joined: 20 Dec 2006, 21:48
Contact:

Post: # 75355Post Schiman
08 Mar 2010, 16:33

I think you have an error in reasoning. The variable ypos is either 1 or 2. xpos is always 1. So your Note is necessarily going to move. To be honest, your script doesn't make sense to me at all. You should rethink it from the beginning on.

Sorry, but I really don't know how to help you with that script XD.

StarLite
An Adventure Creator
Posts: 446
Joined: 02 Jul 2005, 18:32
Contact:

Post: # 75357Post StarLite
08 Mar 2010, 17:44

Hi Schiman,

I really appreciate you taking the time to try to help me. I used the sliderbar tutorial and just added my own co-ordinates. It works fine, except instead of being able to drag the note piece, it moves by itself the moment you release the mouse button. It goes to the right spot it's supposed to, but it does it on it's own. Actually this would be a really good script for one of those hidden object type games where you have to click on an object and it moves to the ring on it's own. So I think I'll keep the script for that.

I've never done this type of puzzle before so I'm in the dark about how to even begin. I wonder if Lachi can help me. I was going through the messages today and seen that Lachi was working on the same type of puzzle last year.

If I can't get this puzzle to work then I have no option but to leave it out. Ok, then I'll just strip down the code and see what else I can come up.

Thank you once again for your help.
StarLite Moon's Creators Haven

http://starlite-moon.freeforums.net

Post Reply