I much prefer the new way. It makes it easier and faster to navigate.
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 MenuQuote
if ((character[TRAIN].x > -100) && (character[TRAIN].x < 420)) { // If train is closing in on visible screen, play the train sound
PlaySound(4);
}
if (character[TRAIN].walking == 0) { // When the train has reached its destination, it's time to go back
Ã, int randomPosX = Random(1000)-2000; // Find random negative X value
Ã, MoveCharacterPath (TRAIN, randomPosX, 152);
Ã,Â
Ã, int randomNegX = Random(1000)+2000; // Find random positive X value
Ã, MoveCharacterPath (TRAIN, randomNegX, 152);
Ã, }
if (AreCharactersColliding(EGO, TRAIN)) { // Character being hit by train
Ã, Display("Ouch!");
Ã, }
if (AreCharObjColliding(TRAIN, 0)) { // Train hits bottle
Ã, ObjectOff(0); // Bottle vanishes
Ã, ObjectOn(1); // Insides revealed
}
if (i = 320) {
Ã, SetCharacterView(JUBALON, 23);
Ã, AnimateCharacter(JUBALON, 0, 3, 1);
Ã, while (character[JUBALON].animating) Wait(1);
Ã, ReleaseCharacterView(JUBALON);
Ã, i = 0;
Ã, }
i++;
}
Quote
PlayVideo
PlayVideo (string filename, int skip, int flags)
Plays an AVI or MPG file, or any other file type supported by Media Player.
FLAGS can be one of the following:
0: the video will be played at original size, with AVI audio
1: the video will be stretched to full screen, with appropriate
black borders to maintain its aspect ratio and AVI audio.
10: original size, with game audio continuing (AVI audio muted)
11: stretched to full screen, with game audio continuing (AVI audio muted)
SKIP defines how the player can skip the video:
0 player can't skip video
1 player can press ESC to skip video
2 player can press any key to skip animation
The game is paused while the animation plays.
function interface_click(int interface, int button) {
Ã, if (interface == LUGGAGE) { //LUGGAGE is the GUIObject that opens the inventory
Ã, Ã, Ã,Â
Ã, Ã, Ã, if ((button == 0) && (GetCursorMode()!=4)) {Ã, // cursor is NOT useinv
Ã, Ã, Ã, Ã, Ã, SetCursorMode(MODE_LOOK);
Ã, Ã, Ã, Ã, Ã, GUIOn(INVENTORY);
Ã, Ã, Ã, Ã, Ã, GUIOff(LUGGAGE);
Ã, Ã, Ã, }
Ã, Ã,Â
Ã, Ã, Ã, else if ((button == 0) && (GetCursorMode()==4)) {Ã, // cursor IS useinv
Ã, Ã, Ã, Ã, if (character[SELF].activeinv==3) {
Ã, Ã, Ã, Ã, SetInvItemPic(3, 31);
Ã, Ã, Ã, Ã, }
Ã, Ã, Ã, Ã, if (character[SELF].activeinv==4) {
Ã, Ã, Ã, Ã, SetInvItemPic(4, 32);
Ã, Ã, Ã, Ã, }
Ã, Ã, Ã, Ã, SetActiveInventory (-1);
Ã, Ã, Ã, Ã, SetCursorMode(MODE_WALK);
Ã, Ã, Ã, Ã,Â
Ã, Ã, Ã, }
Ã, }Ã, // end if interface LUGGAGE
function on_mouse_click(int button) {
int oldItemGraphic; // used for loading the old sprite back when item is deactivated
int currentItem;
Ã, // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,Â
Ã, if (button==LEFT) {
Ã, Ã, if (IsGUIOn(INVENTORY)) {
Ã, Ã, // Do nothing
Ã, Ã, }
Ã, Ã, else {
Ã, Ã, ProcessClick(mouse.x, mouse.y, GetCursorMode() );
Ã, Ã, }
Ã, }
Ã, else if (button == LEFTINV) { // if left-clicked on an inventory item
Ã,Â
Ã, Ã, if (GetCursorMode()==1) {
Ã, Ã, Ã, Ã, RunInventoryInteraction(game.inv_activated, MODE_LOOK);
Ã, Ã, Ã, Ã, }
Ã, Ã, else if (GetCursorMode()==2) {
Ã, Ã, Ã,Â
Ã, Ã, Ã, // Commands for removing item from inventory / loading new cursor sprite
Ã, Ã, Ã,Â
Ã, Ã, Ã, SetActiveInventory(game.inv_activated); // activates the clicked item
Ã, Ã, Ã, currentItem = character[GetPlayerCharacter()].activeinv; // stores the current item number
Ã, Ã, Ã, oldItemGraphic = GetInvGraphic(currentItem); // stores items graphic slot, used for loading later
Ã, Ã, Ã, SetInvItemPic(game.inv_activated, 0); // removes the sprite from inventory
Ã, Ã, Ã, if (character[SELF].activeinv==3) {
Ã, Ã, Ã, Ã, Ã, SetMouseCursor(13); // loads the new cursor
Ã, Ã, Ã, Ã, Ã, }
Ã, Ã,Â
Ã, Ã, Ã, else if (character[SELF].activeinv==4) {
Ã, Ã, Ã, Ã, Ã, SetMouseCursor(14); // loads the new cursor
Ã, Ã, Ã, Ã, Ã, }
Ã, Ã, Ã, }
Ã, Ã, else if (GetCursorMode()==3) {
Ã, Ã, Ã, Ã, RunInventoryInteraction(game.inv_activated, MODE_TALK);
Ã, Ã, Ã, Ã, }
Ã, Ã, else if (GetCursorMode()==4) {
Ã, Ã, Ã, Ã, RunInventoryInteraction(game.inv_activated, MODE_USEINV);
Ã, Ã, Ã, Ã, }
Ã, }
Ã, else if (button == RIGHTINV) { // if right-clicked on an inventory item
Ã, Ã, // Do nothing
Ã, }
Ã, else if (button == RIGHT) {Ã, Ã, // right-click, so cycle cursor
Ã, Ã, Ã, Ã, SetNextCursorMode();
Ã, }
}
//MOUSE CURSOR
string name;
GetLocationName(mouse.x, mouse.y, name);// Get the name of what's under the cursor
if (StrComp(name,"")==0) SetDefaultCursor();// if blank ( or hotspot with no name ) do nothing
else {
Ã, Ã, if (GetCursorMode()==1) {
Ã, Ã, Ã, if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(8);
Ã, Ã, else SetDefaultCursor();
Ã, Ã, }
Ã, Ã, if (GetCursorMode()==2) {
Ã, Ã, Ã, if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(9);
Ã, Ã, else SetDefaultCursor();
Ã, Ã, }
Ã, Ã, if (GetCursorMode()==3) {
Ã, Ã, Ã, if (GetLocationType(mouse.x,mouse.y)==2) SetMouseCursor(10);
Ã, Ã, else SetDefaultCursor();
Ã, Ã, }
}
string name;
GetLocationName(mouse.x, mouse.y, name); // Get the name of what's under the cursor
if (StrComp(name,"")==0) { // Nothing underneath
Ã, if (GetCursorMode()==4) { // Nothing underneath, so show custom cursor
Ã, Ã, Ã, if (character[SELF].activeinv==3) {
Ã, Ã, Ã, Ã, Ã, SetMouseCursor(13);
Ã, Ã, Ã, }
Ã, Ã, }
Ã, else {
Ã, SetDefaultCursor();
Ã, }
}
else { // object underneath
Ã, Ã, Ã, if (GetCursorMode()==1) {
Ã, Ã, Ã, Ã, Ã, if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(8);
Ã, Ã, Ã, else SetDefaultCursor();
Ã, Ã, Ã, }
Ã, Ã, Ã, else if (GetCursorMode()==2) {
Ã, Ã, Ã, Ã, Ã, if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(9);
Ã, Ã, Ã, else SetDefaultCursor();
Ã, Ã, Ã, }
Ã, Ã, Ã, else if (GetCursorMode()==3) {
Ã, Ã, Ã, Ã, Ã, if (GetLocationType(mouse.x,mouse.y)==2) SetMouseCursor(10);
Ã, Ã, Ã, else SetDefaultCursor();
Ã, Ã, Ã, }
Ã, Ã, Ã, else if (GetCursorMode()==4) {
Ã, Ã, Ã, Ã, Ã, if (character[SELF].activeinv==3) {
Ã, Ã, Ã, Ã, Ã, Ã, SetMouseCursor(11);
Ã, Ã, Ã, }
Ã, Ã, }
}
Ã, else if ((button == RIGHT) && (GetCursorMode()==3) && (currentItem > 0)) {Ã, Ã, // If right mouse button is down, cursorMode is 3 and an inventory item is active
Ã, Ã, Ã, Ã, Ã, SetNextCursorMode();
Ã, Ã, Ã, Ã, Ã, ChangeCursorGraphic(4, oldItemGraphic);
Ã, }
Ã,Â
Ã, else if ((button == RIGHT) && (currentItem==0)) {Ã, Ã, // right-click, so cycle cursor
Ã, Ã, Ã, Ã, SetNextCursorMode();
Ã, }
Quote from: Guest on Sat 05/02/2005 23:30:03
???PLz simplify
Ã, Ã, if (GetGlobalInt(1)==0) { // This part checks if the action has been executed before. If global variable 1 has the value 0, do this.
Ã, Ã, Ã, // Add code for first interaction
Ã, Ã, Ã, SetGlobalInt(1, 1); // This part tells the script that the first interaction has happened, hence we change global variable 1's value to 1.
Ã, Ã, Ã, }
Ã, Ã, else { // This part is what is run if the first interaction has happened, ergo global variable 1 HAS been changed to 1.
Ã, Ã, Ã, // Add code for second interaction
Ã, Ã, }
#sectionstart on_mouse_clickÃ, // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(int button) {
Ã,Â
int currentItem; // used to store the current item
int oldItemGraphic; // used for loading the old sprite back when item is deactivated
Ã, // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,Â
Ã, if (button==LEFT) {
Ã, Ã, if (IsGUIOn(INVENTORY)) {
Ã, Ã, Ã,Â
Ã, Ã, Ã,Â
Ã, Ã, Ã, // Add command for removing item from hand, adding it back into the inventory
Ã, Ã, }Ã, Ã,Â
Ã, Ã, else {
Ã, Ã, ProcessClick(mouse.x, mouse.y, GetCursorMode() );
Ã, Ã, }
Ã, }
Ã, else if (button == LEFTINV) { // if left-clicked on an inventory item
Ã,Â
Ã, Ã, if (GetCursorMode()==1) {
Ã, Ã, Ã, Ã, RunInventoryInteraction(game.inv_activated, MODE_LOOK);
Ã, Ã, Ã, Ã, }
Ã, Ã, else if (GetCursorMode()==2) {
Ã, Ã, Ã,Â
Ã, Ã, Ã, // Commands for removing item from inventory / loading new cursor sprite
Ã, Ã, Ã,Â
Ã, Ã, Ã, SetActiveInventory(game.inv_activated); // activates the clicked item
Ã, Ã, Ã, currentItem = character[GetPlayerCharacter()].activeinv; // stores the current item number
Ã, Ã, Ã, oldItemGraphic = GetInvGraphic(currentItem); // stores items graphic slot, used for loading later
Ã, Ã, Ã, SetInvItemPic(game.inv_activated, 0); // removes the sprite from inventory
Ã, Ã, Ã, ChangeCursorGraphic(currentItem, 31); // loads the new cursor
Ã, Ã, Ã, }
Ã, Ã, else if (GetCursorMode()==3) {
Ã, Ã, Ã, Ã, RunInventoryInteraction(game.inv_activated, MODE_TALK);
Ã, Ã, Ã, Ã, }
Ã, Ã, else if (GetCursorMode()==4) {
Ã, Ã, Ã, Ã, RunInventoryInteraction(game.inv_activated, MODE_USEINV);
Ã, Ã, Ã, Ã, }
Ã, }
Ã, else if (button == RIGHTINV) { // if right-clicked on an inventory item
Ã, Ã, // Do nothing
Ã, }
Ã, else if (button == RIGHT) {Ã, Ã, // right-click, so cycle cursor
Ã, Ã, Ã, if (currentItem > 0) {Ã, Ã, // if an item is active
Ã, Ã, Ã, Ã, if (GetCursorMode()==3) { // if the next cursorMode is the active inventory item
Ã, Ã, Ã, Ã, Ã, SetNextCursorMode();
Ã, Ã, Ã, Ã, Ã, ChangeCursorGraphic(currentItem, 31);
Ã, Ã, Ã, Ã, }
Ã, Ã, Ã, }
Ã, Ã,Â
Ã, Ã, Ã, else if (currentItem == 0) { // if NO item is active
Ã, Ã, Ã, Ã, SetNextCursorMode();
Ã, Ã, Ã, }
Ã, }
}
Quote from: strazer on Sat 05/02/2005 05:12:20
1.) DisableCursorMode
2.) You could set the item to a blank sprite with SetInvItemPic while it's activated.
With AGS v2.7 you will be able to add an item to a specified position in the inventory so you could store its position, remove it from the inventory and add it back to the old position once the user changes the cursor mode.
I've noticed you don't use "else" much:
Ã, if (GetCursorMode()==0) {
Ã, Ã, SetCursorMode(1);
Ã, }
Ã, // use "else, otherwise the following will also be executed if cursor mode is 0 because you set the cursor mode to 1 in the part above:
Ã, else if (GetCursorMode()==1) {
Ã, Ã, SetMouseCursor(8 );
Ã, }
Ã, if (button==LEFT) {
Ã, Ã, Ã, if (GetCursorMode()==2) { // The use command
Ã,Â
Ã, Ã, Ã, // Commands for removing item from inventory
Ã, Ã, Ã, SetInvItemPic(game.inv_activated, 0); // O is a transparent sprite
Ã, Ã, Ã, SetActiveInventory(game.inv_activated); // Activates the item
Ã, Ã, Ã, currentItem = character[GetPlayerCharacter()].activeinv; // Stores the item number in the currentItem variable... not that it does much good here
Ã, Ã, Ã, ChangeCursorGraphic(4, 31); // Changes the cursors appearance, since SetInvItemPic makes it transparent... :(
Ã, Ã, Ã, }
}
function on_mouse_click(int button) {
Ã, // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,Â
Ã,Â
Ã, if (button==LEFT) {
Ã, Ã, if (IsGUIOn(INVENTORY)) {
Ã, Ã, Ã,Â
Ã, Ã, Ã,Â
Ã, Ã, Ã,Â
Ã, Ã, Ã, // Add command for removing item from hand.
Ã, Ã, Ã,Â
Ã, Ã, Ã,Â
Ã, Ã, Ã, }
Ã, Ã, else {
Ã, Ã, ProcessClick(mouse.x, mouse.y, GetCursorMode() );
Ã, Ã, }
Ã, }
Ã, if (button == LEFTINV) { // if left-clicked on an inventory item
Ã, Ã, if (GetCursorMode()==1) {
Ã, Ã, Ã, Ã, RunInventoryInteraction(game.inv_activated, MODE_LOOK);
Ã, Ã, Ã, Ã, }
Ã, Ã, if (GetCursorMode()==2) {
Ã, Ã, Ã, SetActiveInventory(game.inv_activated);
Ã, Ã, Ã,Â
Ã, Ã, Ã,Â
Ã, Ã, Ã, // Add command for removing item from inventory.
Ã, Ã, Ã,Â
Ã, Ã, Ã,Â
Ã, Ã, Ã, }
Ã, Ã, if (GetCursorMode()==3) {
Ã, Ã, Ã, Ã, RunInventoryInteraction(game.inv_activated, MODE_TALK);
Ã, Ã, Ã, Ã, }
Ã, Ã, if (GetCursorMode()==4) {
Ã, Ã, Ã, Ã, RunInventoryInteraction(game.inv_activated, MODE_USEINV);
Ã, Ã, Ã, Ã, }
Ã, }
Ã, else if (button == RIGHTINV) { // if right-clicked on an inventory item
Ã, Ã, // Do nothing
Ã, }
Ã, else if (button == RIGHT) {Ã, Ã, // right-click, so cycle cursor
Ã, Ã, SetNextCursorMode();
Ã, }
}
if (IsGUIOn(INVENTORY)) {
Ã, Ã, if (GetCursorMode()==0) {// Changes the walk cursor to the Use cursor.
Ã, Ã, Ã, Ã, SetCursorMode(1);Ã, Ã, Ã, Ã, // This code doesn't work properly,
Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, //and has to be changed
Ã, Ã, }
Ã, Ã, if (GetCursorMode()==1) { // Changes the appearance of the Use cursor to an open eye instead of a closed one
Ã, Ã, Ã, Ã, SetMouseCursor(8);
Ã, Ã, }
Ã, Ã, if (GetCursorMode()==2) { // Similar as above
Ã, Ã, Ã, Ã, SetMouseCursor(9);
Ã, Ã, }
Ã, Ã, if (GetCursorMode()==3) { // Similar as above
Ã, Ã, Ã, Ã, SetMouseCursor(10);
Ã, Ã, }
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.047 seconds with 14 queries.