cEgo_Look and cEgo_talk function in room script vs global

Started by jamesreg, Wed 23/09/2009 22:40:34

Previous topic - Next topic

jamesreg

I have a question I have been messing around with the  cEgo_Look and cEgo_talk  from the side menu and did not realize until i was half way into it that when you use those fuctions it puts it into the global script this is ok for inventory items and such that will have the same comments all the time

But for example Im trying to use the  cEgo_talk command just to have a character say something in one specific room if its in the global script hes going to say the same thing every time.

I tried typing cEgo_talk  in the room script but it does not appear to work that way i typed it same way it would appear in the global script
what am I missing

Khris

Don't type it there. A function needs to be linked, otherwise it won't be called.

Characters are global game objects, thus they are handled in the global script.

a) Use a check for player.Room:

Code: ags
function cEgo_Look() {
  if (player.Room == 1) {
    // code for room 1
  }
  else if (player.Room == 2) {
...


b) Use the CallRoomScript command.
You may need additional global variables for that though.

jamesreg

Ok maybe I am doing this way to complicated let me explain what I am doing and maybe someone can tell me a better way
cause I think im not doing this the most efficient way.

What I am doing is as follows

in the bottom of screen three things

1) character avatar with active characters picture
2) character text box which is colored different for each char I put a text overlay there for their dialog
3) inventory box with active characters inventory

now I have to switch each of those things around each time I have a dialog session going

this is what im doing

function cKirk_Talk()
{


if (player == cKirk) {

gInventory.Visible=true;
gkirkavatar.Visible=true; 
gtextboxkirk.Visible=true; 
invCustomInv.CharacterToUse=ckirk;

Overlay* text6 = Overlay.CreateTextual(150, 475,340,8,0,"text that will display in the text box?");
   Wait(200);
    text6.Remove();
   
}
  else if (player == cspock) {
gInventory.Visible=true;
gspockavatar.Visible=true; 
gtextboxspock.Visible=true; 
invCustomInv.CharacterToUse=cspock;

Overlay* text7 = Overlay.CreateTextual(150, 475,340,8,0,"text that will display in the text box?");
   Wait(200);
    text7.Remove();

}
else if (player == cMccoy) {
   gInventory.Visible=True;
gspockavatar.Visible=true; 
gtextboxspock.Visible=true; 
invCustomInv.CharacterToUse=cmccoy;

Overlay* text8 = Overlay.CreateTextual(150, 475,340,8,0,"text that will display in the text box?");
   Wait(200);
    text8.Remove();
{


Now this all works when you talk to the players but because its in global script i need to be able to have different conversations in different rooms

I seen the above explanation but not sure about how to use the callroomscript yet

before I go further am i making this harder then it needs to be?

I also heard people talking about sierra portraits and backgrounds and styles but havent been able to find a detailed example of this anywhere would that work better for me?

also what about if i didnt use the default talk function but created a custom mouse click and slapped a talk icon on it and used it for my talk icon and then could i script this per room like im wanting to do?

anyway someone please give me some advice on if im doing this too complicated and if there is an easier way



   
   

}

}




SMF spam blocked by CleanTalk