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

#1
Mmh, i get an error like "token" problem at line:

musicvolume = (GetSliderValue (SYSTEM, 5));

AGS said musicvolume is the problem... what's wrong??
#2
Anybody an idea of solution for my problem? Mh? I try and try, but it will not run...
#3
Now i can load and save games. No problem.

Ok No. 4 is changed, thx for the clue.

But where can I get such a script, which tests the name of existing save games and I also have the problem, that the slider values are not run….
#4
Thanks. :)
#5
Can nobody help me??? I need help. :(
#6
How can i set up the size of inventory objects and where?

THX
#7
Here is my global script.

I have following Bugs:

1) Savegames with same name will not overwritten
2) Volume of music & sound cannot changed by the sliders
3) Save volume values in save games (i never could test it, will it saved in save games???)
4) music on/off function is missing (i don't know, how I must coding; by "StopMusic" the game crashes)


#sectionstart unhandled_event  // DO NOT EDIT OR REMOVE THIS LINE
function unhandled_event (int what, int type) {
}
#sectionend unhandled_event  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart game_start  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() // called when the game starts, before the first room is loaded
  {
SetGlobalInt(299,8);
game.items_per_line=4;
game.num_inv_displayed=4;
game.text_speed=7;
  }
#sectionend game_start  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
string buffer, text;
int cur_mode, mode;
mode = GetGlobalInt(299);
cur_mode = GetCursorMode();
StrCopy (text, "");

// Je nach Cursor-Modus wird jetzt ein Verb in die Statuszeile geschrieben

if (cur_mode == MODE_WALK) StrCat(text,"Gehe zu ");
if (cur_mode == MODE_LOOK) StrCat (text,"Schau an ");
if (cur_mode == 2) StrCat (text,"Benutze ");

if (cur_mode == 3) StrCat(text,"Rede mit ");
if (cur_mode == 5) StrCat(text,"Nimm ");
if (mode == 7) {
   StrCat(text, "Benutze ");
   GetInvName (player.activeinv, buffer);
   StrCat(text, buffer);
   StrCat(text, " mit ");
  }

// Das Objekt unter dem Cursor finden und an die Statuszeile anhängen

GetLocationName(mouse.x, mouse.y, buffer);
StrCat(text, buffer);
SetLabelText (0, 2, text);
  }
#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE


function show_inventory_window()   
// This demonstrates both types of inventory window - the first part is how to
// show the built-in inventory window, the second part uses the custom one.
// Un-comment one section or the other below.
  {
  // ** DEFAULT INVENTORY WINDOW
  InventoryScreen();
  /* 
  // ** CUSTOM INVENTORY WINDOW
  GUIOn (INVENTORY); 
  // switch to the Use cursor (to select items with)
  SetCursorMode (MODE_USE);
  // But, override the appearance to look like the arrow
  SetMouseCursor (6);
  */
  }

#sectionstart on_key_press  // DO NOT EDIT OR REMOVE THIS LINE
function on_key_press(int keycode) // called when a key is pressed. keycode holds the key's ASCII code
  {
  if (IsGamePaused()==1) keycode=0; // game paused, so don't react to keypresses
  if (keycode==367) RestartGame(); // F9
  if (keycode==434) SaveScreenShot("scrnshot.pcx");  // F12
  if (keycode==19) Debug(0,0); // Ctrl-S, give all inventory
  if (keycode==22) Debug(1,0); // Ctrl-V, version
  }
#sectionend on_key_press  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(int button) // called when a mouse button is clicked. button is either LEFT or RIGHT
  {
      if (IsGamePaused()==1) // Game is paused, so do nothing (ie. don't allow mouse click)
    {
    }
  else if (button==LEFT)
    {
    ProcessClick(mouse.x,mouse.y,GetCursorMode());
    SetCursorMode(MODE_WALK);
    }
  else if (button==RIGHT)
    {

  if (GetLocationType(mouse.x, mouse.y) == 2) {
    SetGlobalInt(299,9);
    ProcessClick(mouse.x, mouse.y, MODE_WALK);
    SetGlobalInt(299,0);
    }
  else {
    FaceLocation(GetPlayerCharacter(), mouse.x, mouse.y);
    ProcessClick(mouse.x, mouse.y, MODE_WALK);
    SetCursorMode(MODE_LOOK);
  }
}
  }
#sectionend on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart interface_click  // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {

// Main menu (commandos and inventory)

if (interface == 0) {
  if (button == 1) {   // Pick up
     SetCursorMode(5);
     SetGlobalInt(80,3);
     }
  if (button == 3) {   // Talk
      SetCursorMode(3);
      SetGlobalInt(1,1);
      SetGlobalInt(80,7);     
      }
  if (button == 4) {   // Use
     SetCursorMode(2);
     SetGlobalInt(80,1);
     }   
  if (button == 5) {   // Look
     SetCursorMode(1);
     SetGlobalInt(80,4);
     }
  if (button == 6) {   // Options
     SetGlobalInt(80,6);
     GUIOn(2);
     GUIOff(0);
     }
  if (button == 7) {   // Quit Game
     SetGlobalInt(80,9);
     GUIOn(5);
     GUIOff(0);
     }
  if (button == 8) {   // Load
     SetGlobalInt(80,5);
     ListBoxSaveGameList(3,0);
     GUIOff(0);
     GUIOn(3);
     }
  if (button == 9) {   // Save
     SetGlobalInt(80,9);
     ListBoxSaveGameList(4,3);
     GUIOn(4);
     GUIOff(0);
     }
  if ((button == 11) & (game.top_inv_item < game.num_inv_items - 4))
     game.top_inv_item = game.top_inv_item + 1;
  if ((button == 10) & (game.top_inv_item > 0))
     game.top_inv_item = game.top_inv_item - 1;
  }

// Options menu

if (interface == 2) {
  if (button == 0) {
     GUIOff(2);
     GUIOn(0);
     }
  if (button == 6) {
     SetSoundVolume(GetSliderValue(2,2));
     PlaySound(1);
     }
  if (button == 5) {
     DisplayMessage(999);
     SetMusicMasterVolume(GetSliderValue(2,1));
     PlayMusic(1);
     }
  }

// Load menu

if (interface == 3) {
  int index;
  if (button == 1) {
     index=ListBoxGetSelected(3,0);
     RestoreGameSlot(savegameindex[index]);
    } 
  if (button == 2) {
     GUIOff(3);
     GUIOn(0);
    }
  }

// Save menu

if (interface == 4) {
string text;
int index;
if (button == 1) {
   GUIOn(0);
   GUIOff(4);
  }
if (button == 0) {
   index=ListBoxGetNumItems(4,3);
  if (index<10) {
     GetTextBoxText(4,2,text);
     GUIOff(4);
     GUIOn(0);
     SaveGameSlot(index+1,text);
    } else {
           index=ListBoxGetSelected(4,3);
           GetTextBoxText(4,2,text);
           GUIOff(4);
           GUIOn(0);
           SaveGameSlot(savegameindex[index],text);
          }
    }
  }

// Quit game

if (interface == 5) {
  if (button == 0) {
     QuitGame(0);
    }
  if (button == 1) {
     GUIOn(0);
     GUIOff(5); 
    }
  }
}
#sectionend interface_click  // DO NOT EDIT OR REMOVE THIS LINE

#8
Yes, the Label text color was balck. Ha, thats funny. THX :)
#9
No, it's all correct. I installed the displaymessage and it was shown in the game, but music is still broken.

I also try to create own load and save menus and i have the same problems. All buttons, labels etc. working correct, the save menu saves games, but in the list box they are not listed and i also can't load any saves games. Why? Whats wrong?

Code: ags

// extra load menu

if (interface == 3) {
    
    int index; 
    if (button == 1) {
index=ListBoxGetSelected(3,0); 
RestoreGameSlot(savegameindex[index]);

    }

if (button == 2) {
GUIOff(3);
GUIOn(0);
    }

    }

// extra save menu

if (interface == 4) {
string text; 
int index; 
if (button == 1) {
GUIOn(0);
GUIOff(4);
    } // ende button 1 

    if (button == 0) {
       index=ListBoxGetNumItems(4,3);
       if (index<10) { // only 10 save slots are available!
          GetTextBoxText(4,2,text); 
          GUIOff(4);
          GUIOn(0); 
          SaveGameSlot(index+1,text);
       } // ende index 
       else {
          index=ListBoxGetSelected(4,3);
          GetTextBoxText(4,2,text);
          GUIOff(4);
          GUIOn(0); 
          SaveGameSlot(savegameindex[index],text);
    } // ende else 
    } // ende button 0 

}


Again: labels, boxes, buttons are correct setted up and AGS don't show any error messages or something, so i don't know where's the problem. I need every help!
#10
I want top make a options menu with different settings by sliders. Some are the volume of sound and music.

By a slider i change/make a value, this value should will receive by a button (by click on it):

SetMusicMasterVolume(GetSliderValue(4, 1));

But i doesn't run. I can hear music but very soft, equal which value is set up by the slider. GUI 4 is the options menu (pop up) and 1 is the slider for music.

What do i wrong

Another question: is this value saved in save game sor must i change i every time i play the game? Could it be saved in sve games?
#11
Yes, it's big enough and it exists and it's the only label in this GUI.

I think i have an errror anywhere in the source code.... or do i have a bug in the cur_modes???
#12

Here is my global script, what is wrong? I get no error messages but the textes are not shown in label

Code: ags
#sectionstart game_start  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() // called when the game starts, before the first room is loaded
  {
SetGlobalInt(299,8);
game.items_per_line=5;
game.num_inv_displayed=5;
game.text_speed=7;
  }
#sectionend game_start  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
  string buffer;
  string madetext;
  int cur_mode;
  int useorgive;
  StrCopy (madetext, "lll");
  cur_mode = GetCursorMode();
  if (cur_mode == MODE_WALK)
    StrCat(madetext,"Gehe zu ");
  else if (cur_mode == MODE_LOOK)
    StrCat (madetext,"Schau an ");
  else if ((cur_mode == MODE_USE) && (GetGlobalInt(1)==1))
    StrCat(madetext,"Benutze ");
  else if ((cur_mode == MODE_USE) && (GetGlobalInt(1)==0))
    StrCat(madetext,"Gib ");
  else if (cur_mode == MODE_TALK)
    StrCat(madetext,"Rede mit ");
  else if (cur_mode == 5)
    StrCat(madetext,"Nimm ");
  else if ((cur_mode == 4) && (GetGlobalInt(1)==1))
    {
    StrCat(madetext,"Benutze ");
    GetInvName (player.activeinv, buffer);
    StrCat(madetext,buffer);
    StrCat(madetext," mit ");
    }
  else if ((cur_mode == 4) && (GetGlobalInt(1)==0))
    {
    StrCat(madetext,"Gib ");
    GetInvName (player.activeinv, buffer);
    StrCat(madetext,buffer);
    StrCat(madetext," an ");
    }

  else if (cur_mode == 8) {
    if (GetGlobalInt(80) == 1) StrCat(madetext,"SchlieàŸe ");
    if (GetGlobalInt(80) == 2) StrCat(madetext,"Gib ");
    if (GetGlobalInt(80) == 3) StrCat(madetext,"Öffne ");
    if (GetGlobalInt(80) == 4) StrCat(madetext,"Drücke ");
    if (GetGlobalInt(80) == 5) StrCat(madetext,"Ziehe ");
    }

  // Find out what's under the cursor, and add it to the status line
  GetLocationName(mouse.x,mouse.y,buffer);
  StrCat(madetext,buffer);
  SetLabelText ( 0, 2, madetext);
  }
#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE


function show_inventory_window()   
// This demonstrates both types of inventory window - the first part is how to
// show the built-in inventory window, the second part uses the custom one.
// Un-comment one section or the other below.
  {
  // ** DEFAULT INVENTORY WINDOW
  InventoryScreen();
  /*  
  // ** CUSTOM INVENTORY WINDOW
  GUIOn (INVENTORY);  
  // switch to the Use cursor (to select items with)
  SetCursorMode (MODE_USE);
  // But, override the appearance to look like the arrow
  SetMouseCursor (6);
  */
  }



#sectionstart on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(int button) // called when a mouse button is clicked. button is either LEFT or RIGHT
  {
      if (IsGamePaused()==1) // Game is paused, so do nothing (ie. don't allow mouse click)
    {
    }
  else if (button==LEFT) 
    {
    ProcessClick(mouse.x,mouse.y,GetCursorMode());
    SetCursorMode(MODE_WALK);
    }
  else if (button==RIGHT)
    {

  if (GetLocationType(mouse.x, mouse.y) == 2) {
    SetGlobalInt(299,9);
    ProcessClick(mouse.x, mouse.y, MODE_TALK);
    SetGlobalInt(299,0);
    }
  else { 
    FaceLocation(GetPlayerCharacter(), mouse.x, mouse.y);
    ProcessClick(mouse.x, mouse.y, MODE_LOOK);
    SetCursorMode(MODE_WALK);
  }
}
  }
#sectionend on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart interface_click  // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {
  // this GUI system uses GlobalInt 80 to store which of the extended
  // modes is in use (close, give, push, pull, etc)


  if (interface == 0) {
    if (button == 1) {   // Pick up
      SetCursorMode(5);
      SetGlobalInt(80,3);
      }
    if (button == 3) {   // Talk
      SetCursorMode(3);
      SetGlobalInt(1,1);
      SetGlobalInt(80,7);      
      }
    if (button == 4) {   // Use
      SetCursorMode(2);
      SetGlobalInt(80,1);
      }   
    if (button == 5) {   // Look
      SetCursorMode(1);
      SetGlobalInt(80,4);
      }
    if (button == 6) {   // Options
      SetGlobalInt(80,6);
      }
    if (button == 7) {   // Quit Game
      SetGlobalInt(80,9);
      QuitGame (1);
      }
    if (button == 8) {   // Load
      SetGlobalInt(80,5);
      RestoreGameDialog();

      }
    if (button == 9) {   // Save
      SetGlobalInt(80,9);
      SaveGameDialog();
      }

    if ((button == 10) & (game.top_inv_item < game.num_inv_items - 7))
      game.top_inv_item = game.top_inv_item + 4;
    if ((button == 9) & (game.top_inv_item > 0))
      game.top_inv_item = game.top_inv_item - 4;
    }
  }
#sectionend interface_click  // DO NOT EDIT OR REMOVE THIS LINE

SMF spam blocked by CleanTalk