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

#601
Are you aware of the mini-game module?  It  uses a game restore to return back to the original game and state. There is a link to it in this thread.
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=34048.msg443220#msg443220
#602
I have been experimenting with the button control and have found a minor unexpected behavior that perhaps falls short of being a bug but is probably worth mentioning. 

I am attempting to implement a "set" button having two states.  When it is in the "off" state it can be pushed to switch it to the "on" state.  When in the "on" state it no longer responds to a  push; it's state would be typically be reset to the "off" state by another button or by the script. 

In the initial "off" state the button control is given three separate graphics for normal, mouse over, and pushed conditions.  In the "on" state the pushed graphic is used for all three conditions.  The button operates in the following sequence:

1.  Button in "off" state - Normal Graphic shown
2.  Move curso over button - Mouse Over graphic shown
3.  Mouse button down - Pushed graphic shown
4. Script reassigns button graphics for "on" state  - Pushed graphic shown
5. Mouse button up - Previously assigned Mouse Over graphic shown for one game cycle
6. One game cycle later - Newly assigned Mouse Over graphic (i.e. Pushed) is shown.
7. move cursor away from button - Pushed (newly assigned normal graphic) is shown

The unexpected behavior occurs at step #5 when the mouse is first released.  The old MouseOver graphic is displayed for one game cycle and then the new MouseOver graphic is displayed.  It doesn't matter how long the button is held down either.

I suspect this may have something to do with timing and the way the engine is executing my script and updating button properties.  It it's very difficult or nearly impossible to remedy this situation iot's p[robaly not worth the effort.  On the other hand if it is as simple as re-fetching the mouse over graphic when the button up event occurs then it is probably a worth while task. 

In any case I thought this was an interesting little detail to share.




#603
I may have found a compiler/runtime bug.   I have created a module.  An object with properties and methods resides in the module.  I have a public method that originally had 11 optional parameters defined.  In the global script I create an instance of this object and call this method from game_start() and pass 3 of the 11 optional parameters. 

When testing the game I get a runtime error indicating that a script link has failed and the following text: 'BluBox::Init^11'.   BluBox is the object and Init is the method being called when this error occurs.

A close inspection of the module header and module script reveals that the prototype matches the actual function definition (except of course for the default values and the ';' vs '{' ending).  The object instantiation and method call in the global script also appear to be correct.

So to investigate further the cause of this error the Init method was deconstructed by removing all the parameters from the prototype, definition, and call of the method.  This eliminated the error.   So then the method was reconstructed one parameter at a time with an intervening test.  No errors were encountered until the 11th parameter was added and then the error reappeared.

Now here is the strange part, the 11th parameter was eliminated and I expected to get the same results as before - no errors with 10 parameters.  But to my surprise the same error persisted, this time supplying this text in the error message: 'BluBox::Init^10'. 

Now I backup to 9 parameters and everything seems to be OK.    I thought this was a strange behavior and thought I'd report it.  The only other factors  I can think of that may be orworth mentioning is the fact that both prototype and function definition spanned multiple lines and so multiple space and tab characters occurred between parameters  for aesthetic reasons.  Also the optional parameters are GUIControl pointers set to default value of zero.  I am also using previous AGS release (AGS Editor .NET (Build 3.1.2.82) v3.1.2 SP1, February 2009).
#604
According to a recent article in the Telegraph.co.uk,
Lockerbie Bomber Defies Doctors' Prediction of Death, Megrahi is alive and his condition has not deteriorated and that his is in the same condition as when he left.

The article also informs us that three doctors examined Megrahi in jail on July 28, Professor Karol Sikora and Professor Ibrahim Sharif  there two doctors who made the claim that he had only 3 months to live, Professor Karol Sikora, Professor Ibrahim Sharif, and an unamed doctor.   

Professor Karol Sikora - "Was paid a one-day consultancy fee by the Libyan government to draw up a report delivered two days later. In an interview in September not long after Megrahi's release, Prof Sikora said he was initially "pessimistic" that the experts could say he would survive any less than a year. But Prof Sikora admitted that the Libyans had encouraged him to conclude that Megrahi had just three months to live following his examination. "The figure of three months was suggested as being helpful [by the Libyans]," he said. "To start with I said it was impossible to do that but, when I looked at it, it looked as though it could be done â€" you could actually say that.""

Professor Ibrahim Sharif - "Is a Libyan oncologist from the Tripoli Medical Centre, agreed Megrahi had 'about three months'."

Unamed Doctor - "While one of the doctors in the team that examined him was apparently 'more vague' about putting a limit on Megrahi's life expectancy.."

Other Doctors - "Other doctors have been reluctant to put a specific time-frame on life expectancy in patients suffering prostate cancer. Prof Nick James, professor of clinical oncology at the University of Birmingham, said: "I would not be surprised if Megrahi was still here well into next year. For sure it could be right his condition has not deteriorated." "

The article also says "While the Scottish Executive has insisted they canvassed a wide-ranging number of experts before freeing Megrahi, Prof Sikora's diagnosis is thought to have been critical to the process."

Apparently the other experts didn't give them the news they wanted to hear so they just kept asking until they found a couple of guys who would cooperate and give the right answer.  One who was supplied by the Libyan government and another who was paid by the Libyan government.   

The three month figure was critical as this was required to release a prisoner on compassionate grounds.  I stand by my assertion that the fix was in.  As time passes this will become more and more apparent.
#605
Sorry, gave bad advice before.  Region events are for player character only.  NsMn has the right idea.  Here is some code to use with region instead of object.    The first thing to do is to make an extender function that checks if a character is standing on a region.  Then use that function in the repeatedly execute function of the room script to loop through the list of characters.  COde below is untested but illustrates the method.

Code: ags

*** Script Header ***
import function IsStandingOnRegion(this Character*, int region_id);

*** Global Script ***
// Extender function to detect character standing on specified region
function IsStandingOnRegion(this Character*, int region_id) {
   // Return true if character is standing on the specified region, return false otherwise
   if (Region.GetAtRoomXY(this.x, this.y)==region[region_id) return true
   else return false;
}

*** Room Script ***

function room_RepExec() {
   int i;

    // Make character standing on region 1 say his name
   // First define some constants
   #define REGION_ID 1
   #define NUMCHARS 20
   #define FIRSTCHAR 1

   // Check to see if each character is standing on the region
   i = FIRSTCHAR;
   while (i<NUMCHARS) {
      if character[i].IsStandingOnRegion(REGION_ID) {
         character[i].Say("My name is %s",character[i].Name);
      }
      i++;
   }
}
#606
The approach would be to have an interaction or event handler function for each character (i.e. Character Enters Region).   Each of those functions could call a custom function and pass the character as a parameter.  Here is an untested snippet of code to illustrate what I mean.  Note, you will need to use the lightening bolt icon to create the event function and I'm am no longer certain how the default function names are formed so they will likely differ from cEgo_EntersRegion() as shown below.  And of course CustomFunction() is a name given by you that describes what the function actually does.

Code: ags

*** Room Script ***
function CustomFunction(Character *chr) {
   chr.Say("Hello!");
}

function cEgo_EntersRegion1() {
   CustomFunction(cEgo);
}


[edit]
Fixed BB tags soas to not F$#&up the F%$*ing thread  := 
#607
You may want to take a look at DemoCycle.
#608
Quote
I've also been using AGS to work on various (unfinished) non-adventure games, but the main relevant reason I can come up with is that when trying to transcribe non-AGS code modules, which are plenty to be found, that quite often they require multi-dimensional arrays, and they always assume that they are available.
This probably the best reason I've seen for implementing multi-dimensional arrays.  Otherwise the work-arounds work just fine.  Personally I would rather have improved support for stucts, struct in struct, struct and function pointers.  
#609
Palettes
Do the Khrisis and Classic sprites use the same palette?  Are there any other palette or color considerations?

Usage of RON Characters in  the DQ World
Is there any objection to Ron characters appearing in the DQ world?  Is there a need or desire to make variations for DQ?  For example, in the movie "The Wizzard of OZ" the characters Dorothy meets in OZ are inspired by people she knows from her real world in Kansas.   I guess what I am suggesting is that perhaps some of the RON characters could be patrons in Dar's Girls or workers in the Games Factory.  If need be I could paint them new clothes, give them a hard hat, or make some other change.   Just like in TWO where the Lion, Tinman, and Scarecrow are in real life the farm hands that work for Dorothy's parents, RON characters in the DQ world would play a different role than in the RON world.   

Demo Cycle
This is a side issue but is there any interest in adding a RON location/level to the DemoCycle  mini game?  I have already made it fairly easy to add levels.  We would just have to work out where on the DemoCycle Route Map RON would appear and what the city scape would look like.  At some point I would like to rework the code into reusable modules and adding a level or two could be just the incentive to get me going on the task.  I'd also like to, if possible/practical, improve the the game play a bit.  Perhaps enhance the roadway animation to allow twists and turns, allow more objects along the roadway, and possibly even try to use the 3D module for this purpose.

Reality University
What's the scoop on Reality University?  Is there much known about it?  Where is it located?  What games has it appeared in?  Is there any description or documentation about it.  Which characters are involved there;  students, professors,  administrators, others?  What backgrounds exist?

Whacky Idea?
What about starting in the Classic RON world and ending in the Khrisis RON world?  I could use the old cliche explanation of the timeline being slightly changed or parallel universe thingy where this one is almost but not quite the same as the first one?  It could be an explanation of why there are two different style of RON sprites.  This doesn't matter to the DQ world  but it's something that could be added if it helps explain the RON world.  Just let me know what the preference is.   
#610
Quote
Maybe you could make a loop check over the inventory array until you find the name (not the scripting one) of your item, but that doesn't seem practical.
Well it would look something like the following code.  It's untested but should give an idea how to go about searching for the name.  Also, note it's possible to know how many of each inventory item a character has.  So the inventory can be used to keep track of much money the player has instead doing it as a special case.  Also in

Code: ags

*** Script header ***
import function GiveInv(this Character*, String name, int amount);

*** Global Script ***
// Extender function - Gives quantity of inventory to character
function GiveInv(this Character*, String name, int amount)  {
    int i;
    bool found;

   // Find the named inventory item
   i = 0;
   found = false;
   while ((i<Game.InventoryItemCount)&&!found) {
      if (name==inventory[i].Name) {
         found = true;
      }
      else i++;
   }
   // Give it to him
   if (found) {
      this.InventoryQuanity[i] = player.InventoryQuanity[i]+amount;
      PlaySound(4);
   } 
   else {
      Display("*** Error-GiveInv, item not found (%s%)", name);
   }
}

*** Global or Room  Script ***
   // Give 12 coins to Ego
   cEgo.GiveInv("coins", 12);


Perhaps a better solution is to use the inventory objects (pointers to them) themselves instead of their names.  That would look like this and would negate the need for the search loop.
Code: ags

*** Script header ***
import function GiveInv(this Character*, Inventory *name, int amount);

*** Global Script ***
// Extender function - Gives quantity of inventory to character
function GiveInv(this Character*, Inventory *name, int amount)  {
    int i;
   // Give it to him
   if (name!=null) {
      this.InventoryQuanity[name.IDi] = this.InventoryQuanity[name.ID]+amount;
      PlaySound(4);
   } 
   else {
      Display("*** Error-GiveInv, invalid inventory item specified");
   }
}

*** Global or Room  Script ***
   // Give 12 coins to Ego
   cEgo.GiveInv(iCoins, 12);
#611
I am sorry about your loss.  I know how it feels; we rescued a little kitten, we named Bandito,  a couple of years ago.  He disappeared when he was about a year old and we were heartbroken.   Also about 25 years ago my kitty Snowy passed away under similar circumstances to your bunny and I've always felt guilt for not getting him to the vet sooner.   

My kitty Gordito hasn't been feeling well the last few days; he was just lying around and sleeping on the window sill for a couple of days.  So I took him to the vet yesterday and after a little electrolyte injection, some antibiotics, and a $250 blood test for everything (which he passed), he seems to be doing much better now. 

I always believed that the way someone treats animals is very revealing about that person's character.  You and your wife seem to be  very nice people.  Your beloved will live on in your memories forever.  Take comfort in knowing that you gave Biggles a wonderful life, a so much better life than if you and he never met.   I hope your pain will soon pass.

Rick
#612
Why not do all that stuff in the on_call() function?

Code: ags

function on_call(int iValue)
{
    if (iValue == 1) {
        // This is reserved for showing the SkyCab driving in, and facing Ron toward it (south)
        oSkyCab.X = 1040;
        oSkyCab.Y = 1028;
        oSkyCab.Visible = true;
        oSkyCab.TweenPosition(1.5, 60, 950, eEaseOutTween, eBlockTween);
        player.FaceDirection(eSouth);

        if (sSkyCabChoice == "Ronald's Home") {
            player.ChangeRoom(3);
        } else if (sSkyCabChoice == "Gryph Cafe") {
            player.ChangeRoom(4);
        } else if (sSkyCabChoice == "Richter Demolition") {
            player.ChangeRoom(8);
        } else if (sSkyCabChoice == "Police Station") {
            player.ChangeRoom(9);
        } else if (sSkyCabChoice == "SouthCoast Savings") {
            player.ChangeRoom(11);
        }
    }
}

#613
I suspect the problem is that you are changing rooms before the on_call() is executed.  How about moving the change room stuff inside the on_call() thing.  You could create a global function in the global script and call it from on_call() if you want to have it organized that way.
#614
General Discussion / Re: Chinese Ship Hijacked
Wed 21/10/2009 09:28:33
Quote
And what's with the organ selling part?
Quote
If you google harvesting organs from prisoners you get page after page of news stories such as "China Admits to Harvesting Organs From Prisoners", " China Harvests Organs From Prisoners", "China May Stop Harvesting Organs From Executed Prisoners ", etc.  Here are just  few from the first page of search results.
#615
I hadn't thought of dong in the dialog itself.  However this technique can also be useful  for other things such as moving NPC's around in the background etc.
#616
Another approach to your problem is to create a finite state machine that is executed from the repeatedly execute function of the room or global script.   The state machine executes the script commands contained in a specific state each game cycle.  The repeatedly execute script finishes each game cycle so the problem you describe is non-existent in this case.

Here is an untested example of how to do this.  You will need one state machine for each set of dialog/scripts.
Code: ags

*** Script Header ***
#define FSMRUN -1

*** Room Script ***
// Define a finite machine that does "Stuff"
int   StuffState=-1;
function StuffStateMachine(int request) {
   // Do the control stuff
   if ((request>=0)&&(StuffState==-1)) StuffState = control;
   else {
      // Do the state stuff
      if (StuffState==0) {         // Implement script for state 0
         SomesSriptCode();       // Script code
         dMerchant.Start()         // Start a dialog
         StuffState=1;                // Tell FSM to go to next state
      }
      else if (StuffState==1) {  // Implement script for state 1
         // Do nothing                // Wait for Dialog to finish
                                              // dMerchant dialog sets  StuffState=2;  to finish
      }
      else if (StuffState==2) {  // Implement script for state 2
         SomesMoreSriptCode();// Script code
         StuffState=-1;                // Tell FSM to go to next state
      }
   }
   return StuffState;
}

function AnyOtherFunction() {
   // Startup the Stuff state m,achine
   StuffStateMachine(0);
}

function roomRepExec() {
   // Execute the Stuff state machine
   StuffStateMachine(FSMRUN); 
}


Monkey's suggestion seems easiest in this case though.
#617
General Discussion / Re: Chinese Ship Hijacked
Wed 21/10/2009 04:21:28
The news story reports that the pirates warn that the crew will be killed if a rescue attempt is made.   I didn't think they would pay any attention to such threats.  and from what you say here
Quote
...  the Chinese government already sent a fleet with 800 crews to rush to the rescue.
it would appear that my intuition was correct.   This isn't a criticism of China; I'm rooting for them and hope they kick some sereious butt.   In my original post I state that it will be interesting to see if  China actually does go in and kick butt and if they do will they get any criticism from the EU and the "peace at any cost" crowd.

Go China!! Open a can of whoopass!
#618
General Discussion / Chinese Ship Hijacked
Wed 21/10/2009 01:29:47
Here is  a lin to the BBC story about the hijacking of a Chinese ship by Somali pirates.

http://news.bbc.co.uk/2/hi/asia-pacific/8315630.stm

I think this will be an interesting story to watch as if unfolds for a number of reasons.  First of I think the Chinese government doesn't care about the crew of the ship as they do about being beaten by a handful of thugs.  I think for them it would be embarrassing to look weak and I don't think they will do it.  I have a feeling that they will take a position similar to:   "We don't want to negotiate.  You took our ship and made us look bad.  Now we are going to  catch you and sell your organs."   There is even a slight possibility they may even wipe out the land based infrastructure.

So it will be interesting to see:

1.  What the Chinese response is as compared to the US, EU  and other countries.

2. What standards the Chinese will be held to as compared to the US, EU, and other countries.

What do you think will happen? 
#619
Thanks Ben,  your eyes are better than mine  cause I can't spot it.   ;D
#620
I just checked myself and the Unhandled Inventory has the same problem.  The  first few lines should be changed to this
Code: ags

   // Unhandled Inventory
   else if (what==5) {
       if (type==0) {       //  5    0   Look at inventory
      }


Also save yourself a lot of headaches in the future by properely indenting the code.  Your Display statements are inside a code  block delineated by the characters { and } so the should be indented and not aligned with the enclosing brackets.  Here is an example of how to do it.
Code: ags

   //  Unhandled Character
   else if (what==3)  {   

      if (type==0) {  //  3    0   Look at character (The error is on this line.)
         Display("Someone is standing here.");
      }
      else if (type==1) {  //  3    1   Interact with character
         Display("Poking a stranger is likely to put you in a bad situation.");
      }
      else if (type==2) {  //  3    2   Speak to character
         Display("You get no response."
      }
      else if (type==3) {  //  3    3   Use inventory on character
         Display("Your generous offer is not accepted.");
      }
      else if (type==5) {  //  3    5   Pick up character
      }
      else if (type==6) {  //  3    6   Cursor Mode 8 on character
      }
      else if (type==7) {  //  3    7   Cursor Mode 9 on character
      }
      else  {                     //  Undefined
      }
   }

SMF spam blocked by CleanTalk