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 - a-v-o

#101
1. Please do so.
2. You can use either non-numeric arrows, NumPad-arrows (NumLock off) or NumPad-Numbers (NumLock on).
3. Yes, it's german:

// neue Richtung ermitteln
// get new direction

// Vergleich mit aktueller Richtung
// compare with current direction

a problem with the hard disc in my server.
#102
You can use e.g. InputBox command or a GUI text box, or whatever other way you prefer.
#103
Description:
The player can use keys 1-9 on the numeric keypad or the corresponding arrow keys to control the movement of the player character (pc). The pc moves as long as the key is pressed and stops moving when the key is released.

===>>> GLOBAL SCRIPT <<<===

// ------ keyboard control ------

#define DIR_DISTANCE     10000

#define DIR_DOWN_LEFT  1
#define DIR_DOWN       2
#define DIR_DOWN_RIGHT 3
#define DIR_LEFT       4
#define DIR_STOP       5
#define DIR_RIGHT      6
#define DIR_UP_LEFT    7
#define DIR_UP         8
#define DIR_UP_RIGHT   9

int PrevDirection;

function game_start()
{
 // called when the game starts, before the first room is loaded

 // ------ keyboard control ------
 PrevDirection = DIR_STOP;
}

function repeatedly_execute()
{
 // put anything you want to happen every game cycle here

 // --- keyboard control ---
 int CharId, Direction, dx, dy;

   // neue Richtung ermitteln
        if ((IsKeyPressed (371) > 0) || (IsKeyPressed (55) > 0)) Direction = DIR_UP_LEFT;    // 7 Home (numeric pad)
   else if ((IsKeyPressed (372) > 0) || (IsKeyPressed (56) > 0)) Direction = DIR_UP;         // 8 Up arrow
   else if ((IsKeyPressed (373) > 0) || (IsKeyPressed (57) > 0)) Direction = DIR_UP_RIGHT;   // 9 PgUp (numeric pad)
   else if ((IsKeyPressed (375) > 0) || (IsKeyPressed (52) > 0)) Direction = DIR_LEFT;       // 4 Left arrow
   else if ((IsKeyPressed (376) > 0) || (IsKeyPressed (53) > 0)) Direction = DIR_STOP;       // 5 Stop (numeric pad)
   else if ((IsKeyPressed (377) > 0) || (IsKeyPressed (54) > 0)) Direction = DIR_RIGHT;      // 6 Right arrow
   else if ((IsKeyPressed (379) > 0) || (IsKeyPressed (49) > 0)) Direction = DIR_DOWN_LEFT;  // 1 End (numeric pad)
   else if ((IsKeyPressed (380) > 0) || (IsKeyPressed (50) > 0)) Direction = DIR_DOWN;       // 2 Down arrow
   else if ((IsKeyPressed (381) > 0) || (IsKeyPressed (51) > 0)) Direction = DIR_DOWN_RIGHT; // 3 PgDn (numeric pad)
   else Direction = DIR_STOP;
   // Vergleich mit aktueller Richtung
   if (PrevDirection != Direction)
   {
     PrevDirection = Direction;
     CharId = GetPlayerCharacter ();
     if (Direction == DIR_STOP)              { StopMoving (CharId);                    }  // 5 Stop (numeric pad)
     else
     {
            if (Direction == DIR_UP_LEFT)    { dx = -DIR_DISTANCE; dy = -DIR_DISTANCE; }  // 7 Home (numeric pad)
       else if (Direction == DIR_UP)         { dx = 0;             dy = -DIR_DISTANCE; }  // 8 Up arrow
       else if (Direction == DIR_UP_RIGHT)   { dx = DIR_DISTANCE;  dy = -DIR_DISTANCE; }  // 9 PgUp (numeric pad)
       else if (Direction == DIR_LEFT)       { dx = -DIR_DISTANCE; dy = 0;             }  // 4 Left arrow
       else if (Direction == DIR_RIGHT)      { dx = DIR_DISTANCE;  dy = 0;             }  // 6 Right arrow
       else if (Direction == DIR_DOWN_LEFT)  { dx = -DIR_DISTANCE; dy = DIR_DISTANCE;  }  // 1 End (numeric pad)
       else if (Direction == DIR_DOWN)       { dx = 0;             dy = DIR_DISTANCE;  }  // 2 Down arrow
       else if (Direction == DIR_DOWN_RIGHT) { dx = DIR_DISTANCE;  dy = DIR_DISTANCE;  }  // 3 PgDn (numeric pad)
       MoveCharacterStraight (CharId, character [CharId].x + dx, character [CharId].y + dy);
     }
   }
}
#104
You can implement a chat (instant messages).

In the test game the mouse over is used as an example. When you move your mouse over one of the shapes then the name of the shape is transmitted to the other game and displayed in the text line at the top.

You can send individual messages like in private chats or broadcast the same message to all other players (can be more than 2).
#105
In fact new versions of AGS are released more frequently than this plugin. Though people were interested in this plugin I never heard of any completed game that makes use of this plugin.
#106
Quote from: Kairus on Wed 17/12/2003 04:01:47the game gets stuck, you can't move the mouse, you can't press the keyboard, you can't even use the classical ctrl-alt-del thing, you can only reset.
When I debugged my plugins I had similar/same situations: At breakpoints or errors the game got stuck. Reason: The focus was given to a windows message box which was "behind" the AGS fullscreen game. The game can't process keyboard/mouse events which are still sent to the game and not to the windows message box behind.
This effect can also happen when watching a movie in fullscreen mode with e.g. mediaplayer and an error occurs. So it's a windows "feature" not AGS specific.

Quote from: Kairus on Wed 17/12/2003 04:01:47It doesn't happen to me all the time, it's like I can only start it once and then reset the computer, if I run the game a second time without rebooting the bug happens.
Do you use Win XP?
#107
AGS is written in C, but I use Delphi (Pascal) for the plugin, so Chris couldn't make use of the source code.
#108
If you have a program to edit midi, then there might be an option to export to wav.

If you want to do it with only Windows programs then...
1. sound mixer: set synth as input source
2. start sound recorder
3. start mediaplayer with the midi-file
4. make sure that both programs are visible at the same time
5. sound recorder: start recording
6. mediaplayer: start playing
7. sound recorder: stop recording when midi is finished
8. sound recorder: save wav

by default the sound recorder only records 60 seconds, but you can also record longer:
record 60 seconds, then start recording again for another 60 seconds period. If the file is long enough to hold the whole midi, then rewind the sound recorder and start recording the whole midi.
#109
Advanced Technical Forum / Re:2 player?
Sat 13/12/2003 21:17:02
TCP/IP is the internet protocol.

See the other thread for the plugin features:
http://www.agsforums.com/yabb/index.php?board=2;action=display;threadid=4343

The download site for the plugin is currently down.
#110
Are you sure that your music files aren't WAV files?

I tested it with hotspots and wav files won't play even when they are renamed to mid. I replaced the wav files with real mid files and all is fine.

No StopMusic command needed, only PlayMusic (21) and music21.mid is played.
#111
if you mean that the sound volume depends on how close they are to the player character, then there is no comman, but I used this script to produce the effect:

#define MIN_VOLUME     0
#define MAX_VOLUME   255
#define MAX_DISTANCE 160

int volume = 0;

function room_b() {
 // script for room: Repeatedly execute
 int PC = GetPlayerCharacter ();
 int dx = character [GUARD_CHAR].x - character [PC].x;
 if (dx <  0) { dx = -dx; }
 int distance = MAX_DISTANCE - dx;
 int vol = MIN_VOLUME;
 if (distance > 0)
 {
   vol += distance * (MAX_VOLUME - MIN_VOLUME) / MAX_DISTANCE;
 }
 if (volume != vol)
 {
   volume = vol;
   SetSoundVolume (volume);
 }
 if (IsSoundPlaying () <= 0) { PlaySound (97); }
}

#112
The long script is only necessary because piraatlife4me wants random quit messages. Otherwise you'd design your quit game gui in the gui editor and just show it with GUIon (4); which is one simple line of code.
#113
a)
When you start the movement, then you can set a variable to an action value. When there is another click then the variable is either set to "no action" or to the new action.

You can use collide-functions, check coordinates, character.walking or whatever you want in repeatedly_execute to find out when the character is at the target.

b)
You use regions for the target position. Instead of setting a variable you switch on the target region. When the character enters the region then the action is started.
If the player clicks anywhere then all the regions are switched off. If he clicks on a new target then all regions are switched off, but the new target region is switched on.
#114
Maybe you should put all code which you have after
ccExecuteCommand(HOME, 1);
into the repeatedly_execute.
#115
Hello Phoenix,

it seems to me that you're still misunderstood. In fact your required nonblocking-functions don't exist. Maybe you can simulate a non-blocking MoveCharacterToHotspot with a combination of GetHotspotAt, GetHotspotPointX/Y and MoveCharacter.

#116
This is listed in the 2.57beta, so it should be in the next version:

* Added auto-complete for plugin functions and functions defined in the script header.
#117
You can try something like this way:
For all usable items you create these conditional branches in the interaction editor with "stop running more commands" at their end. After all this you add a "run script" action and call the function unhandled_event with the correct parameters.
#118
--- script header ---
#define FACE_LEFT 1
#define FACE_RIGHT 2
#define FACE_UP 3
#define FACE_DOWN 4
import function FaceDir(int charid, int dir);

--- global script ---

function FaceDir(int charid, int dir);
int xcoord=character[charid].x;
int ycoord=character[charid].y;
if (dir == FACE_LEFT) xcoord=xcoord-10;
else if (dir == FACE_RIGHT) xcoord=xcoord+10;
else if (dir == FACE_UP) ycoord=ycoord-10;
else if (dir == FACE_DOWN) ycoord=ycoord+10;
FaceLocation(charid,xcoord,ycoord);
}

This should also work with rooms larger than 1000 and execute somewhat faster because no string comparison is needed.

Not tested.
#119
Advanced Technical Forum / Re:Square Root
Mon 27/10/2003 16:19:38
Hey Gilbot,

Quote
int i=0;
while (i*i<num) i++;

This is really the easiest way to get the integer square root and I used it in the flashlight plugin to calculate the circle.

Strange that I haven't thought at it at my last post. ???
#120
When I only change the "player character view" in the room settings, AGS doesn't notice that the room should be saved first before loading the next room. Same for some other room settings (e.g. animation delay).

This was already in 2.56.
SMF spam blocked by CleanTalk