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

#1
Hi,

Im making a game with a speech pack. At present i have the files just in the game folder. When i come to distribute it what is the best way to go about it. Can i put all the vioce mp3's into a folder with the vioce vox, or do they have to be lose?

Basically what is the best way about adding files like music and speech and video to the distibutable package?

thanks in advance
#2
Beginners' Technical Questions / save games
Sat 07/05/2005 11:56:23
Hi,

i want to create my own save and load gui's so that i can control they way they look. Is there a tutorial on this or can anyone tell me exactly hoe to do this. I have tried but i cant get anything to work.

thanks in advance
#3
the value turned out as expected to be -1. but i still cant figure it out.

I have also tried to use the alternative code (shown in a tutorial) which uses structs and so on. That works a little better but it does not completely work either.

Basically, i dont really need screen shots, i need to create a save load function, but i want to control how it looks. Is there a way of changing the way the pre built save/loa game gui's look, or can you point me towards a tutorial of how to create your own save load system or tell me how to do it. i have tried that as well, but as you can tell my coding is not the best so it does not work either.

thanks
#4
anybody have any ideas?
#5
Hi here is the code, like i said it is from the tech archive so i have not really changed anything, i just tried to paste it into the relevant places but i have probably got loads wrong.

I have created 2 gui's: SAVEGAME and LOADGAME

with the objects being

0= label
1= list box
2 = save button or load button
3 = cancel button
4 = 104 by 78 size button for image
5 = text box (only on save game gui)

and here is the code

Code: ags


THIS BIT GOES AT THE TOP BEFORE THE GAME START FUNCTION

#define NEW_SAVE_FILE_TEXT "-> Create New File"
//This is the text used by the savegame dialog for the "new file" slot
//   in the savegame list. 

// These are used by the save/load system
string NewSaveSlotText;  // will contain the NEW_SAVE_FILE_TEXT string
int SaveLoadScreenshot = 0;  // pointer to screenshot sprite



function ShowSaveGameDialog() {	// Display custom savegame dialog
	string text;

 // Create temp save so we can grab a preview shot for the save box  
  SaveGameSlot(1, "temp");
  
  SaveLoadScreenshot = LoadSaveSlotScreenshot(1, 104, 78);
  DeleteSaveSlot(1);
  
  // Screenshot successfly loaded, set as button pic
  if(SaveLoadScreenshot != 0) {  //if there is an image
    SetButtonPic(SAVEGAME, 4, 1, SaveLoadScreenshot);

  }
  
  // Load up the savegame list
  ListBoxClear(SAVEGAME, 1);
  ListBoxSaveGameList(SAVEGAME, 1);
  
  // Take care of housekeeping
  if(ListBoxGetNumItems(SAVEGAME, 1) == 20) {
    // All 20 saves used, don't allow creation of new one
    Display("The save directory is full.[[Please replace a previous save.");
    ListBoxSetSelected(SAVEGAME, 1, ListBoxGetNumItems(SAVEGAME, 1) - 1);
    ListBoxGetItemText(SAVEGAME, 1,  ListBoxGetNumItems(SAVEGAME, 1) - 1, text);
    SetTextBoxText(SAVEGAME, 5, text);
  }
  else {
     // Still room, add a "new file" option to the end of the listbox
    ListBoxAdd(SAVEGAME, 1, NewSaveSlotText);
    ListBoxSetSelected(SAVEGAME, 1, ListBoxGetNumItems(SAVEGAME, 1) - 1);
    SetTextBoxText(SAVEGAME, 5, ""); //set the text box text to nothing
  }
  
  CentreGUI(SAVEGAME);
  GUIOn(SAVEGAME);
}

function ShowLoadGameDialog() {
  // Display custom loadgame dialog
  ListBoxClear(LOADGAME, 1);
  ListBoxSaveGameList(LOADGAME, 1);
  
  if(ListBoxGetNumItems(LOADGAME, 1) == 0) {
    Display("There are no files in the save directory.[[Record your progress by clicking the 'save' button, then you can go back to the point where you saved with the 'load' button.");
    return;
  }
  
  ListBoxSetSelected(LOADGAME, 1, 0);

  SaveLoadScreenshot = LoadSaveSlotScreenshot(savegameindex[0], 104, 78);
  
  if(SaveLoadScreenshot != 0) {
    SetButtonPic(LOADGAME, 4, 1, SaveLoadScreenshot);
  }

  CentreGUI(LOADGAME);
  GUIOn(LOADGAME);
}

THEN IN GAME START FUNCTION

#sectionstart game_start  // 
function game_start() {
  // called when the game starts, before the first room is loaded
  
  // Initialize the string we check against to decide whether to replace or not
  StrCopy(NewSaveSlotText, NEW_SAVE_FILE_TEXT);
  
  // Set size of savegame images to match size of button we put them on
  game.screenshot_width = 104;
  game.screenshot_height = 78;

  GUIOff(0);
  GUIOff(2);
  GUIOff(3);
  GUIOff(4);
  SetInvDimensions(60,40); //sets the inv to these dimensions
}
#sectionend game_start  //

THEN INSIDE INTERFACE CLICK


  if (interface == SAVEGAME) {  // Save Game
  
    string text; //define string name
    
    
    if(button == 1) {  // Listbox
      // Fill the textbox with description of clicked save slot
      ListBoxGetItemText(SAVEGAME, 1, ListBoxGetSelected(SAVEGAME, 1), text);
      if(StrComp(text, NewSaveSlotText)) { // existing slot, use existing desc
        SetTextBoxText(SAVEGAME, 5, text);
      } 
      else    // new file slot, just empty it
        SetTextBoxText(SAVEGAME, 5, "");
  }
 
else if(button == 3) {  // Cancel button
      // clean up the sprite cache
      if(SaveLoadScreenshot != 0) {
        SetButtonPic(SAVEGAME, 4, 1, 343);  // 2055 is completely transparent
        DeleteSprite(SaveLoadScreenshot);
        SaveLoadScreenshot = 0;
      }
      GUIOff(SAVEGAME);
}
    else {  // Save button or return in textbox
      // clean up sprite cache
      if(SaveLoadScreenshot != 0) {
        SetButtonPic(SAVEGAME, 4, 1, 343);  // 2055 is completely transparent
        DeleteSprite(SaveLoadScreenshot);
        SaveLoadScreenshot = 0;
      }
      // don't get the GUI caught in screenshot!
     GUIOff(SAVEGAME);
     SetDefaultCursor();
     Wait(1);
      // save the game
      
      ListBoxGetItemText(SAVEGAME, 1, ListBoxGetSelected(SAVEGAME, 1), text);
      if(StrComp(text, NewSaveSlotText)) {
        GetTextBoxText(SAVEGAME, 5, text);
        SaveGameSlot(savegameindex[ListBoxGetSelected(SAVEGAME, 1)], text);
      }
      else {
        GetTextBoxText(SAVEGAME, 5, text);
        SaveGameSlot(ListBoxGetSelected(SAVEGAME, 1), text);
      }
    }
}  // end if interface SAVEGAME
  
  if (interface == LOADGAME) {  // Load Game
    if(button == 1) {  // Listbox
      // Clean sprite cache
      if(SaveLoadScreenshot != 0) {
        SetButtonPic(LOADGAME, 4, 1, 343);  // 2055 is completely transparent
        DeleteSprite(SaveLoadScreenshot);
        SaveLoadScreenshot = 0;
      }
     
      // Load up new preview shot
      SaveLoadScreenshot = LoadSaveSlotScreenshot(savegameindex[ListBoxGetSelected(LOADGAME, 1)], 104, 78);
       
      if(SaveLoadScreenshot != 0) {
        SetButtonPic(LOADGAME, 4, 1, SaveLoadScreenshot);
      }
      else {
        SetButtonPic(LOADGAME, 4, 1, 343);  // 2997 is completely transparent
      }
    }
    else if(button == 3) {  // Cancel button
      // clean cache
      if(SaveLoadScreenshot != 0) {
        SetButtonPic(LOADGAME, 4, 1, 343);  // 2997 is completely transparent
        DeleteSprite(SaveLoadScreenshot);
        SaveLoadScreenshot = 0;
      }
      GUIOff(LOADGAME);
    }
    else if(button == 2) {  // Load button
      // clean...yeah
      if(SaveLoadScreenshot != 0) {
        SetButtonPic(LOADGAME, 4, 1, 343);
        DeleteSprite(SaveLoadScreenshot);
        SaveLoadScreenshot = 0;
      }
      RestoreGameSlot(savegameindex[ListBoxGetSelected(LOADGAME, 1)]);
      GUIOff(LOADGAME);
    }
  }  // end if interface LOADGAME
}


the end

sorry i cant find how format the code text, what is the text you put b4 it for this again?

i realise its alot to ask but any help is greatly appreciated

thanks ben

Edit by strazer:

Use the
[ code ]xyz[ /code ]
tags (without spaces).
#6
Hi i asm trying to use the dialog_request function and it comes up with an error

So in my dialog i say

run-script 1

and in the global script, after repetedly execute (right place?)
i put this code:

function dialog_request (1) {
 
   StopMusic(); //stops the music
  SetCharacterView(JAZZ, 17);
  AnimateCharacter(JAZZ, 2, 8, 1);
}

It says that thier is a parser error at one. I dont understand because in the help it says put:

dialog_request (int parameter)
Called when a dialog script line "run-script" is processed. PARAMETER is the value of the number following the "run-script" on that line of the dialog script.

so either i am being stupid (probably) or the number should be 1 and there is no parser error

thanks
#7
Hi, i am (foolishly) trying to create a save/ load gui following the method that was shown in the tech archive. Basically, i am having problems with it, I followed the instructions as best i could but to no avail.

When i run the game the gui comes up fine, but when you type in the name nto the text box and press save it says that this line of code is referencing an invalid item:

ListBoxGetItemText(SAVEGAME, 1, ListBoxGetSelected(SAVEGAME, 1), text);

as far as i can tell there is nothing wrong with the code, but i am obviously wrong. Should i post all the code i have used? it is basically the same as suggested in the tech archive.

Also, should definitions go before the game start function, and is it nessesary to end them in a similar way to how ags automatically ends its functions e.g. #sectionend.

thanks
#8
sorry i just realised what it was after posting.

My cursor reaction area was at the edge of its graphic

sorry again

#9
hello again.

i am tryin to change the graphics of my handles on the sliders on one of my gui's

I have managed to do this, however the hit area (area which reacts to the cick) is not in the right place it is slightly bellow the graphic.

My graphic does not have any trans[parent area. It is croped perfectly around the image So that cant be the problem. The graphic is a png.

Any ideas how to fix this?
#10
sorry, i have figured it out.

I was using the on key pressed function, so in my game you hold down the button e.g. I for interact. This was overiding the animation

thanks anyway

#11
Not sure what you mean about the room interactions window. Do you mean i would have to write a code which states when over hotspot animate cursor

What i did was, check the "Animate" checkbox . Give it  view 9

my animation was then put in view 9 in loop 0


thanks
#12
i am trying to animte the cusor when over abjects and hotspots. so i have clicked the animate over hotspot button and assigned it a view.

When the mouse is over the hotspots it only changes the graphic to the secound frame. Is it not possible to have for example a 5 frame animation for the cursor

thanks
#13
Hello, i'm trying to use the seekmp3pos function, i am seeking 30 secs into a track so i use (30000) as the number of millisecs to seek. This works fine when i skip to the room using ctrl x, however when the room loads normally it produces this error

---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x0042EB06 ; program pointer is +1004, ACI version 2.62.772, gtags (100,181)

i have tried putting the following code

PlayMP3File("Lay_Me_Down.mp3");
SeekMP3PosMillis(30000);

into b4fade, afterfade and when player enters screen all with similar results

any ideas?

thanks left
#14
hi,

i have yet another problem, this time with my gui. I am trying to make a scrollable inventory which displays the name of the item the player has selected. The code bellow works but the name of the selected item does not appear until you have cosed and reopened the gui. Is there a better way of coding this, or maybe using someother text box or display function?

if (player.activeinv >=1) {       
Ã,  Ã,  Ã,  string buffer;Ã,        
GetInvName (game.inv_activated, buffer);
SetLabelText(0,5,buffer);
}
else {} //else do nothing

thanks
#15
this works thank you


however the code as it is does not work: previousroom must be spelt prevroom for it to work. In fact i just cut that code down to (character[EGO].prevroom == 5);

thanks
#16
i am using some code in my game which switches the view of the room the charater is in, i am doing this using regions and global variables in the before fade in section

it works fine but when i quit the game  messages appear telling me to put the code (which is based on move character and set global int) into the after fade in section becuase i am calling a wait function.

I think i understand why this code should go in the after fade in section but:
the problem is that when i do this the game crashes, i have also tried the when player enters screen section but to no avail.

is it a big deal leaving my code in the before fade in section

code example:
if (GetGlobalInt(1) == 1) { //if the player has come from room 5
 
character[EGO].x=(191);
character[EGO].y=(127);

MoveToWalkableArea(EGO);
MoveCharacterBlocking(EGO, 197, 161, 1);

}
else {
character[EGO].x=(153);
character[EGO].y=(190);
}
 
 
#17
hi, ii am trying to use the cd audio(querie)  function, the command which checks for a cd in the drive which is supposed to return a value of either 1 or 0 depending on whether there is a cd in the drive or not

if have used the following code but it does not work, i gues the code i have written is wrong. How do i write it properly

CDAudio (0, 0);

if (CDAudio(0,0) == 0) {//do something
}

thanks
#18
fixed it, yeah i went to interface_click and saw that i had deleted a bit of code by mistake as i recently changed the loads of script in my game. For some stupid reason i had deleted a bit of the function. STUPID ME

all is well now

thanks for the help

#19
I AM ACCESSING IT VIA, THE EDIT SCRIPT OPTION on the gui page. is there another way to access the gui script.

it crashes every time
#20
hello

when i am trying to access my gui script this message comes up and ags crashes

(Exception 0xC0000005 at EIP=0x005FE163, AGSE v.2.62.509)

i have tried importing new gui's from an old version but this also causes it to crash

no idea what to do
SMF spam blocked by CleanTalk