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 - cinos

#1
If you still have your room script just save it another location then reload the latest version of ags. Then just put the room you have saved back into the correct folder. Just a thought!
#2
Thanks Khris I will try this out. I have modified the post above with the code I am trying to get to work. The problem is allowing time for the player to click on the heartstone. By the way is it possible for the player to actually click on the heart stone as it moves like a target?
#3
I am new to coding. Thank you for your assistance dkh & ssh. If you look at my other post you will see that the heart stone1 only appears when a certain sequence of events happens. Sorry about how I write the scripts and I am taking your advice about the set out. I have removed the wait lines from the script but I still am unable to put the heart stone in the inventory. Is there such a command as If cursor over object?
#4
An object moves across the screen with eBlock to a location. It then animates with eNoBlock. When I click on the object nothing happens when it should add an inventory item then disappear. I have tried the codes below but they do otherthings to the heartstone. I thought this would be simple!!
//I have put this in the global script.
function repeatedly_execute_always ( )
{
Ã, 
Ã,  if (IsTimerExpired(1)==1)
Ã,  Ã,  Ã, oHeartstone1.Visible=false;
}

//Room script
if((answer.AsInt == Product)&&(Thrown==1))
{
Ã,  object[Thrown].Visible = false;
Ã,  GiveScore(5);
Ã,  PlaySound(3);
Ã,  object[0].Animate(1,6,eOnce,eNoBlock);
//The skeleton (object[0]) burns and the HEARTSTONE1 appears and moves
//across the screen. I want the player to click it before it disappears to place in the inventory.
Ã,  oHeartstone1.Visible=true;
Ã,  oHeartstone1.SetView(5);
Ã,  oHeartstone1.Animate(0, 1, eRepeat, eNoBlock, eForwards);
Ã,  oHeartstone1.Move(150, 200, 1, eBlock, eAnywhere);

//The oHeartstone1 stops here and allows the player to click it and an inventory item is added and the oheartstone1 disappears.NOT HAPPENING!! I think the script runs too fast.

Ã,  oHeartstone1.Animate(0, 1,eOnce, eNoBlock, eForwards);
Ã,  oHeartstone1.Animate(0, 1,eOnce, eNoBlock, eBackwards);
Ã,  oHeartstone1.Animate(0, 1,eOnce, eNoBlock, eForwards);
Ã,  SetTimer(1, 100);//if the player has not clicked the oHeartstone1 it will disappear when the timer runs out.
Ã,  //Maybe the script is running too fast to register the click?
Ã,  object[0].Visible=false;
Ã,  object[0].SetPosition(337, 269);
Ã,  PlaySound(1);
Ã,  PlaySound(4);
Ã,  object[0].Visible = true;
Ã,  object[0].SetView(3);
Ã,  object[0].Animate(2,6,eOnce,eBlock);
Ã,  object[0].Animate(0,6,eOnce,eNoBlock);
Ã,  object[0].Move(280,266,1,eNoBlock,eWalkableAreas);
Ã,  }
sectionstart object12_bÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function object12_b() {
Ã,  // script for Object 12 (HEARTSTONE1): Any click on object
player.AddInventory(iheartstone1);Ã, 
}
#sectionend object12_bÃ,  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart object12_cÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function object12_c() {
Ã,  // script for Object 12 (HEARTSTONE1): Any click on object
oHeartstone1.Visible=false;Ã, 
}
#5
I thought this might be the case but being a newbie was not sure. I have added a repeatable_execute_always() but this deletes the heartstone1 altogether and does not place it in the inventory. Check the script above. Also how do I make the mouse click return a yes over a moving object? (I hope this makes sense!)
#6
An object I have got moving across the screen is not responding to a mouse click. The mouse cursor is a watch when it is moving. I want the object, when clicked to place an item in the inventory. Any ideas.

function on_call(int value){
Ã,  if(value == 1) {
Ã,  String answer = txtUserInput.Text;
Ã,  gTableanswer.Visible = false;
Ã, 
Ã,  // This is the code to check it the heartstone is activated!(Thrown 1 is the object that
// calls the Heartstone)
Ã,  if((answer.AsInt == Product)&&(Thrown==1)){
Ã,  object[Thrown].Visible = false;
Ã,  GiveScore(5);
Ã,  PlaySound(3);
Ã,  object[0].Animate(1,6,eOnce,eNoBlock);//The skeleton burns and the HEARTSTONE1 appears and moves
//across the screen. I want the player to click it before it disappears to place in the inventory.
//I have set the oject interaction to on any click. When the script runs there is a watch on the screen
//and the object does not respond to the mouse.
Ã,  Wait(40);
Ã,  oHeartstone1.Visible=true;oHeartstone1.Move(150, 200, 2, eNoBlock, eAnywhere);oHeartstone1.SetView(5);
Ã,  oHeartstone1.Animate(0, 1, eRepeat, eNoBlock, eForwards);
Ã,  object[0].Visible=false;
Ã,  object[0].SetPosition(337, 269);
Ã,  PlaySound(1);
Ã,  Wait(200);
Ã,  oHeartstone1.Visible=false;
Ã,  PlaySound(4);
Ã,  object[0].Visible = true;
Ã,  object[0].SetView(3);
Ã,  object[0].Animate(2,6,eOnce,eBlock);
Ã,  object[0].Animate(0,6,eOnce,eNoBlock);
Ã,  object[0].Move(280,266,1,eBlock,eWalkableAreas);

I now have this code and have placed it in the room script at the top before any regions.
function repeatedly_execute_always(){if (Mouse.IsButtonDown(eMouseLeft)&&Ã, 
Ã,  Ã,  (oHeartstone1.Visible)==1)
Ã,  Ã,  player.AddInventory(inventory[3]);
Ã,  Ã,  oHeartstone1.Visible=false;}
Ã,  }

Problem is now the heartstone1 does not appear at all and does not go into inventory! I use the wait command to time the appearance of objects with other animations.Ã,  I think this should remove the heartstone1 (If it worked!) but how do you code get it to actually be over the moving object like, if mouse down over object heart tone1 then......???
#7
Is the option gone or just greyed out?  If it is greyout maybe the computer is not copying properly. Just save your drawing and import it as a file into the sprite editor.
cinos
#8
I have tried the code and it does what I want. However the object[1]rock that is 2x4 is actually a graphic with 2x4 on it. I will keep working on it. I thought of putting it as a function but I will try to get it working first. Thanks heaps. I am sure this is the start of lots of work but I am really enjoying all the thinking and the support I am getting through the forum. Thanks for your time and effort.

EDIT:
Ashen it is working fine  but the input box looks a bit yuck! How can I script a custom gui that does the same thing but I can jazz up! As the player will have to solve quite a few times tables a function may be the way to go. I am now researching ags manual to look up how to make a score system. Thanks again.
#9
Thanks for the tip Ashen. Here is a brief synopsis of what I am trying to do, the problem I am having, and the code for it.

Ego walks onto region1_a. A sound is played. An object[0] (a skeleton)appears and then object [1] (a rock)appears. This rock has a maths sum on it (2x4). The skelton throws rock towards Ego. The rock stops about half way.
A text box appears. If the player enters 8 via the keyboard than the rock disappears.(Will add to score but have not scripted yet.) the skeleton disappears and a new one appears and throws object[2].
If the player enters another number, say 12, the rock then continues and hits Ego (ArethingsOverlapping) disappears, (Subtracts from score) and a new skelton appears. This process continues for all the 2 x tables.(etc)
The problem I am having is that the object does not stop but continues through to Ego. When the text box appears I can not enter numbers into it. I then get this error   after the rock hits Ego.  post_script_cleanup call stack exceeded:possible recursive function call? running region1_b.
It is almost like I have to stop the script and wait for a key press but when I try this WaitKey() the script runs striaght through.   I REALLY NEED ASSISTANCE

#sectionstart region1_a  // DO NOT EDIT OR REMOVE THIS LINE
function region1_a() {
  // script for Region 1: Player walks onto region


mouse.DisableMode(eModeWalkto); 

PlaySound(1);
Wait(80);
object[0].Visible = true;
cEgo.FaceObject(object[0]);
object[0].SetView(3);
object[0].Animate(2,6,eOnce,eBlock);
object[0].Animate(0,6,eOnce,eNoBlock);
object[0].Move(280,266,1,eBlock,eWalkableAreas);

//2x4object1shield
object[1].Visible=true;PlaySound(2);
object[1].SetView(4);
object[1].Animate(0,1,eRepeat,eNoBlock);
object[1].Move(150, 266, 2,eBlock,eWalkableAreas);object[1].StopAnimating();}


#sectionend region1_a  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart region1_b  // DO NOT EDIT OR REMOVE THIS LINE
function region1_b() {
// script for Region 1: While player stands on region

//2x4objshied(rock)
//Set up GUI (gTable_answer)and positions it. Enables the text box (txtUserInput) for player to  type into.
gTable_answer.SetPosition(224,90);gTable_answer.Visible=true;gTable_answer.Clickable=true;
txtUserInput.Enabled=true;
//Check to see if the user has typed the number 8 into the text box and if it is true than object [1] is removed.
// and object[2]is placed on the screen.
//If the player types another number(eg 9) than object [1] moves towards the character and hits (overlapps) him then disappears.
//puts object 2 onto the screen.


if  ((object[1].Visible)&&(txtUserInput.Text.AsInt == 8 )) {
  object[1].Visible = false;PlaySound(3);object[0].Animate(1,6,eOnce,eBlock);Wait(40);object[0].Visible=false;object[0].SetPosition(337, 269);
PlaySound(1);Wait(60);object[0].Visible = true; object[0].Animate(2,6,eOnce,eBlock);object[0].Animate(0,6,eOnce,eNoBlock);
object[0].Move(280,266,1,eBlock,eWalkableAreas);txtUserInput.Text=("");Wait(40);

}
else if (object[1].Moving == false) {
  object[1].Move(50, 266, 2,eBlock,eWalkableAreas);
}

if (AreThingsOverlapping(1001, EGO)) {object[1].Visible = false;object[2].Visible = true;
object[0].Animate(0,6,eOnce,eNoBlock);object[2].SetView(4);object[2].Animate(1, 1,eRepeat,eNoBlock);
object[2].Move(150, 266, 2,eBlock,eWalkableAreas);object[2].StopAnimating();txtUserInput.Text=("");}
#10
Quote from: Ashen on Mon 02/10/2006 14:07:29
As SSH said, you should be using .Text not .GetText() - just use the code he gave, but replace UserInput with txtUserInput.

As for the manual not showing properly, try this link - it's a known issue, but hopefully the advice in that thread will resolve it.
Thanks for the help SSh and Ashen. The piece of code now works! If you look at my other post you will see that I have an issue so I am trying to work out how to make  an if else statement with the results from the text box using Text.AsInt.

EDIT:
Now the manual is working. Just love learning stuff on line. Now back to the script.
#11
Yep done this and still get the message GetText is not a public member. I have used the f1 key and the contents show but I get a page cannot be displayed when I click on a topic. Here is the code//txtUserInput is the script name of the text box.

txtUserInput.GetText(string buffer);
String input;
txtUserInput.GetText(input);
#12
Tried the code. Get error Undefined symbol 'User' ??? I am using ags version 2.72.652.0 and the manual is 2.7.
#13
I am trying to use the information a user has placed in a text box. I looked at the ags manual and it indicated thatÃ,  Ã,  Ã, UserInput.GetText(input); was the command I should use. When I run the script an error message says 'GetText' is not a public member of 'TextBox' ????????????
#15
 :)Thanks for the help Monkey and Khris. I have taken your advice and chucked the on_key_press idea as this became messy as you suggested. I am now trying text boxes. However I still need some assistance. When I enter '8' the object [1] disappears (as it should) but if I enter another number nothing happens.(I think my 'else ' command or logic is up the creek.) I want object [1]Ã,  to move if the player puts another number other than 8 into the text box . Also as soon as I enter 8 into the text box it deletes the object without me pressing enter! Hope you can help.

ifÃ,  ((object[1].Visible)&&(txtUserInput.Text.AsInt == 8))
Ã,  {object[1].Visible = false;}
else
{object[1].Move(50, 266, 2,eNoBlock,eWalkableAreas);}

SMF spam blocked by CleanTalk