Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: cjhrules on Fri 07/04/2006 02:51:19

Title: Code that worked in 2.70 doesn't work in 2.71 (SOLVED)
Post by: cjhrules on Fri 07/04/2006 02:51:19

function character6_a() {
  // script for character1: Look at character

DisplaySpeech (EGO, "xxxxxxxxxxxxxxx");
DisplaySpeech (EGO, "xxxxxxxxxxxxxxxx");
SetCharacterView (EGO, 45);
Wait (20);
ReleaseCharacterView (EGO);


When I choose look at nothing happens. only works with objects and hotspots but not with characters after updating to 2.71.
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: Gilbert on Fri 07/04/2006 03:21:24
Odd, did you turn on the "Enforce object-based scripting" option accidentally ? (though I think in that case the script may not even compile)

Also, check that if that "run-script" action is still in the appropiate interaction (look at that character) of the interaction editor (you didn't just copy function codes directly into the script right?), if not try create another "run-script" action and cut that portion there in the newly created function.
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: cjhrules on Fri 07/04/2006 08:59:14
This is insane. I can't  interact with any character in anyway since I started on the AGS 2.71.
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: Gilbert on Fri 07/04/2006 09:05:40
Did you check the interaction editor for the characters?
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: cjhrules on Fri 07/04/2006 09:11:43
yep, I can add whatever I want to whatever I want. My maincharacter still wont preform the action. This is really strange.
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: SSH on Fri 07/04/2006 09:22:05
Doe the character have the "clickable" box checked?
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: cjhrules on Fri 07/04/2006 09:23:21
Yeah but it behaves just like if it hasn't. Exept you can see the characters name when holding the mouse over them.

Edit:

Can I have done something wrong when I updated the foa template myself?! This is really really bad....
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: Peder 🚀 on Fri 07/04/2006 09:42:32
I not sure about this, but try putting this instead of the code you wrote here.


cEGO.Say("xxxxxxxxxx");Ã, 
cEGO.Say("xxxxxxxxxxxxx");
cEGO.LockView(45);
Wait(20);
cEGO.UnlockView();


hope this helped.
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: Gilbert on Fri 07/04/2006 09:45:12
Though the original should work if he didn't checked the "Enforce object-based scripting" option.

Also, please check whether the character's name is indeed EGO, in case they might got changed during the upgrade.
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: cjhrules on Fri 07/04/2006 09:48:18
sorry, but it didn't work. Not even the "pre-defined" scripts works. I simply can't get EGO to interact with other characters. Is there anyone I can send the script to that knows AGS well and have time to fix this?

Note: the name of the char is EGO and I can interact with everything but characters.
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: Gilbert on Fri 07/04/2006 10:01:02
If your game is not very large you can zip your game and upload it for us to examine, for your problem I think only the following files are enough for verifying (room files not needed):

ac2game.dta
editor.dat
acsprset.spr
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: cjhrules on Fri 07/04/2006 10:10:45
THX!  :)
download here http://www.indylc2.com/error.rar
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: Peder 🚀 on Fri 07/04/2006 10:39:34
Ok, I downloaded, tested it, and I dunno whats wrong.
Though, I thought I could just test to add an object to see if that worked, and it did.
You can do actions on objects and items, but appearantly not characters.......

I guess you probably allready knew?

anyway, I still looking on it.... Ill let you know if I find something unless Gilbot V7000a finds the problem...
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: cjhrules on Fri 07/04/2006 10:52:36
Ok, great to hear. I can't redo everything in AGS 2.7 again because I have already done the intro and a part of the demo in this version. I have also imported most of the characters already, so I really hope someone can get this working.
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: Gilbert on Fri 07/04/2006 11:47:14
It's a scripting problem, and because of the nest of functions it took me ages to trace the problem.

Just look in the global script the function GoToCharacter() (search for GoToCharacter( ), there's a line that reads (last line of function):
WalkToCharacterEx(GetPlayerCharacter(),charid,direction,defaultxoffset,defaultyoffset,NPCfacesplayer,blocking);

Change it to the following and try again:
return WalkToCharacterEx(GetPlayerCharacter(),charid,direction,defaultxoffset,defaultyoffset,NPCfacesplayer,blocking);
Title: Re: Why doesnt this code work in 2.71 when it worked in 2.70?
Post by: cjhrules on Fri 07/04/2006 12:21:29
YEAHH! It's working. Thx m8! I owe you one ;)


Carl-Johan