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

#101
Your code reads as:
Code: ags
function unhandled_event(int what, int type) {
  if (what == 2) { // If "what" is 2
  }
  else { // If "what" is anything other that 2
    if (what == 2){ // If "what" is 2
    }
  }
}

Yeah, I can see how that's not working...

Khris gave you the correct structure earlier.

Code: ags
if (what == 1) {
  if (type==1) {
  }
  else if (type==2) {
  }
  // ...
else if (what==2) {
  if (type==1) {
  }
  else if (type==2) {
  }
  // ...
}
// ...
#102
To define a function, you do it like that:
Code: ags
function myFunction() {
  // code
}


You can then call it from inside another function:
Code: ags
function OtherFunction() {
  myFunction();
  // Something else
}


writing on_key_press(KeyCode eKeyF5) {} has no meaning. To call the on_key_press function from inside another function, you'd do it like that:
Code: ags
function myFunction() {
  on_key_press(eKeyEscape);
}

It will run the on_key_press function with eKeyEscape passed as an argument (i.e. as if you'd pressed the Escape key).

To do what you want in the repeatedly_execute_always function, you need to set up some conditions to check whether a key has been pressed.
Code: ags
function myFunction() {
  if (IsKeyPressed(eKeyEscape)==1) { // if Escape key is pressed
    // Code
  }
}

There could be some issues in proceeding like that, though. repeatedly_execute_always loops 40 times per second, you could end up triggereing some conditions multiple times.

Finally, the error message you get means you tried to call the on_key_press function before it was defined.
#103
QuoteTry setting the label's text in the editor; it doesn't need to be set every game loop.
I'm using the same label for characters and objects, so it needs to be set in a loop.

Anyway, setting the text in the editor to work with hotspots did nothing to improve matters. Using GetLocationName does, though. That's actually easier, I can use one single condition for any interaction now.

Thanks Kris.
#104
Hey, me again.

I'm setting up a simple system where hotspot names are displayed nex to the mouse cursor. I have a problem to check whether the label would end past the right edge of the screen.

Here's the relevant code from my repeatedly_execute function :

Code: ags
lblHotspotLabel.Text = String.Format("@OVERHOTSPOT@");
largeur = GetTextWidth(lblHotspotLabel.Text, eFontTahomaOutline);
lblItemLabel.Text = String.Format("%d", largeur);
if (mouse.x+largeur >= 800) 
  gLabels.SetPosition(mouse.x - largeur, mouse.y + 15);
else gLabels.SetPosition(mouse.x + 10, mouse.y + 15);
gLabels.Visible = true;


largeur is always equal to 109 no matter what's under the mouse cursor. (Well, it changes if I change the font passed as an argument for GetTextWidth.)
I've tried various things, like pass String.Format("@OVERHOTSPOT@") or String.Format("%s", lblHotspotLabel.Text) as arguments for the GetTextWidth function but to no avail. The label, on the other hand, displays the correct text.

What am I doing wrong?
#105
QuoteI was thinking of Princess Diana, and it came up with someone called "Lolo Ferrari".
It was a porn actress, quite famous for having the biggest breasts in the world. The confusion is quite funny.

It knows Barbapapa, I'm happy.
#106
It would be better to customise the function used for speech.

function Whatever(this Character*) {
myGui.SetPosition
myNameLabel.Text = this.Name
this.Say("Hello there !")
}

General outline, not legit code. Don't copy/paste but do look up GUI functions and extender functions in the manual.

Maybe it can be done with an Overlay, to avoid having one more GUI. I haven't read up on text overlays.
#107
QuoteAlso, "nuclear weapon" doesn't mean it's not something with antimatter, as that page says.
From my limited knowledge, it kind of does. Referring to a weapon as "nuclear" means it's relying on atoms breaking or fusioning, not on antimatter and matter to go "kaboom".

Anyway, that was just a nitpick, I'm happy with magical highly advanced bombs detroying the Earth.
#108
Nice. I'm always happy to play text-based adventures.

Slight nitpick: what do you mean by "the world will be destroyed"? If we were to detonate all the nuclear bombs on the planet right this instant, the Earth would barely feel a thing.
For reference and because it's funny: http://qntm.org/?destroy

As for C64 sounds, maybe there's a way to convert SID files to something usable by AGS? I don't know, really, but it might be a starting point.
#109
I know I'm going to sound like a buzzkill but I find your backgrounds painful to look at. (Literally. I get a headache if I stare for too long.) I think it would look a lot better if you cleaned up your black lines, which are currently full of white pixels.

Besides, your map mansion is very clean, obviously not hand drawn. Is that going to appear in-game ? Mixing such wildly different styles could end up looking rather odd.

Just my opinion, feel free to ignore.
(Addendum : I love Cluedo. Though how they couldn't figure out where the crime scene  and what the murder weapon were by just looking at the body is still beyond me.)
#110
I just tried it myself. It works fine, but Walkable Area 1 is yellow rather than blue for me. Maybe that's what's confusing you ?
#111
Hm, hi ?

My name is Sandrine, I'm 22 (what's the average age 'round here?) and I live in Paris. I kind of started a game, but I'm still pretty much tinkering with AGS for now. I can manage scripting easily enough but I take far too long to draw anything. So I should have a demo available in roughly 40~50 years.

I'd like to say that I'm a good writer, but my modest talent might not translate so well to foreign languages, such as English. ^^'
#112
Nah, that's written correctly.

Is the import written in the header of the script where the function is defined ? Do the coordinates (330, 500) in room 3 actually exist ? Just random ideas, I haven't studied the script in detail.
#113
Thankies.

I'll go down the GUI road, it's used all over the game to make my dialogs look all pretty. I wont bother with a button, though, setting myGui.BackgroundGraphic should work just as well.

Still, I wonder what means the sentence I quoted from the manual? Is there a way to make a fade in using DrawingSurface or not? As a side note, I don't really get what Overlays would be useful for, their properties seem rather limited.
#114
So, I'd like to make a picture fade in on top of the background of a room and later fade out. I first thought of using an Overlay but I didn't see anything about setting transparency for these. So then I looked at DrawingSurface. And I found that :

QuoteTIP: If you want to gradually fade in a second background, create a copy of the original surface and then restore it after each iteration, otherwise the backgrounds will converge too quickly.

lol wut?
Iterations of what ?

Thanks for your help.
#115
First thing, you have a int for that serves as a counter. It might be a good idea to set a starting value for it. int for = 1, or something.

Then, I don't really understand your AddEmptyLines function. It's supposed to add three line breaks (one in each label that isn't the one passed as an argument) each time your while loop takes place ?

I find your second function equally confusing, but I think I need to read up on GetTextHeight.

My question is : What are you trying to do ?
#116
That's set to true.

Actually, after more testing, I've found the cause. I had to import the background image for the GUI without using its alpha channel. It's odd that this would have an incidence as I don't have any transparent pixels on this particular image. If anybody has any info on how that works...

Well, at least everything works as it should now.

Thanks for your time, Khris.
#117
I'd like to have a save GUI consisting of four slots represented by the screenshots of the respective saves. For that, I call this function upon loading the GUI :

Code: ags
function show_save_game_dialog() {
  gSaveGame.Centre();
  gSaveGame.Visible = true;
  int i = 1;
  
  while (i <= 4) {
    screenshot[i-1] = DynamicSprite.CreateFromSaveGame(i, 128, 96);
    GUIControl *control = gSaveGame.Controls[i];
    if (screenshot[i-1] != null) {
      control.AsButton.NormalGraphic = screenshot[i-1].Graphic;
    }
    i++;
  }
  mouse.UseModeGraphic(eModePointer);
  gInventory.Visible = false;
}


screenshot is defined by DynamicSprite* screenshot[4];

When I run this, the place where the screenshots should be is transparent : I can see the background of the room. The game is properly saved in each slot and I can restore them without problem.

Any suggestion is welcome.
SMF spam blocked by CleanTalk