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 - Lt. Smash

#101
Quote from: Ghost on Mon 01/06/2009 10:47:14
Quote from: Lt. Smash on Mon 01/06/2009 08:34:32
you may overlook but you call a function only by its name, its parambrackets and a semicolon.

Oh yes. Sorry, I didn't know. I mean, how should I? Duly corrected.
Is parambrackets a word?
Not directly. I meant the brackets ( ... ) in which you send your parameters to the function.
#102
Quote from: Ghost on Mon 01/06/2009 02:38:46
Code: ags

btnGuiButton1_onClick(GUIControl *control, MouseButton button)
{
  function SayRandomQuote()
}

you may overlook but you call a function only by its name, its parambrackets and a semicolon.
so it should be
Code: ags

btnGuiButton1_onClick(GUIControl *control, MouseButton button)
{
  SayRandomQuote();
}
#103
and you made too much/less brackets.

if ((keycode == eKeySpace) && gIconbar.Visible == false) {
      gIconbar.Visible = true;
}
   
if ((keycode == eKeySpace) && gIconbar.Visible == true) {
      gIconbar.Visible = false;
}
but you can also leave the brackets in the brackets.

and don't forget:
one = sets the value.
== checks if it is the value and returns either true or false.
#104
Yes, thats true.
For the outlines I built up a 3d room using Google SketchUp. Then I made a screenshot reduced its size and redraw the outlines.
And then I started with it in DP.

But for any other room where you don't have any reference (like Indy's buro) I would recommend Jens painting suggestion.
#105
Thanks for the praise. :)
Yes, I'm creating an Indiana Game with a few other guys but I won't be the lead artist. (We have a much better illustrator)
But it will take some time to finish it, we are currently discussing the plot and starting with the script.
#106
puh, nearly two years since I started this thread.
Anyhow, just a few days ago I found the latest version of the office (made one month after my last post here) on my HDD
and I thought I have to post it (for the sake of completeness).


what's missing: two lamps hanging from the ceiling, artifacts on floor and in the shelves, tablelamp, telephone,...

progress:
#107
a room for Indiana Jones game made some time ago.
It is a bit empty (lamps hanging from the ceiling, artifacts,..), I never finished it.


2x



EDIT:
here you can see the progress:
#108
you can make that long code much shorter:
Code: ags

    if (keycode == eKeyA) {keyPressed = "A"; pkp = 1; if(lastKeyPress == eKeyA) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyB) {keyPressed = "B"; pkp = 1; if(lastKeyPress == eKeyB) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyC) {keyPressed = "C"; pkp = 1; if(lastKeyPress == eKeyC) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyD) {keyPressed = "D"; pkp = 1; if(lastKeyPress == eKeyD) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyE) {keyPressed = "E"; pkp = 1; if(lastKeyPress == eKeyE) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyF) {keyPressed = "F"; pkp = 1; if(lastKeyPress == eKeyF) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyG) {keyPressed = "G"; pkp = 1; if(lastKeyPress == eKeyG) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyH) {keyPressed = "H"; pkp = 1; if(lastKeyPress == eKeyH) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyI) {keyPressed = "I"; pkp = 1; if(lastKeyPress == eKeyI) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyJ) {keyPressed = "J"; pkp = 1; if(lastKeyPress == eKeyJ) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyK) {keyPressed = "K"; pkp = 1; if(lastKeyPress == eKeyK) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyL) {keyPressed = "L"; pkp = 1; if(lastKeyPress == eKeyL) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyM) {keyPressed = "M"; pkp = 1; if(lastKeyPress == eKeyM) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyN) {keyPressed = "N"; pkp = 1; if(lastKeyPress == eKeyN) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyO) {keyPressed = "O"; pkp = 1; if(lastKeyPress == eKeyO) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyP) {keyPressed = "P"; pkp = 1; if(lastKeyPress == eKeyP) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyQ) {keyPressed = "Q"; pkp = 1; if(lastKeyPress == eKeyQ) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyR) {keyPressed = "R"; pkp = 1; if(lastKeyPress == eKeyR) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyS) {keyPressed = "S"; pkp = 1; if(lastKeyPress == eKeyS) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyT) {keyPressed = "T"; pkp = 1; if(lastKeyPress == eKeyT) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyU) {keyPressed = "U"; pkp = 1; if(lastKeyPress == eKeyU) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyV) {keyPressed = "V"; pkp = 1; if(lastKeyPress == eKeyV) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyW) {keyPressed = "W"; pkp = 1; if(lastKeyPress == eKeyW) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyX) {keyPressed = "X"; pkp = 1; if(lastKeyPress == eKeyX) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyY) {keyPressed = "Y"; pkp = 1; if(lastKeyPress == eKeyY) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyZ) {keyPressed = "Z"; pkp = 1; if(lastKeyPress == eKeyZ) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeySpace) {keyPressed = " "; pkp = 1; if(lastKeyPress == eKeySpace) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyBackspace) {keyPressed = "*"; pkp = 1; if(lastKeyPress == eKeyBackspace) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}

using this:
Code: ags

char c = 65;
while (c <= 90) {
  if (keycode == c) {
    keyPressed = c;
    pkp = 1;
  }
  if (lastKeyPress == c) keyPresses++;
  else keyPresses = 3;
  c++;
}
if (keycode == eKeySpace) {keyPressed = " "; pkp = 1; if(lastKeyPress == eKeySpace) {keyPresses++;} else {keyPresses = 3;}}
if (keycode == eKeyBackspace) {keyPressed = "*"; pkp = 1; if(lastKeyPress == eKeyBackspace) {keyPresses++;} else {keyPresses = 3;}}



if you want uppercase and lowercase letters and a custom cursor, I could offer you my code:

first you need these String extenders in your global script:
Code: ags

bool uppercase;
bool keylocker;
int txt_cursor_pos;

String InsertCharAt(this String*, int index, char newChar) {
	if (index < 1 && this.Length < 1)
		return this.AppendChar(newChar);
	String a = "", b = "";
	if (index == 0) a = this.Substring(index, this.Length);
	else a = this.Substring(index, this.Length-1);
	b = this.Truncate(index);
	b = b.AppendChar(newChar);
	b = b.Append(a);
	return b;
}

String DeleteCharsAt(this String*, int index, int length) {
	if (index <= 0 && this.Length <= 0)
		return this;
	else if (index+length > this.Length)
		return this;
	String a = "", b = "";
	a = this.Substring(index+length, this.Length-1);
	b = this.Truncate(index);
	b = b.Append(a);
	return b;
}

then this in your on_key_pressed
Code: ags

if (keycode == 13) { //enter 
	ReactOnInput();
}
if (keycode == 8)  { //backspace
	if (txt_cursor_pos > 0)
	{
		lblUserInput.Text = lblUserInput.Text.DeleteCharsAt(txt_cursor_pos-1);
		txt_cursor_pos--;
	}
	return;
}
if (keycode == 383) { //del-key
	if (txt_cursor_pos < lblUserInput.Text.Length) {
		lblUserInput.Text = lblUserInput.Text.DeleteCharsAt(txt_cursor_pos);
	}
	return;
}
if (gTextCursor.X < 810) { //don't write over the border
	if (keycode == 328 && uppercase) //inverted !{
		lblUserInput.Text = lblUserInput.Text.InsertCharAt(txt_cursor_pos, 161);
		txt_cursor_pos++;
		return;
	}
	if (keycode == 361 && uppercase) //inverted ?{
		lblUserInput.Text = lblUserInput.Text.InsertCharAt(txt_cursor_pos, 191);
		txt_cursor_pos++;
		return;
	}
	if (keycode < 32 || keycode > 256) return; //ignore special codes
	if (keycode < 65 || keycode > 90 && keycode <= 256) { //special characters
		lblUserInput.Text = lblUserInput.Text.InsertCharAt(txt_cursor_pos, keycode);
		txt_cursor_pos++;
		return;
	}
	if (keycode >= 65 && keycode <= 90 && !uppercase) { //lower letters	
		short ascii = keycode + 32;
		lblUserInput.Text = lblUserInput.Text.InsertCharAt(txt_cursor_pos, ascii);
		txt_cursor_pos++;
	}
	else //upper letters	{
		lblUserInput.Text = lblUserInput.Text.InsertCharAt(txt_cursor_pos, keycode); 
		txt_cursor_pos++;
	}
}

so, now we can write but we want to see the cursor, so create a gui that you use for your text cursor and copy this in your rep_exec:
Code: ags

if (IsTimerExpired(1) && !keylocker) { //Cursor blinking animation
	if (gTextCursor.Visible)
		gTextCursor.Visible = false;
	else gTextCursor.Visible = true;
	SetTimer(1, 40);
}
if (textbox_active) //set mouse position when the textbox is activated
{
	gTextCursor.X = lblUserInput.X + GetTextWidth(lblUserInput.Text.Truncate(txt_cursor_pos), eFontUserAnswer);
}
if (IsKeyPressed(403) || IsKeyPressed(404)) uppercase = true;
if (!IsKeyPressed(403) && !IsKeyPressed(404)) uppercase = false;
if (IsKeyPressed(375) && txt_cursor_pos > 0 && !keylocker) //move cursor 1 left
{
	txt_cursor_pos--;
	Wait(5);
}
if (IsKeyPressed(377) && txt_cursor_pos < lblUserInput.Text.Length && !keylocker) //move cursor 1 right
{
	txt_cursor_pos++;
	Wait(5);
}

CapsLock is ignored in this script but you could easily add it.

reset and start the textbox with this:
Code: ags

keylocker=false;
gTextCursor.Visible=true;
txt_cursor_pos=0;
SetTimer(1, 40);

and change your labels name to lblUserInput or all the lblUserInput's in the script to your label name.  ::)
I hope you and others can use it.  :)
#109
yeah true, doesn't make sense to use two labels but in the code you gave me there were 2 labels in use.

I think its not possible to change font size via code. You have to import a different font. Or import a ttf and set its font size at import.
#110
this is oldstyle code. And I assume you are using one of the latest 3.xx AGS versions. So your code needs to be translated.
Quote
if (mouse.Mode == eModeWalkto) lblName.Text = "Go to @OVERHOTSPOT@";   //here you must access the label through its name property, set in the gui editor.
  if (mouse.Mode == 1) lblDifferentLabel.Text = "Look at @OVERHOTSPOT@";
  if (mouse.Mode == 2) lblDifferentLabel.Text = "Interact with @OVERHOTSPOT@";
  if (mouse.Mode == 3) lblDifferentLabel.Text = "Talk to @OVERHOTSPOT@";
  if (mouse.Mode == 4) {
    lblDifferentLabel.Text = String.Format("Use %s with @OVERHOTSPOT@", player.ActiveInventory.Name);
  }
#111
here are some string extenders. Maybe someone can use them.

Code: ags

String InsertCharAt(this String*, int index, char newChar) {
	if (index < 1 && this.Length < 1)
		return this.AppendChar(newChar);
	String a = "", b = "";
	if (index == 0) a = this.Substring(index, this.Length);
	else a = this.Substring(index, this.Length-1);
	b = this.Truncate(index);
	b = b.AppendChar(newChar);
	b = b.Append(a);
	return b;
}

String DeleteCharsAt(this String*, int index, int length){
	if (index <= 0 && this.Length <= 0)
		return this;
	else if (index+length > this.Length)
		return this;
	String a = "", b = "";
	a = this.Substring(index+length, this.Length-1);
	b = this.Truncate(index);
	b = b.Append(a);
	return b;
}

int IndexOfStart(this String*, String sub, int start) {
    if(start >= this.Length - sub.Length) return -1;
    if(start <= 0) return this.Contains(sub);
    String e = this.Substring(start, this.Length - start);
    int i = e.Contains(sub);
    if(i >= 0) i += start;
    return i;
}

int Split(this String*, String separator, String array[]) {
    int n = this.Length;
    int start, stop, i;
    while(start >= 0 && start < n) {
      stop = this.IndexOfStart(separator, start);
      if(stop < 0 || stop > n) stop = n;
      if(stop>start) {
         array[i] = this.Substring(start, stop-start);
         i++;
      }
      start = stop+separator.Length;
    }
    return i;
}
#112
maybe someone can use this log function:

Code: ags

float log(float f) {
	float log = 0.0;
	float t = (f - 1.0) / (f + 1.0);
	int i;
	while  (i < 100)
	{
		log += Maths.RaiseToPower(t, (2.0 * IntToFloat(i) + 1.0)) / (2.0 * IntToFloat(i) + 1.0);
		i++;
	}
	log = log*2.0;
	return log;
}
#113
unfortunately this is not possible in AGS.
If its a very huge array, I would suggest using an external file.
Otherwise you have to
Code: ags

arr[0] = "Alice";
arr[1] = "Bob";
arr[2] = "Carol";
arr[3] = "Daria";
arr[4] = "Eric";
...

You could try and ask in the wishlist (or start a new thread) for an implementation of this in the next AGS version.
#114
The return isn't necessary. There is no code that will be executed after the return.
The return only has a function when there is code after the else statement which shouldn't run if ( cEgo.ActiveInventory == iKey) is true.
#115
this is really great! So many things can be done with this. (hmm... if this could be combined with the Inet plugin=))

just another question: will it be possible to make doors or move objects (like in Wolfenstein)?
#116
why not just
Code: ags

int myLevel;
function on_event (EventType event, int data)  //global script
{
	if (event == eEventGotScore && myLevel < 99)
		myLevel = game.score/5;   //e.g.  score= 9 /5 = 1,8 to int = 1
	
}

Quote
Then whenever you kill a monster, you put the line
GiveScore(1);
#117
error:
if you start typing #XXX (X = random chars) in script editor you get an error.
#118
Quote from: Radiant on Wed 19/11/2008 13:14:41
If a group of lines are selected - TAB to indent, Shift-TAB to dedent.
This is already possible.
#119
I used adobe audition and its a wave file. Anyone knows whats the real maximum kbps for sound?
#120
is there a maximum kbps for sound files or is this a bug in the new version? I can't play soundfiles with 3072kbps. I lowered the rate of the wave file down to 128kbps and now it works in the game (of course with bad quality since its 128kbps).
SMF spam blocked by CleanTalk