Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: TerranRich on Fri 04/07/2003 04:26:12

Title: To SSH, Scorporius, and all AGS scripting "experts"...
Post by: TerranRich on Fri 04/07/2003 04:26:12
i am thinking about putting up a site with snippets of all the code you guys have posted as of late. But what I would like is for you guys to try to find as many as you can, and maybe put comments to explain everything. Even *I* get lost trying to read teh code. :P

Do you guys think this would be a good idea?
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: Ben on Fri 04/07/2003 04:29:51
I think that would be a great idea. Right now there's not official location where we can share complicated scripts and quickly look them up for reference. I think lots of people, including myself, would find that useful.
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: SSH on Fri 04/07/2003 14:00:06
Fame and Glory at last! My plan to be nominated for Best Newbie of 2003 at next year's AGS awards is coming through.. bwuhahahahah!

*ahem*

Great idea. I was thinking of suggesting something similar, but isn't that what Erica's Beginner's Help thread is for? I suppose the title is maybe a bit misleading: but I think she has plans to put that stuff all on a site anyway, so maybe it would be best to leverage some synergy* there.

EDIT: For any of you guys who actually work in software engineering, you may be familiar with the idea of "Software Patterns" as discussed in books by Coplien and Appleton. To take the latter's summary:

A pattern is a named nugget of insight that conveys the essence of a proven solution to a recurring problem within a certain context amidst competing concerns

So for each pattern, we list:

Pattern Name: for easy ID and reference
Problem: to tell us what it solves
Motivation: Initial example of problem
Context: Other situations in which problem occur and to which solution can be applied
Solution: Details required to solve problem
Considerations: caveats, alternative solutions, alternative applications



* Sorry, have been doing too much corporate jargon stuff at work recently
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: danny* on Fri 04/07/2003 14:31:36
Great idea Terran!!!
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: Scorpiorus on Fri 04/07/2003 17:37:20
Yep, nice idea. There were some talkies about already. I wanted to public some script stuff but stuck at idea of building a site with all the code posted at (just haven't enough spare time). Rich, it's great that you want to put up one. However I have a couple of questions... How do you suppose to post a code? Will it be a raw text? Or in the form of an AGS template? The reason I ask it's because people might want to try out the code before deciding to go (or not) with one. Most of the scripts are not just a program text but also there are GUIs, characters and other stuff involved in. Publishing a plain text is possible but then it needs a full description etc and people still have to get it to work in their game (even if they want just to look at what it does). Some time ago there was a thread about implementing a library system into AGS. The idea is that you include an external library into your being build project (scripts, GUIs) with a couple of clicks than import them all separately. Were such a system built in AGS it would solve the problem I described. Looking at the recent suggestions about the future AGS innovations I've noticed that people want to see a higher resolutions and color depth with the alpha blending and stuff. Of course that's reasonable since the technology is get improved all the time but still I think we should care of structurization of our projects, of thier flexibility and of having the easy ways to update the things. For example, with about 5000 lines of code in the global script it becomes too difficult to manipulate the whole code whereas having several files per script would make things easy to control. I know Chris made a decision for 2.5* between the library implementation and the support of plugins as there is amount of work to realize the library thingy. Well, plugins won (and that's great btw ;D) but I hope we'll see the other one as well in the future.
Sorry for leading this thread to the suggestionish one but I just thought it would make the sharing of code to be convenient and quite friendly deal.

I like what SuperScottishHero offered. Btw, there is a base we have working similar way. Also I remember there was a site based on the same approach: problem - solution.

QuoteI was thinking of suggesting something similar, but isn't that what Erica's Beginner's Help thread is for? I suppose the title is maybe a bit misleading: but I think she has plans to put that stuff all on a site anyway, so maybe it would be best to leverage some synergy* there.
Yeah, I too think we should collaborate on this. Having one defined place with all such stuff collected in would make the search process much more easier.

In conclusion, I'll be glad to share any AGS script code I have (well I just have looked through and found that it'll take some time to sort it out, make comments, etc). So as soon as I have time I'll put it in order and then send it to publish.


Cheers,
Scorp
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: TerranRich on Sat 05/07/2003 03:43:32
Awesome. Well, SSH, Erica's thread is for beginners. What I'm suggesting is a somewhat more advanced collection of code, sort of like www.vbcode.com where everything is grouped into categories of function. I like your organizational idea, SSH.

I am planning on going through many of the Tech and BegTech threads to see if anyone (not just you two!) posted any useful code. Not simple things like how to increment a GlobalInt, but things like RickJ's random walk-behind NPC solution and whatever else I can find. I'll have time tomorrow after work (6PM EST, 11PM GMT [?] ) to search through a lot of the threads for code snippets.

I understand your concern over organization and implementation, Scorpiorus (just realized I've been misspelling your name this entire time! :P), but I beleive we've been doing fine so far, what with people posting their code in their replies and others just using it. There would be guidelines, of course, like color coding for what is NOT code, for example headers to tell the user what location the code will go in, etc. I believe this could work.

So, to ANYone out there, if you have any useful code...I'm even taking custom functions that are useful alone, like a few that I have (DisplayThoughts(), WaitSec(), FaceDir(), WasInRoom(), GetRandomLetter()), as well as ideas and concepts, like my GlobalFlags extension of the GlobalInts system...please, by all means, email them to me, at TerranRich@Harbinger-Software.com.

Thanks! ;D
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: Scorpiorus on Sat 05/07/2003 23:06:57
QuoteWell, SSH, Erica's thread is for beginners.
But still there is many advanced stuff collected. You could start the searches from there, Rich. The only pity is that some threads are messed. I mean there is no string terminators here and there so the whole post looks like one big line. :P

Quotebut I beleive we've been doing fine so far, what with people posting their code in their replies and others just using it. There would be guidelines, of course, like color coding for what is NOT code, for example headers to tell the user what location the code will go in, etc. I believe this could work.
That should work. What I was worry about if the script involes some GUI elements for example, and the last ones have to be constructed in a particular way: ok-button (obj 0), listbox(obj 1), etc... This is important since in order to get the script to work one have to know how that GUI is organized. I think a template would be useful here (or at least a .gui file for importing).

-Cheers
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: Dorcan on Sun 06/07/2003 00:49:50
I had a similar idea, and scripted some php stuff with a membership system :
http://membres.lycos.fr/digitalmindstudio/script.php (http://membres.lycos.fr/digitalmindstudio/script.php)

There are some useful tutorials I think. ::)

Oh and it support two different languages.
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: Erica McLane on Mon 07/07/2003 12:04:25
I had the idea to collect everything and put it on a PHP enabled site. But I see that Dorcan has made it so I think we should use it.
Somebody has to read the topics and build one clean text from them. And I think we should have categories in this page - "For beginners" and "For advanced users".

What do you think?
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: TerranRich on Mon 07/07/2003 13:43:24
Oh. So it's already been done. Can I still do my own anyway? ;)
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: Dorcan on Mon 07/07/2003 13:55:46
Mmh all my tutorials are translated, and my website is almost entirely in both french & english. Well ok lol I have a bad level in english but anyway, you can change the language by clicking on "english", and it's supposed to stay in english all the time, even if your browser doesn't support cookies  :-\
Edit : Oh my mistake. Now it should work. You can have every pages in english.


PHP is easy. If you are good at scripting in AGS, there will be almost no problem to learn PHP.
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: TerranRich on Mon 07/07/2003 14:01:11
Yeah, sorry, after I more fully explored your site,  I edited my post. :P

Do you know of any good PHP tutorials then? :)
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: Dorcan on Mon 07/07/2003 14:38:44
Yay of course !  ;D

Official PHP website :
http://www.php.net (http://www.php.net)
Very useful when you just want an explanation for any functions.

http://www.phpfreaks.com/tutorial_index.php (http://www.phpfreaks.com/tutorial_index.php)
Very goods tutorials for PHP and MySQL.

Personnaly, I don't like MySQL (it's a database, and it use a different language than PHP yuk!  :P) I create my own code for the membership for ex.
Anyway, I can give you some tips to start over with PHP if you want 8)

QuoteOh. So it's already been done. Can I still do my own anyway?  
No, I forbid it to you!  No competition, please :P
You can have your own tutorials, I can have my own, and we can just make a link to each other in our website


QuoteAnd I think we should have categories in this page - "For beginners" and "For advanced users".
Yep, good idea ! I'll see what I can do.

I added the ability to members to add their own tutorials in my website, in their own language. I would translate them in french later.
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: TerranRich on Mon 07/07/2003 15:50:20
Hmm, there's a lot to go thru, even in just the Tech forum, as for code snippets and solutions, etc.

I have one tut so far in mind, that of a custom inventory, like explaining the basics and what's needed, etc.
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: juncmodule on Mon 07/07/2003 18:32:02
I've never used this but I knew that RickJ made it:

http://art-heart-soul.com/blusoft/Projects/ModuleTester/moduletester.html (http://art-heart-soul.com/blusoft/Projects/ModuleTester/moduletester.html)

later,
-junc
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: RickJ on Tue 08/07/2003 00:31:28
A number of people have created tutorials with the intent of educating the great "unwashed" masses (i.e. beginner, novice programmes).   The problems is that these tutorials are widely scatered on the net, are not consistent in structure and format, and are not cordinated between authors.  

I have been doing some work with DocBook, an industry standard, XMLish  documentation tool.  There are zillions of systems freely available under Linux, but  in Windows such things are $$costly.   Stefan Priebsch, in Germany, has released eDE, an open source, DOS/command line  based  system for which I have created an AGS GUI fron end (it need somne more work but is basically functional).   The advantage of DocBook is that the same source can be published in any number of formats, index and table of contents are automatically generated, and individual tutorials can easily be combined into larger collections.

Jimi and I wrote an example tutorial explaining how to create an empty game template, using DocBook.  This was to be the first in a series of tutorials.  This example is published in HTML, PDF and CHM (windows help file), each file can be access from the links below.  There is also an HTML Chunk format where each section of the document is on a seperate page and the user clicks on NEXT, PREV, TOP, buttons to navigate the document.

eDE Forum
http://www.e-novative-forum.com/index.php (http://www.e-novative-forum.com/index.php)

Example Tutorial Source
http://www.icehouse.net/rickj/ags/tutorial/mingt.xml (http://www.icehouse.net/rickj/ags/tutorial/mingt.xml)

Example Tutorial Output
http://www.icehouse.net/rickj/ags/tutorial/index.html (http://www.icehouse.net/rickj/ags/tutorial/index.html)
http://www.icehouse.net/rickj/ags/tutorial/mingt.pdf (http://www.icehouse.net/rickj/ags/tutorial/mingt.pdf)
http://www.icehouse.net/rickj/ags/tutorial/mingt.chm (http://www.icehouse.net/rickj/ags/tutorial/mingt.chm)

The Module Tester  Junc is referring to provides an easy and generic means of  testing of script code modules.   The idea was to package each chunk of script into a module, where a module is equivalent to a room.   If someone had the Module Tester downloaded already they could then just download the room file use the module tester to open and run it.    This was all done before the "game template" mechanism was created so there is room for a discussion as to whether a module should be a complete game template, a room, or possibly both.  

Dorcan has done a great job with his website, but I think this solves only one part of the problem.  I wonder if the AGS website should contain Dorcan's tutorial page or something like it.  That would kind  of solve the centralization issue.   Also if some moderators and reviewers could be recruited then I think the content could be encouraged to be in an agreed upon structure and format and some consistency achieved between authors.  There also could be a list of requested tutorials, so that if someone got an urge to do something useful they could go there for ideas.  

Dorcan, also makes a great point about the need to support multi-language.  Again, DocBook's ability to generate TOC and multiple formats could be helpful in this respect, by eliminating the burden of document formatting etc from the author/translator.

Here are my thoughts as to what should be included in a tutorial/script module.In any case, I think we can accomplish more by coordinating our efforts in this matter.  I look forward to hearing your comments in this thread and to perhaps forming a consenus.


*** Edit****
SSH's list should be merged with the above, probably should be the basis for the tutorial ...
Quote
Pattern Name: for easy ID and reference
Problem: to tell us what it solves
Motivation: Initial example of problem
Context: Other situations in which problem occur and to which solution can be applied
Solution: Details required to solve problem
Considerations: caveats, alternative solutions, alternative applications
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: OneThinkingGal and ._. on Tue 08/07/2003 00:59:15
What about the knowledge base?

http://www.agsforums.com/kblist.php

Its searchable. :P And I think chris enters stuff in it. ._.
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: RickJ on Tue 08/07/2003 01:32:39
Doesn't the knowledge base contain short question/answer type things rather than large script examples, tutorials, and reuseable modules?
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: Gilbert on Tue 08/07/2003 05:14:16
Actually Mattgoble made a site with lots of goodies in it, only that it wasn't updated for some time:

http://www.mattgoble.com/interaction/ags/ (http://www.mattgoble.com/interaction/ags/)
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: SSH on Tue 08/07/2003 17:15:41
OK, it seems that the world and his brother has already tried to do this. Personally, I would like one good entry point  or database, as it is a pain to keep searching around 101 web sites to find the answer to your question. However, creating a site for this will just add another site to the list of collections, unless it is actually hosted on the main AGS page,. I think.

One problem with the exisitng knowledge base is that it is more difficult for people to add to it (you need the admin password). Also, it is quite hard to find. It might be better to have a link to it in the banner on the homepage, rather than trying to find it by luck or memory or by searching eveyr page on the site!

What do you folks think?
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: TerranRich on Wed 09/07/2003 01:44:36
Whew. The more and more similar examples I see, the less enthusiastic I become over making an online code snippet repository.  :o
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: Scummbuddy on Wed 09/07/2003 01:51:49
No, no.  It's still a great idea.  Using RickJ's Module Tester as a basis, we could make a searchable or just a beautiful code database.
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: TerranRich on Wed 09/07/2003 03:37:58
Yeah but the problem is, I don't really understand it. It's all Greek to me. I was originally just going to do everything in HTML and not make it too complicated.
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: Scorpiorus on Wed 09/07/2003 19:53:47
Guys, do you mean Rick's docbook? :P I think it would be great to format all the tutorials this way.

Also it would be nice to implement the search engine as well... Having all the code at the one site becomes pretty necessary then.

-Cheers
Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: RickJ on Thu 10/07/2003 04:48:58
If an "open source" or "tutorial" or "game template" category was added to the AGS games page or a similar mechanism then everything wouldn't need to be hosted in the same place.  

Also if there were some common guidelines as to structure and content of the tutorial and examples then  there would be some degree of consistency betwen authors.  Currently there are a lot of variations only because there wasn't a suggested example to follow.  Now what I am suggesting are some minimal requirements such as everyone providing the source code in a common format (be it templates, txt files, or whatever), a runnning example, and a document describing what the code does, how it does it, and how it can be applied.  

Here is a brief explanation of how DocBook works.  Hope this helps weveryone's understanding.
QuoteDocBook is just a document "compiler" that takes a source xml file and creates an output file in one of a number of formats, including HTML, PDF, CHM, and others.  The look of the output is controlled by other xml files similar to html style sheets.   So if one wanted to chage the look and feel they would just change the style sheets and re-compile everything.


Title: Re:To SSH, Scorporius, and all AGS scripting "experts"...
Post by: SSH on Thu 10/07/2003 13:04:23
Another possibility, similar to DocBook, is to use the POD (Plain Old Documentation) that perl and some GNU projects use. There are converters to HTML, postscript, UNIX man pages, etc. already knocking about for free and you put the stuff as comments in your code so that is can be seen there, or in a reference manual if you run ti through one of the filters.