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

#961
Quote
Tried that and your right but i dont see how the problem could be in a room script as they arnt really connected in this case.
Well, you've made progress.  We now know that you were creating the global variable correctly.   The reason AGS is still complaining about "money" is because you have used that reference somewhere else. 

I would search all the scripts for any occurrences of the word "money".   If you find any comment them out for now.  Don't forget to search any module scripts you may have also.

You may not find anything in your scripts.  I have gotten this error a couple of times and yes it's a pain to find,  but just hang in there.   

The next place you are going to have to look is in the other game elements.   Are there any objects, inventory, characters, or any other elements that reference "money:? 

Well be assured that something is referencing it somewhere in your game.   Give it another go and lket us know what else you may find.  ;)
#962
1. Create key inventory item
   - right click inventory in navigation tree
   - select Create new inventory item
   - change name to iKey

2. Create an object in the room and name it oDoor.
   - room edit
   - select object from drop list
   - right click on room background

3. Create a "use inventory on object" event handler function
   - room edit
   - click (lighting bolt icon in properties window
   - click "use inventory on object"
   - clcik "..." button

4.  Edit event handler
   - Add the following code
Code: ags

if (player.HasInventory(iKey)) {
  // Unlock the door animation here
}
#963
Try changing the name to something like MyMoney and see what happens.  I suspect you will still get unresolved import on "money", which would mean the problem lies else where, in another room script or a module perhaps. 
#964
Clearing the error messages out at the beginning of the compilation process would provide a better indication that the compilation process is complete.   This is especially true if the "compilation complete" audio alert is disabled and there are multiple similar errors.
#965
This can be done by maiing custom event handlers similar to the example below.  The repeatedly execute handler is a standard AGS event.  To create this you need to do a "room edit" and click on the lightning bolt icon in the properties panel of the editor.  You can edit your room script and enter the rest 9of the script.

The example is untested so you may have to clear any compile errors etc before you use it but it should give you some idea of what needs to be done. 

The room_RepExec() function will poll to see if a character is on a hotspot or whatever. 
Code: ags

// Custom Hotspot interactions
function NpcHotspotInteraction(Character *chr, Hotspot *ptr) {
        if (ptr==hThisHotspot) {
                // Do "This" stuff
        }
        else if (ptr==hThatHotspot) {
                // Do "That" stuff
        }
        else if (ptr==hTheOtherHotspot) {
                // Do "TheOther" stuff
        }
}

// Custom Inventory Interactions
function NpcInventoryInteraction(Character *chr, InventoryItem *ptr) {
        if (ptr==iThisInventoryItem) {
                // Do "This" stuff
        }
        else if(ptr==iThatInventoryItem) {
                // Do "That" stuff
        }
        else if(ptr==iTheOtherInventoryItem) {
                // Do "TheOther" stuff
        }
}

// Custom Object Interactions
function NpcObjectInteraction(Character *chr, Object *ptr) {
        if (ptr==oThisObject) {
                // Do "This" stuff
        }
        else if(ptr==oThatObject {
                // Do "That" stuff
        }
        else if(ptr==oTheOtherObject) {
                // Do "TheOther" stuff
        }
}

// Custom Region Interactions
function NpcRegionInteraction(Character *chr, Region *ptr) {
        if (ptr==oThisObject) {
                // Do "This" stuff
        }
        else if(ptr==oThatObject {
                // Do "That" stuff
        }
        else if(ptr==oTheOtherObject) {
                // Do "TheOther" stuff
        }
}

//  Custom NPC event handler
function NpcEventHandler(Character *chr) {
        int   x, y;

        // Translate character's room coordinates to screen coordinates
        x = chr.X-GetViewportX();
        y = chr.Y-GetViewportY();
        
        // Call custom  hotspot interaction handler
        if (Hotspot.GetAtScreenXY(x,y)!=null)  {
                NpcHotspotInteraction(Hotspot.GetAtScreenXY(x,y), chr);
        }
        // Call custom  inventory interaction handler
        else if (InventoryItem.GetAtScreenXY(x,y)!=null)  {
                NpcInventoryInteraction(InventoryItem.GetAtScreenXY(x,y), chr);
        }
        else if (Object.GetAtScreenXY(x,y)!=null)  {
                NpcObjectInteraction(Object.GetAtScreenXY(x,y), chr);
        }
        else if Region.GetAtScreenXY(chr.X,chr.y)!=null) {
                NpcRegionInteraction(Region.GetAtScreenXY(chr.X,chr.y), chr);
        }
}

// AGS Standard interaction handler - need to create this with lightning bolt icon
function room_RepExec() {

       NpcEventhandler(cSomeCharacter);
}
#966
- Did you know that you can right click on a variable or function to goto it's definition?
#967
Quote
I don't think any of this is in ANY relation to what it would bring us as AGS users.
Go back and read the initial post.  Abstauber suggested that perhaps some form of encryption of the game files would satisfy the need/desire to maintain some degree of protection against people ripping resources from AGS games.   In the thread he references, that was the main reason  to not  open up runtime so that it would be possible for third parties to port it to other platforms.   What it would bring us AGS users is the potential to deploy our games on platforms other than windows.  Personally, iI suspect there are other, perhaps more complicated,  reasons for not opening up the runtime.

I agree that all this has nothing to do with DRMing (or whatever name you would like to use) of commercial games. 
#968
You may find some of the documentation here helpful, especially the Module Programming Guidelines and  Programming Conventions documents.

The issue of cleaning up the global script by separating out character, gui, and other interactions has been recently discussed in this thread.   The conclusion seemed to be that a good first step to improve the situation is to allow the interactions to be moved to a module which, to the best of my knowledge, is not currently implemented.   Since the current development version is in the "Release Canidate Stage" I wouldn't expect this to happen until the next version.

As far as your suggestion is concerned you can do something similar now by using modules to contain the interaction code.  And then the only thing that needs to be in the global script is the interaction handler and a call to the code in your module. 

In the case of GUI events it's even possible to use the same handler for multiple events.  The GUI handlers are passed a pointer to the control that was clicked and a mouse button ID, so it's possible to pass the same info on to a function in a module which determines what was clicked and what to do about it.   I'm not certain if something similar can be done for characters or not.

Variable scope is fairly uncomplicated.   Variables defined within the scope of a function are dynamic and are valid only for the duration of the function's execution.   Variables defined outside the bounds of a function are static and can be shared between any functions defined within the same script file. 
Variables can be made global using the export and import keywords.  To create a global variable you would make it's declaration in the global script along with an export statement.  You would then put an import statement in the script header which would make it available to any room script.

Hope this helps  :D
#969
The obvious thing that comes to mid is to just make your little ship be the player character.   Draw the walkable areas on the map where the ship can go and just have it walk to where ever the walk (or sail) cursor is clicked.  If you want it to go to a specific spot then each grid can have a walk-to point.
#970
It seems to me the simplest way to do something like this is to have two different output formats, one that is documented and one that is not.  There would then be one version of the runtime for each output format, the only difference being in the algorithm that reads resource info from the game file.    Except for this super secret algorithm both runtimes would be exactly the same.  The open format version runtime could be open sourced without compromising the closed version, which would be as secure (or insecure) as it is now.   

I am also curious about how the runtime porting process might be made easier.
#971
Here are a couple things that come to mind that you can check out.  I've not seen or heard of this before so I can't be certain of anything.problem

Do you have both exe files in the compiled folder?   
Are there any room.crm files in the same folder as the exe files?   
Have you tried doing a "rebuild all" on both games?
#972
General Discussion / London Games Fringe
Wed 15/10/2008 08:16:06
I came across this tidbit of news about a game developer's trade show in London next week and wondered if anyone was planning on attending.    I suppose that anyone who lives close enough to go,  probably already know about it.  But just in case here are links to their website. 

London Games Fringe
Festival Schedule

If anyone does attend please take some notes and lets the rest of us know what you saw.   I am particularly interested in the Open Source for Game Developers debate.   Apparently the tickets for the debate are free and there will be drinks afterwards (don't know if the drinks are also free but if they are .. you don't want to miss out ehh! := ).   
#973
I just had an interesting little idea that may be generally useful for all but especially so in the beginners thread.   It would be terribly convenient to have a link to the online help file forum's "compose post" page, right under the "How do I post images, smileys and formatting?" link?    This way it would be easy to lookup stuff when replying to someone's question and to insert a link to the relevant info in your reply.   I think there also should  be a prominent link to the help file perhaps in the forum banner or menu area.  It would also be nice it the online help file were search able as well.
#974
1. gMyGui.Visible = false;     // Online Manual Reference

2. Create an intro room and have the player character start in that room.   Create a "Player enters room" event handler function and put script commands in that function like this:

Code: ags

function room_Load() {
     Display("Some intro text...");
     Wait(100);
     Display("Some more intro text...");
     Wait(100);
     Display("Some other intro text...");
}
#975
Quote
Quote
This seemed to work just fine in V2.72 but in the current beta I get  an infinite loop error at  runtime.  The obvious next debugging step is to put a display statement inside the loop to look at ItemConut and RowCount.   With a display statement inside the loop or just before it, the problem does not occur.    Placing a Wait(1) statement just before the loop also prevents the problem from occurring.   

Where is this code, is it in game_start? I don't think anythigng around that area has changed since 2.72 so it's a bit strange, I'll see if I can reproduce the problem though.
Yeah, it doesn't appear to be related to startup.  There is a main GUI with some buttons, some of which activate a drop list when clicked.   The drop list is implemented using another GUI that only contains a ListBox.  When the button is clicked, the list is populated with the item associated with that specific button, the GUI containing the ListBox is positioned just under the button, the width of the GUI and ListBox are set to the width of the button and the GUI and ListBox heights are set so that all of the items in the list are displayed (height is limited so that the GUI and ListBox extents are within the viewport.   The problem occurs when setting the ListBox height, which occurs whenever the user clicks a button. 

The behavior suggests to me that perhaps after the button is clicked one or more  ListBox operations  are  performed, prior to the height adjustment, that prevent RowCount and/or ItemCount from being updated with the correct value untilk the subsequent game scan. 

The offending code is preserved and can be easily reconstituted.  I'll recreate and chase the problem a bit more to see if I can learn anything helpful.
[edit]

Analysis of the module's code shows that the following operations are performed on the GUI and Listbox prior to the execution of the while loop
Code: ags

gSubmenu.Visible = true;
gSubmenu.Height = nn;
gSubmenuList.Clickable = true;
gSubmenuList.Enabled = true;
gSubmenuList.Visible = true;
gSubmenuList.Clear();
gSubmenuList. = AddItem(...);
  :
gSubmenuList. = AddItem(...);

gSubmenuList.Height = 0
While (gSubmenuList.ItemCount>gSubmenuList.ItemCount) { // <==== Bug occurs here
     gSubmenuList.Height = gSubmenuList.Height + 5;     
}


I tried recreating the error with the newest version (RC1) and now there is no longer an infinite loop error but there is still a weird behavior.  Now it seems that the first time this code is executed it produces an incorrect result and the Listbox and Gui are sized so that the last two items in the list are cutoff from view.  Subsequent executions, however, produce correct results and all items in the list are visible.

[edit]
Help File
It no longer stays on top when launched form the editor.  I always found this to be a useful behavior as I could simultaneously view the help info while editing the script.  Now rhe help window disappears as soon as focus returns to the script file.
#976
Format is Ok for me now in ODF.  Thanks for the book...
#977
Sean, how did you do the page breaks any way?   It seems like maybe you just inserted blank lines until you got to the next page.  If so just go back, cursor to the last line of a page, press ctrl+Enter to get  a hard page break,  insert or delete blank lines to position the text on the next page, and then repeat for each page. 

As far as fonts are concerned there is no guarantee what fonts will be installed on any given system.   There is a discussion about OpenOffice and this issue here http://user.services.openoffice.org/en/forum/viewtopic.php?f=7&p=45058 and here http://qa.openoffice.org/issues/show_bug.cgi?id=20370.
#978
Quote
... It's always been a pet peeve of mine when someone posts not just asking but actually demanding help without having put forth an ounce of effort on their own part to discover the answer. Even if they had done as much as read the forum rules it would have at least directed them to the forum search and the wiki as well as the manual online.
Interestingly enough I had a very similar problem when I first started working at GE many many moons ago.   I put in ton of extra time to come up to speed on everything and become an expert at what I was doing (designing uPprocessor control systems).  I enjoyed helping my colleagues and sharing what I knew.  However, after awhile people whom I had never even met started showing up at my desk asking ill prepare questions. 

My dilema was that if I just told them to piss off I would be tagged with the "Isn't a team player" or "Dose not work well with people" monikers.   If I did their work for them then I wouldn't get my work done and would be tagged as being "Unproductive".    The solution I came up with worked very well for me back then and I think it can work has some relevance to this topic.

When people came to me ill prepared I would tell then that I was busy at the moment and that I would be glad to help them later and tell them that I could make time at 11:30 or 4:30.  Introducing a slight delay gave them time to think about what they wanted to ask.  Nine times out of ten they figured things out for themselves or got some else to do their work for them.

We had a lot of field engineers who would come in, work on a project, and leave with it.  This was usually a 2-3 year cycle so when they game back on the next project things were significantly different from the last time.  Once such individual was referred to me by mutual friends.  I didn't the guy or who had sent him at the time.  Althoughhe was by no means a newbie his question surely was "I have to work on such an such and I don't even know where to start.  Some people told me to talk to you...".   I was extremely busy so I quickly showed him where he could find diagrams of all the circuit cards from which our systems were built, I showed him where the hardware template diagrams were kept, and I gave him a stack of unbound  programming manuals and other reference that he could make copies of and sent him on his way.   We eventually became really good friends and years later were reminiscing about our first meeting over a beer.  I embarrassingly remembered  blowing him off.  My friend responded saying "No!  Not at all.  You were great.  You showed me where everything was and you had all those manuals there ready to be zeroxed .  You gave me exactly what I needed and wanted."

What you can take from all of this is that yes there are vexatious and stupid people around us all the time.  The best way to deal with such people is to ignore and avoid them as much as possible and to be friendly and civilized otherwise.  Realize that first impressions are often deceiving and that acting on them in extreme way in time result in your embarrassment and regret.

========================
While pondering this discussion, I was thinking that since there are rules for posting in the Beginner's Forum, perhaps there ought to be rules for responding as well.   I was thinking of something like the following may not be a bad idea to incorporate into the forum rules.

How to respond to posts in the Beginners Forum
If you don't have something nice to say then don't say anything at all.   (except for moderators sometimes).   

How to respond to an ill informed and/or annoying question?
If you're annoyed at someone for asking for help you shouldn't waste your time responding.   If you're annoyed it's not likely you have anything helpful or useful say; ignore this post and spend your time on somerthing more positive and productive.  We have a fairly large and diverse community so sooner or later someone who is not annoyed will offer kind and friendly help.  If no one replies then a moderator can step in,  explain why help was not forthcoming and how to get a better response next time,   and provide a little help and encouragement.

How to respond to an overly general question such as "Where do I start?".
You should realize that if someone is asking overly general questions it usually means that they are overwhelmed.   What such a person needs at this point is encouragement and to be pointed to some specific reference materials.    So you could  say something like this "It's difficult to answer such a generic question but I'll do my best.   You can find out about "ABC" in the help file under "XYZ" and "DEF".  There is also an excellent tutorial here some_tutorial.com and a game template at some_tutorial.com with some really good examples.   If I were you I would just do "this that  and the other thing".   I know it can be overwhelming at first but most people find AGS easy to learn and fun to use.   For the most part we have a friendly community who very generously offer help to fellow AGSers.  Asking specific questions is the best way to get help on the forum. 

How to respond to a specific question that has an obvious answer such as "How many controls can I have on a GUI?"?
Even people who have years of AGS experience are occasionally guilty of this as well as new folks.  Yes!! It's all in the manual but sometimes you just can't seem to find that needle in the haystack.  If the question is specific the answer can be short.  Perhaps something like "I think about 30.  It should be  under "System Limits" in the help file. ".   
#979
I think it's great that you have used CC and ODF, which I have downloaded and looking at just now. 

The ODf document's pqagination is off for me with OpenOffice on Linux.  The cover fits an 8.5x11 page size perfectly and experimenting with different page sizes seems to indicate this is not the problem.  What font and font size are you using.  It come up "Tinmes Roman 13" for me.   I think you can correct the format by putting in hard page breaks (in OpenOffice ctrl+Enter will insert a hard page break). 
#980
While upgrading some things from V2.72 to the current beta I found an interesting behavior of the ListBox control.   The code snippet below  is contained within a function that implements a drop down list that is dynamically sized and positioned.   

This seemed to work just fine in V2.72 but in the current beta I get  an infinite loop error at  runtime.  The obvious next debugging step is to put a display statement inside the loop to look at ItemConut and RowCount.   With a display statement inside the loop or just before it, the problem does not occur.    Placing a Wait(1) statement just before the loop also prevents the problem from occurring.   

Code: ags

	MyListbox.Height = 0;
	while (MyListbox.ItemCount>MyListbox.RowCount) {
		MyListbox.Height = MyListbox.Height+5;
	}


A display statement just before the loop shows ItemCount=10 and RowCount=0 both of which which are correct.   The only thing seems to makes sense is that the RowCount is not being updated when the Height is changed in the current game cycle but is being updated in subsequent game cycles. 

My code is long and complicated so there are plenty of opportunities for this to be the result of some embarrassing bit of programming on my part.   Since I am almost always guilty of such things I am the first one I suspect.  I don't have any code running in any repeatedly_execute() handler anywhere so I don't think it's possible for there to be any kind of race condition in the script.   I can't think of any other way that I could have blundered.

I didn't like the looping algorithm for setting the height anyway and have replaced it with a calculation that works just fine and is a better solution.   So this behavior is no longer a problem for me but I  thought it may be of some interest as it may be an indicator of other more sinister things lurking about. 
SMF spam blocked by CleanTalk