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

#1
Quote from: monkey_05_06 on Wed 05/08/2009 18:26:29
I must admit you actually sparked my interest with this though...do you know specifically what letter you were using that was generating these hexadecimal values? :D

I was using %d
Wow, did I just find a new code to do strange things in ags?  :P

Quote
Anyway glad I got that sorted out for you. And remember, "When in doubt, RTFM!" :=

You're right... I promise I'll study better next time!
#2
whops... ehr... I didn't know this! I just thought a random letter would be ok  :P
I knew it was something very very very stupid... and I was right.
Thanks a lot monkey!  :)
#3
Hi everyone!

I put a little function into a dialog, so that when the player asks something to another character (let's call this character Jim), Jim answers with a number which is different at anytime.
To do so, I put this very little function into the dialog_request:

VariableX = Random(200);
cJim.Say("%p", VariableX);

The problem is: when Jim says this number into the game, the number is always formed by 8 characters (so, with 000 at the beginning) and hexadecimal! For example: 0000001E.  ???

Where is my mistake? How can I avoid this and have displayed just a decimal number with no zeros at the beginning?
Thanks!
#4
ok, now that I understand the use of the option "handle inventory scripts" I managed to solve all the problems: with labels, functions and so on.
Thank you very much Matti!
#5
Quote from: matti on Thu 19/02/2009 18:00:06
Quote from: Clarabella on Thu 19/02/2009 17:52:39
The problem is that, if that option is off, I have problems with other functions ("interact" and "use)...

Why is that? What's the problem.

As CJ states in this thread, the handle-inventory option "means that you want to override the built-in AGS handling of inventory clicks. When it's set to true, you have to manually process the click in the on_mouse_click function instead."

So if you use the normal cursors (interact/look etc.) the option should be turned off. But what is your problem then?

Wow, I totally misunderstood the meaning of this option then... now I see why look function didn't work with that option on.

The problem with "interact" is that I set something like this in the on_mouse_click, if (button == eMouseLeft) :

InventoryItem *i = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);     
if (i != null) {
if (Mouse.Mode == eModeInteract)
{
lStato.Text = String.Format ("Usa %s", i.Name);
}
}

to print actions on a label (don't know if "print" is the right word, sorry, I'm Italian. I mean: things that I make happen clicking on objects, characters, etc., are written on the label)
Well, nothing happens when "handle inventory script" is off. But now you explained me what's the meaning of "handle inventory script" I guess I'm not doing the right thing, because I'm trying to override the AGS handling of inventory (right?)
Ok, I think I have to study the AGS tutorials again, and better than I did :P

Quote
Make sure you use the lightning bolt icon in the panel to tell AGS what should happen when an item is being clicked..

yes, I always pay attention to this  :)
#6
I know it may seem stupid, but I have problems looking at an inventory item. I want the main character to say something when looking on an inv item, and I only manage to make this dialog line start when the option "handle inventory clicks in script" is off. The problem is that, if that option is off, I have problems with other functions ("interact" and "use)...
Is this a common problem? Is there something I don't know about using these functions?
Here's the script i use:

function bLook_OnClick(GUIControl *control, MouseButton button)
{
Mouse.Mode = eModeLookat;
}

and

function iXxx_Look()
{
cYyy.Say("Bla bla bla");
}

Thanks everyone!
#7
Quote from: KhrisMUC on Mon 03/11/2008 20:06:24
First of all, don't put variable declarations in the header. There's tons of threads explaining the dos and donts of global variables.

I'm sorry, I put it there because if I put it in the globalscript.asc the debugger gave me the error "undefined token" (however, you're right, I have to study better...  :P).

Quote
Secondly, you can check the current room using player.Room:
Code: ags
function cJames_Talk() {
  if (player.Room == 1) dJames1.Start();
  if (player.Room == 2) dJames2.Start();
}

(You don't need the {} if only a single command's execution depends on an if-check.)

didn't know this function, wow, great! I'll use this.
Thank you very much!
#8
Hi, I know this is an extremely stupid problem, but I can't manage to solve it.
I want Talk function with a non player character to change when he (or she) is in a different room. To do this I set a "int" variable and make it change when room changes. So, I use this code: in the globalscript.ash I declare:

int BlaBla;

Then, I put the changing of the variable inside the function room_FirstLoad, like this:

function room_FirstLoad()
{
BlaBla = 1;
}

in room 1; BlaBla = 2 in room 2 etc.

And then I use this code in the globalscript.asc

function cJames_Talk()
{
if (BlaBla == 1)
{dJames1.Start();}
if (BlaBla == 2)
{dJames2.Start();}
}

But this doesn't work!  Why? :(
When I make the player and James interact nothing happens.
Where is my mistake?

Thanks everyone for help and patience!

NOTE: I use AGS 3.0
#9
I just found what was wrong with my game!
It was such a silly thing, and i discover it when I noticed that the game only crashed when character tried to move right... I didn't create a third loop for right walk in view 3!
Thanks again to you all for the help, and sorry for my stupidity  ::)
#10
Thanks to you!  :)
#11
Yes, I found this .dmp file in my game directory.
Here it is:

http://www.yourfilelink.com/get.php?fid=460045
#12
Hi! I have this same problem too!
It happens  at the loading of the room: I have a sort of a cutscene, a character animation with a music on the background. During the animation I set the mouse mode to "wait", but when the animation ends, I set it again to the default mode (walkto). Here's the function I wrote:

function room_FirstLoad()
{
Mouse.Mode = eModeWait;
cCharacter.ChangeView(3);
cCharacter.Animate(0, 200, eOnce, eBlock);
cCharacter.Animate(1, 5, eOnce, eBlock);
Mouse.Mode = eModeWalkto;
}

(the music is set as a sound on the first frame of loop 0)

When the mouse returns to eModeWalkto, as soon as I click in one point of the room, the game crashes and the following error message is displayed:

---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x00442D71 ; program pointer is +6, ACI version 3.00.1000, gtags (1,1)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and notify CJ on the Tech forum.

in "GlobalScript.asc", line 68

------------

in my GlobalScript, line 68 I have this:
Character *c = Character.GetAtScreenXY(mouse.x, mouse.y);
(and then there is a list of things happening when clicking on a character, if mouse mode is this, this, or this).

I don't have idea of why it happens! That line never gave me any problem, before I put that cutscene!  ???

Note: I thought it was something related to the music, but it happens also if the music is switched off.

Note2: I use AGS 3.0
#13
Thanks for this suggestion, Khris, I will keep in mind!  ::)
#14
Ok, I tryed with GetAtScreenXY.
Now it gives a new error. At the line whith this code:

"lLabel.Text = String.Format ("Look at %s", o.name);"

AGS gives this bug report:

'name' is not a public member of 'Object'.
Why?  :(

*********

EDIT:
Ok, I'm stupid. I forgot the capital letter in o.Name!
Thank you very much for your help! Now it works perfectly!
#15
First of all, thank you both for help!

Quote
Try using this (existing Wink) function instead
Code:

Object.GetAtScreenXY(mouse.x, mouse.y)

I always thought this function could refer only to a particular object (the one located at x, y coordinates). Is it possible to use it in a general way too?
#16
I just tryed, but it gives an error message

"GetAt is not a public member of Object. Are you sure you spell it correctly?"

I tried changing Object.GetAt with object.GetAt (without capital letter), but it gives another error message:

" '[' expected "

Maybe is due to my AGS version? It's 3.0.
#17
I use a sort of "status bar" in my game, a GUI with a label on which all things are happening in the game are written.
In order to write something like "Look at (objectname)" when I look at an object, I wrote this in the room script:

function oObject_Look()
{
lLabel.Text = String.Format("Look at %s", object[0].Name);
}

But it's a very annoying solution, because I have to repeat that line (lLabel.Text etc.) for every object, hotspot and character.
A more simple and faster solution, would be to make a general function, put it in the global script, and call it in the rooms whenever I Look at an object.
But is it possible to "generalize" a line like that? Is it possible to substitute object[0].Name with something general, something that doesn't refer to Object 0, but to every object I'm looking at?
I tried to search in the forum and in the manual, but I couldn't find an explanation, how to do functions related to all objects and not only to a particular object.
So, please, tell me what I have to write, or where I can find a tutorial for these kind of functions.
Thank you!

PS: I know of @OVERHOTSPOT@, but I don't like it because the name of the hotspot disappears when the cursor is not over it. Instead I want the name to be print on the GUI and to stay there until I do another action.
#18
I had some problems and I couldn't read your answers before.
Thank you both for help, I used the first solution and it works perfectly!
#19
I had a visible inventory in my game and I wanted inventory items to be active when you left-click on it. I managed to do this.
Then, I tryed to make an exception: I want my inventory item to be active if I left click it, except if the lookAt cursor is active. If the lookAt cursor is actvive I want the function "inventoryitem_look()" to happen. But I don't know how to make it happen. So, here is my script:

if (button == eMouseLeftInv)
  {
    if (mouse.Mode == eModeLookat)
    { ??? }
   else
   {
    player.ActiveInventory = inventory[ game.inv_activated ];
   }

Is this the right way to do what I want? And if so, what do I have to put instead of the ??? smiley between the two brackets? I want it to be a generic function, so that every inventory item I look at, that function happens.

Thanks!
#20
Yeah, infact it helped. Now it works!
And I also understood how to use that scripts!  :D

Thank you Khris, and thanks everyone for help.
SMF spam blocked by CleanTalk