In the MI-9 style, nothing activates when I do something with an item. This is the script for the items:
function iBook_AnyClick()
{
if (UsedAction(eGA_LookAt)) {
dBook.Start();
}
}
function iSheet_AnyClick()
{
if (UsedAction(eGA_LookAt)) {
cRachel.Say("It's my bedsheet.");
}
if (UsedAction(eGA_UseInv)) {
if (cRachel.ActiveInventory == iPants) {
cRachel.AddInventory(iSPTT);
cRachel.LoseInventory(iSheet);
cRachel.LoseInventory(iPants);
cRachel.Say("I tied my pants and sheet together. It looks like a rope now.");
}
}
}
function iPants_AnyClick()
{
if (UsedAction(eGA_LookAt)) {
cRachel.Say("It's my pants.");
}
if (UsedAction(eGA_UseInv)) {
if (cRachel.ActiveInventory == iSheet) {
cRachel.AddInventory(iSPTT);
cRachel.LoseInventory(iSheet);
cRachel.LoseInventory(iPants);
cRachel.Say("I tied my pants and sheet together. It looks like a rope now.");
}
}
}
And Khris, I did what you said in the last post. It worked temporarily but for some reason now it doesn't want to work...
Did you copy-paste those functions into the script?
Because you need to link them to the event.
AGS isn't going to even look for those functions unless they are entered in the events pane.
Quote from: Khris on Wed 01/01/2014 04:47:18
Did you copy-paste those functions into the script?
Because you need to link them to the event.
AGS isn't going to even look for those functions unless they are entered in the events pane.
Yup, I did. In the events pane it says i(item)_AnyClick for each event.
Weird, works fine for me.
One thing you could do (and should, anyway) is to add
else Unhandled();
at the end, in order to avoid the game doing nothing upon certain actions.
You can also put a Display("Function is called."); at the start of the function to try and isolate the problem.
Quote from: Khris on Wed 01/01/2014 16:23:41
Weird, works fine for me.
One thing you could do (and should, anyway) is to add
else Unhandled();
at the end, in order to avoid the game doing nothing upon certain actions.
You can also put a Display("Function is called."); at the start of the function to try and isolate the problem.
I have tried
else Unhandled();
and I have used it for all of the physical things in the room. Oh one thing I forgot to mention, when using
else Unhandled();
it showed the text from Unhandled, but nothing I put there.
So the function gets called. Are you actually looking at the items? As opposed to pushing or opening them?
And what do you mean by "nothing I put there"? Where? In Unhandled()?
Quote from: Khris on Thu 02/01/2014 01:28:29
So the function gets called. Are you actually looking at the items? As opposed to pushing or opening them?
And what do you mean by "nothing I put there"? Where? In Unhandled()?
I meant to say nothing I put there. And yes, I am looking and doing use with.
Okay so I did the display thing, and yes, it showed up, but not the part where it says "It's my pants." So I think the problem is with:
if (UsedAction(eGA_LookAt)) {
So the AnyClick function gets called, but UsedAction(eGA_LookAt) is false even though you're looking at the item?
What happens if you right-click the pants item? (the default right-click action should be "look at").
Are you getting "It's my pants" for any other action? The template can be tricky when it comes to the order of the verb buttons; maybe something got mixed up and the "look at" button isn't mapped to the "look at" action.
I'm not getting any actions while doing anything to the pants. Also the right click doesn't work.
At this point you should probably zip the entire folder and upload it somewhere so we can take a look.
I edited some lines in the GlobalScript.asc and the guiscript.asc so I think that it is a problem with one of those. I am putting the information on pastebin, too many characters to put on here:
GlobalScript.asc: http://pastebin.com/mHuEezB7
guiscript.asc: http://pastebin.com/AyGRgiMT
(I'm fairly certain it is a problem with the GlobalScript)
Without the actual source files, you're on your own, sorry.
Alright, I'm going to try grabbing the unedited files and replacing the edited ones.
Alright, I'm uploading the source zip files: Here you go:
https://www.mediafire.com/?968ql88k2l683nc
(By the way it is very much a wip me experimenting with stuff. The art is awful XD)
Don't worry :)
The file is broken though. It's 1.3MB, is that correct?
Yes, hold on lemme try it again.
Here: https://www.mediafire.com/?968ql88k2l683nc
Found the error: for inventory items, the template actually relies on different event handlers.
In other words, even though you're looking at the pants, the game's action isn't set to eGA_LookAt because you're supposed to use a separate function and don't need to check UsedAction(eGA_LookAt).
If you clear AnyClick from the "look at item" field, then click the ...-button, you'll get iPants_Look, then just do this:
function iPants_Look()
{
cRachel.Say("It's my pants.");
}
Edit: I thought I remembered this: http://www.adventuregamestudio.co.uk/forums/index.php?topic=49759.msg636477030#msg636477030
In there I actually mentioned you have to use the dedicated look at event. I also posted the quote from the manual though, which wrongly states to use otherclick for all verbs.
Oh yah, for that I took your Otherclick advice, except named it anyclick. Tha ks so much! I'll test this out in a few seconds.
Yay! It worked :D Thanks so much Khris!