AGS coding tutor

This is a public forum, where you can find out everything you wanted to know about making games. Please don't use this forum as a place to recruit new members.

Moderators: adeyke, VampD3, eriqchang, Angelus3K

Post Reply
Message
Author
AsianMusicGuy
Defense Minister Status
Posts: 614
Joined: Fri May 14, 2004 1:07 am
Location: Fort McMurray, Alberta, Canada
Contact:

AGS coding tutor

#1 Post by AsianMusicGuy » Thu Dec 15, 2005 9:38 pm

Anyone intrested in helping me learn the languge of AGS?

Broomie
The Enigma
Posts: 2601
Joined: Thu Jan 02, 2003 1:00 am
Location: UK

#2 Post by Broomie » Thu Dec 15, 2005 9:53 pm

Yes because you're one post away from a talented AGS coder to teach you everything in just one read.

Look, learning AGS isn't easy like that. Check the AGS tutorials at www.bigbluecup.com and you should learn more from there.

User avatar
Vildern
The Sleepy Specter
Posts: 3547
Joined: Fri Dec 06, 2002 1:21 am

#3 Post by Vildern » Thu Dec 15, 2005 9:54 pm

Anyone intrested in helping me learn the languge of AGS?

I'm sorry. It's an ancient language known only to a few people, known as Elders.

If one wishes to learn the language of the AGS (Ancient Grand Signs), he needs to join a tribe of Elders, and spend almost eternity with them, before he could say simple words, such as: "daddy".


Well, that's another way to say I fear I cannot help you with AGS :p

AsianMusicGuy
Defense Minister Status
Posts: 614
Joined: Fri May 14, 2004 1:07 am
Location: Fort McMurray, Alberta, Canada
Contact:

#4 Post by AsianMusicGuy » Thu Dec 15, 2005 10:14 pm

I didnt say it was easy Broomie I am willing to learn and work hard today I tried a simple command using the manual

Code: Select all

Playmusic(0);
I aready have the music in the music folder as music0.mp3
yet I get a error "error line 2 unexpected 'playmusic' what have i done wrong? :o

Anonymous Game Creator 2
The Prince of Shapeir
Posts: 8887
Joined: Tue May 08, 2001 4:12 am
Location: Phobos
Contact:

#5 Post by Anonymous Game Creator 2 » Thu Dec 15, 2005 10:17 pm

The functions are case-sensitive. Instead of Playmusic(0); it should be PlayMusic(0);

I recommend you take Broomie's advice and start out with simple stuff by looking over posts at the AGS Beginner's Technical forum. The more things you try with AGS, the more you'll remember, and the more proficient you'll become.

Good luck with it!

AsianMusicGuy
Defense Minister Status
Posts: 614
Joined: Fri May 14, 2004 1:07 am
Location: Fort McMurray, Alberta, Canada
Contact:

#6 Post by AsianMusicGuy » Thu Dec 15, 2005 10:20 pm

I still get error line 2 :cry

Erpy
Forum Administrator
Posts: 11434
Joined: Tue Sep 25, 2001 8:28 pm
Location: The Netherlands

#7 Post by Erpy » Thu Dec 15, 2005 11:17 pm

"Line 2" means that the line causing the error is on line 2 of your script. Since AGS already dedicates at least 2 lines for the "header" of each code-section (sections as in: "Exit to the left", "Upon entering before fade-in" etc.), I get the impression you simply put "PlayMusic(0)" at the top of the script and hoped it would work. It won't because AGS doesn't know when to execute it.

Instead of putting code straight into the script, click on the red "I" in the room editor, right-click on the "enter room after fadein"-part and either add a new action (and then select the "play music" part) or create a new "run script" action and type "PlayMusic(0);" into the editor.

You're better off looking up a tutorial on the AGS forums first though, because you need to know what you are doing.

Image

AsianMusicGuy
Defense Minister Status
Posts: 614
Joined: Fri May 14, 2004 1:07 am
Location: Fort McMurray, Alberta, Canada
Contact:

#8 Post by AsianMusicGuy » Fri Dec 16, 2005 2:52 am

Can some show me how to add a score bar

Erpy
Forum Administrator
Posts: 11434
Joined: Tue Sep 25, 2001 8:28 pm
Location: The Netherlands

#9 Post by Erpy » Fri Dec 16, 2005 9:02 am

Well, this is achieved by putting a label with the text "@SCORETEXT@" on the GUI that makes up the status line of your game. (the default game template in AGS has such a thing, I believe it's GUI number 0)

You probably don't want to mess with GUI's too much until you have the basics of AGS coding down.

Image

AsianMusicGuy
Defense Minister Status
Posts: 614
Joined: Fri May 14, 2004 1:07 am
Location: Fort McMurray, Alberta, Canada
Contact:

#10 Post by AsianMusicGuy » Fri Dec 16, 2005 7:07 pm

Thanks Erpy :D

AsianMusicGuy
Defense Minister Status
Posts: 614
Joined: Fri May 14, 2004 1:07 am
Location: Fort McMurray, Alberta, Canada
Contact:

#11 Post by AsianMusicGuy » Fri Dec 16, 2005 9:23 pm

I did what you told me and get a error :eek

Erpy
Forum Administrator
Posts: 11434
Joined: Tue Sep 25, 2001 8:28 pm
Location: The Netherlands

#12 Post by Erpy » Fri Dec 16, 2005 9:34 pm

"Getting an error" is a bit vague. [understatement]AGS is capable of generating quite a few different errors.[/understatement]

Could you be a little more specific on what kind of error you get?

Image

AsianMusicGuy
Defense Minister Status
Posts: 614
Joined: Fri May 14, 2004 1:07 am
Location: Fort McMurray, Alberta, Canada
Contact:

#13 Post by AsianMusicGuy » Fri Dec 16, 2005 9:43 pm

Ok
Error(line 72) PE04 parse error at "@SCORETEXT@"

Klytos
Infamous Sheik of Australia
Posts: 1722
Joined: Tue Apr 22, 2003 3:43 pm
Location: Rockhampton Australia
Contact:

#14 Post by Klytos » Sat Dec 31, 2005 10:42 pm

It sounds like you've put the code into the script, not into the GUI.

Load up AGS and click on the GUI section.

Click on the GUI you wish to edit, in this case STATUSLINE (which is the line across the top of the screen) Designated on my example as 1.

Click on the button I've marked as 4. Thats the Label button, used for adding labels to your GUI.

Drag out a label box on your GUI somewhere. Sierra generally put it on the right side of the statusline for the score. That's number 3 on my example.

Then click on the TEXT box in the popup menu. Number 2. In there you write whatever you want it to say. As Erpy said you can add in @SCORE@ which will then display the score, or @SCORE@ of @TOTALSCORE@ is one that Sierra would have used in some games. It's up to you.

Image

As for your music issue, try renaming the file to have a number not zero. That may be the problem. And as AGD2 said, make sure it's case sensetive (PlayMusic(1);) or whatever. Very important.

If you want to learn how to use AGS, you should try following the tutorials on the AGS site. Another system I've seen work is to grab a room from an old game you know really well, and script it out in AGS. Thats what I did when learning, looking at how to do something and then learning how to do it, usually from reading the manual.

EDIT : Just realised that this post is a couple of weeks old, hope it helps anyway.

AsianMusicGuy
Defense Minister Status
Posts: 614
Joined: Fri May 14, 2004 1:07 am
Location: Fort McMurray, Alberta, Canada
Contact:

#15 Post by AsianMusicGuy » Sat Dec 31, 2005 11:44 pm

Dude you rock!

Klytos
Infamous Sheik of Australia
Posts: 1722
Joined: Tue Apr 22, 2003 3:43 pm
Location: Rockhampton Australia
Contact:

#16 Post by Klytos » Sun Jan 01, 2006 1:16 am

True.

Post Reply