Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Maverick

#121
I'm dealing with the same issue although the way I interpreted your problem was that you wanted something different than what the actual outcome is.
Ashen, is it possible to combine these threads? http://www.adventuregamestudio.co.uk/yabb/index.php?topic=23854

#122
Thanks Ashen. The move object part works fine. The problem is that the object needs to be placed in a specific Hotspot which would then check whether or not it is in the correct position. Thats is the part I'm havingg trouble with. The code posted in the thread I referrenced was done prior to the solution given by Scorpiorus in his example puzzle and therefore does not cover the entire issue

The actual final script:

// room script file

// total number of objects (including object number 0 which isn't used)
#define _THE_NUMBER_OF_OBJECTS_YOU_HAVE_ 10Ã, 

// called when the puzzle is solved:
function on_puzzle_solved() {
Ã, 
Ã,  Display("Puzzle has just been solved!");
Ã, }
int button_pressed=0, ob=-1;
int correct = 0;

#sectionstart room_aÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
Ã,  // script for room: Repeatedly execute
Ã, 
Ã, 
Ã,  if (IsButtonDown(LEFT)) {
Ã,  Ã,  if (button_pressed==0) {
Ã,  Ã,  Ã,  button_pressed = 1;
Ã,  Ã,  Ã,  ob = GetObjectAt(mouse.x, mouse.y);
Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  if (ob!=-1) {
Ã,  Ã,  Ã,  Ã,  Ã,  int widthÃ,  = GetGameParameter(GP_SPRITEWIDTH, GetObjectGraphic(ob), 0, 0);
Ã,  Ã,  Ã,  Ã,  Ã,  int height = GetGameParameter(GP_SPRITEHEIGHT, GetObjectGraphic(ob), 0, 0);
Ã,  Ã,  Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  Ã,  Ã,  //MoveObjectDirect(ob, mouse.x-width/2, mouse.y+height/2, 7);
Ã,  Ã,  Ã,  Ã,  Ã,  //while (IsObjectMoving(ob)) Wait(1);
Ã,  Ã,  Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã, 
Ã,  Ã,  }
Ã,  } else {
Ã,  Ã,  button_pressed=0;
Ã,  Ã,  if (ob!=-1) {
Ã,  Ã,  Ã,  SetObjectBaseline(ob, 0);Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  ob=-1;
Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  int i = 1; correct = 1;
Ã,  Ã,  Ã,  while (i < _THE_NUMBER_OF_OBJECTS_YOU_HAVE_) {
Ã,  Ã,  Ã,  Ã,  int widthÃ,  = GetGameParameter(GP_SPRITEWIDTH, GetObjectGraphic(i), 0, 0);
Ã,  Ã,  Ã,  Ã,  int height = GetGameParameter(GP_SPRITEHEIGHT, GetObjectGraphic(i), 0, 0);
Ã,  Ã,  Ã,  Ã,  correct=correct*(GetHotspotAt(GetObjectX(i)+width/2, GetObjectY(i)-height/2)==i);
Ã,  Ã,  Ã,  Ã,  //Display("object number %d (correct=%d)", i, correct); //debug
Ã,  Ã,  Ã,  Ã,  i++;
Ã,  Ã,  Ã,  }
Ã,  Ã, 
Ã,  Ã,  Ã,  if (correct == 1) {
Ã,  Ã,  Ã,  Ã,  on_puzzle_solved(); //call an event function
Ã,  Ã,  Ã,  }
Ã,  Ã, 
Ã,  Ã,  }
Ã,  }
Ã,  Ã, 

Ã,  if (ob != -1) {
Ã,  Ã,  int widthÃ,  = GetGameParameter(GP_SPRITEWIDTH, GetObjectGraphic(ob), 0, 0);
Ã,  Ã,  int height = GetGameParameter(GP_SPRITEHEIGHT, GetObjectGraphic(ob), 0, 0);
Ã,  Ã,  SetObjectBaseline(ob, game.room_height);
Ã,  Ã,  SetObjectPosition(ob, mouse.x-width/2, mouse.y+height/2);
Ã,  }

My conversion to 2.7

#define NUMBER_OF_OBJECTSÃ,  Ã,  Ã,  11


//===================================================
// Function is called when puzzle is solved

function on_puzzle_solved() {
//----------------------------------------------------

Display("Puzzle solved");
}


int button_pressed=0; //problem as ob must be = -1
Object*ob;

int correct=0;

Ã,  // script for Room: Repeatedly execute
Ã, 
if (mouse.IsButtonDown(eMouseLeft)) {
Ã,  Ã,  if (button_pressed==0) {
Ã,  Ã,  Ã,  button_pressed = 1;
Ã,  Ã,  Ã,  ob= Object.GetAtScreenXY(mouse.x, mouse.y);
Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  if (ob!= null) {
Ã,  Ã,  Ã,  Ã,  Ã,  int widthÃ,  = GetGameParameter(GP_SPRITEWIDTH, ob.Graphic, 0, 0);
Ã,  Ã,  Ã,  Ã,  Ã,  int height = GetGameParameter(GP_SPRITEHEIGHT, ob.Graphic, 0, 0);
Ã,  Ã,  Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã, 
Ã,  Ã,  }
Ã,  } else {
Ã,  Ã,  button_pressed=0;
Ã,  Ã,  if (ob!=null) {
Ã,  Ã,  Ã,  ob.Baseline = 0;Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  ob=null;
Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  int i = 1; correct = 1;
Ã,  Ã,  Ã,  while (i < 11) {// Objects in room = 11 although object 0 is not part of the puzzle
Ã,  Ã,  Ã,  Ã,  int widthÃ,  = GetGameParameter(GP_SPRITEWIDTH, ob.Graphic, 0, 0);
Ã,  Ã,  Ã,  Ã,  int height = GetGameParameter(GP_SPRITEHEIGHT, ob.Graphic, 0, 0);
//Ã,  Ã,  Ã,  Ã,  correct=correct*(Hotspot.GetAtScreenXY(ob.X+width/2, ob.Y-height/2)==i);
Ã,  Ã,  Ã,  Ã,  i++;
Ã,  Ã,  Ã,  }
Ã,  Ã, 
Ã,  Ã,  Ã,  if (correct == 1) {
Ã,  Ã,  Ã,  Ã,  on_puzzle_solved();
Ã,  Ã,  Ã,  }
Ã,  Ã, 
Ã,  Ã,  }
Ã,  }
Ã,  Ã, 

Ã,  if (ob != null) {
Ã,  Ã,  int widthÃ,  = GetGameParameter(GP_SPRITEWIDTH, ob.Graphic, 0, 0);
Ã,  Ã,  int height = GetGameParameter(GP_SPRITEHEIGHT, ob.Graphic, 0, 0);
Ã,  Ã,  ob.Baseline = game.room_height;
Ã,  Ã,  ob.SetPosition(mouse.x-width/2, mouse.y+height/2);
Ã,  }

I know it has something to do with the variables but I have no idea how to fix it (no script knowledge at all)
#123
I need some help on a drag puzzle where you have to drag the different pieces of the puzzle into position with the mouse. The only info I could find on this topic was a post by OnlyOneKanobi some time back. The script was done in an older version of AGS and I tried to convert it to 2.71 but cannot seems to get it to work. The code was set up by Scorpiorus and I if I knew how to include the thread I would. The best I can do is thisÃ, 

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=9963.msg121209#msg121209

Thanks
#124
There are just too many different ways in which this can be achieved so in absence of exact details it would be very difficult to resolve.

I would suggest that you post a test file on your website that only contains this problem (portal issue) and supply a link so we can take a look at it and see what we can come up with.
#125
Thanks Ashen!!!

Yup, moving the objects would also have "solved" the problem in the sence that the code would display the right way round but then the first digit would be inserted from left to right (somewhere out in the middle of display) and that was not exactly what I was looking for.

I set up the objects 3_2_1_0 to start with and your latest suggestion solved my problem i.e. digits now behave like a normal calculator (or just about any device with a keypad) as per khrismuc's reply.
Two thumbs up!!

:)
#126
I have no idea how long the sound clip is that you are using but that may also have an effect especially if you want to play it every frame.
Try using a shorter clip or only link the sound to every second frame of the animation if slowing it down doesn't work.

Don't know if it will work but it is worth a try.
#127
Thanks Ashen.
My initial code is very similar but my problem is that I cannot manage to get the digits to shift from right to left as you enter them.  In the example you gave the code is 1234 but will be displayed on the LED as 4321.

How would I go about doing that.
#128
I've been trying to set up an access panel similar to the one in Demo Quest 3 (AGS Terminal) where interaction with the hotspots (that each represents a number on the keypad) will display the same decimal value (in the LED display) as the corresponding key on the keypad. There are ample examples of GUIs being used for this ( Dictator Anna,Scorpiorus,Ashen,Theatrx etc) but I couldn't find anything that pertains specifically to using hotspot interaction to trigger the display (closest was SSH's module).

I want the LED to display the key values as you interact with them starting from left to right i.e the rightmost value will move left every time another digit is entered (suppose I could use a string to make it easier on myself but keypads just don't work like that). The access code must have 4 digits and further to this it must display "Enter Code" before the first digit enetred. If incorrect display "Access Denied" etc. I am using objects to display the value in the LED by using object
  • . SetView(x,x,x) i.e to display a specific frame in a view made up from sprites (0 to 9).

    Anyone ot there that can assist?
#129
Great module but unfortunately it doesn't solve the issue I'm stuck with.
Thanks!
#130
Excellent! It is runs like clockwork now and the hotspots were over the objects so next time I'll remember that!!!
Apart from that it also opened up other alternatives in terms of adding more scope to how I can set up the final puzzle in my game.


Only problem is that I do not understand all the code you used but this is not the time nor the place to get into that. If you have the time drop me a PM to discuss this.
#131
Great!

I have no idea why it does not work with hotspots but I changed it to interact with object and now its working although not exactly the way I wanted. The problem is that this type of puzzle can be solved very easily from memory in terms of how the blocks behave. To make this effective I'll have to add a lot more blocks. The idea is rather to have the blocks reset (if wrong) only once all the blocks have been moved to state 1. That way the player cannot pick up the sequence from just looking at the behaviour of the blocks but should rely on some clue elsewhere in the game (or try all the combinations).

Is it possible to set it up as explained?

I am very grateful for the time that went into this. This is also a great example of how a sequencial memory puzzle can be set up and should be added to the tutorials with explanations as to why variables etc were set up this way.Ã, 

You've been a great help.
:)
#132
Thanks Wretched!
I tried the code as is and only added the door open script. The room saves which tells me that there should not be any capture errors but when I run a test absolutely nothing happens (blocks do not move, door does not move). Its like putting a character in an empty room . I don't get it

The views are all set up in view 4
Block1 is on loop 1
Block 2 on loop 2 etc
Door is on loop 0

Door script
object[0].SetView(4);
object[0].Animate(0,0,eOnce.NoBlock,eForwards);


Any ideas on what I missed
???
#133
This may be a very stupid question but do I define it at the top of the room script where I declared the other variables or do I just substitute it where you had it in the first place (I have no scripting knowledge apart from what I have learned from the manual in the past two weeks). Is it possible to edit it into the code you posted yesterday?
#134
Thanks Wretched.
I tried to understand the code you sent me first so it took me a while to read up the topics in the manual before I used it (makes no sense to just copy it if I do not learn from it) in my game but unfortunately I'm getting all sorts of error messages when I want to save the room so I do not know whether it is going to work yet. Just for the record I'm only working with 4 blocks.

I'll use quotes from your code to better explain the problem areas:

//Init. Put this in first time player enters room

I take it that I use the room interactions button to create this under "first time player enters screen" then Run script


{
Ã,  Ã,  Ã, //Wrong order so reset moved Boxes
Ã,  Ã,  Ã, SequenceIndex=0;
Ã,  Ã,  Ã, for (int b=0;b<BlockNumber;b++)
Ã,  Ã,  Ã, 
I assume that this is all part of the text to explain what follows and that it does not form part of the actual script? If that is the case then int b is not defined anywhere hence error message " Undefined symbol 'b'. Where do I define b?

Thats all for now as I cannot test the script any further to see if anything else pops up.


???
#135
Quote from: SSH on Tue 22/11/2005 21:31:41
Maybe, Elliott, you could link to these threads, rather than just complain about them?

Thanks!
I believe that it was inferred in my post that I did read all the threads FIRST. The latest solutions pertain to a GUI which I cannot use in my case hence I went with Strazer solution in another thread. Even if I use his code as is it does not work which means I'm probably putting the code in the wrong place. I added the rest of the code I used so someone can tell me whether Im on the right track or not.

In future I will include all the threads I consulted up to that point to avoid ending up in the dog box.
#136
I just started using AGS about 2 weeks ago and I have a problem with a sequential puzzle. The idea is to push blocks in a cetain sequence to open a door. I used the script that Strazer suggested in one of the old threads but it did not work. The blocks are animated when you interact with them but have to reset if the sequence is wrong. I created hotspots for each block and set up the code as follows:

In the room script

int door_sequence=0

I then used the interact interface to create "run script" for each of the hotspots as follows:

//sequence hotspot 1

if(door_sequence==0) {door_sequence++;
object[1].SetView(4);
object{1].Animate(1,3,eOnce,eBlock);}
else if (door_sequence==3);
{object[1].SetView;
object[1].Animate(1,3,eOnce,eBackwards);
object[2].SetView(4);
object[2].Animate(2,3,eOnce;eBackwards);
oject[3].SetView(4);
object[3].Animate(3,3,eOnce;eBackwards);
oject[4].SetView(4);
object[4].Animate(4,3,eOnce;eBackwards);}
else door_sequence=0;

I did the same for hotspot 2 and 3 except for the variable test that goes up by 1 everytime

//hotspot 4

if(door_sequence==3) {door_sequence++;
object[0].SetView(4);
object{0].Animate(0,3,eOnce,eBlock);}
else if(door_sequence!=3)
{object[1].SetView;
object[1].Animate(1,3,eOnce,eBackwards);
object[2].SetView(4);
object[2].Animate(2,3,eOnce;eBackwards);
oject[3].SetView(4);
object[3].Animate(3,3,eOnce;eBackwards);
oject[4].SetView(4);
object[4].Animate(4,3,eOnce;eBackwards);}
else door_sequence=0;


I don't know if I am even close or if the script even "lives' in the right place. Any help would be welcomed. I realise that the else if part won't work right because the counter will not reset if it contains the value 1 or 2 (think I can fix that)

SMF spam blocked by CleanTalk