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

#2701
If the inventory window is smaller than the inventory items, they won't be displayed.
Try either resizing the inventory or fiddle around with the SetInvDimensions function.
#2702
Aside from all the great ideas and scripts I've found after browsing through the whole beginners and technical forum, I noticed the small things either not in the manual or easy to miss.
I've just sorted through my notes and thought I'd post what I've found, maybe some of you will find this useful at some point or another:

1.) RickJ: "The character's global inventory variables are integers and can be used to keep track of how many items the character has."
Thread

2.) inFERNo: "...every interaction in the [interaction menu] list is executed first, the run script always when all others are done."
Thread

3.) CJ: "RunInventoryInteraction (...) doesn't get run immediately - instead, it gets run when the calling script finishes."
Thread

4.) CJ: "Local room scripts have their data segment saved when the room is destroyed, so all variables retain their values.
I would recommend placing variables that are only needed by one room into that room script, in order to avoid clutter in the global script."
Thread
Comment: Useful to store the condition of a light switch, for example.

5.) CJ: "To totally revert to default fonts, close AGS and then delete any agsfntXX.wfn or agsfntXX.ttf files from the game folder."
Thread

6.) CJ: "(...) to ensure [the pathfinder] always works, your walkable areas should always be at least 3 pixels wide."
Thread

7.) Gilbot: "Sprite datas are always stored in the basic executable, the splitted resources only contain room data."
Thread

8.) CJ: "The maximum room height is 1400 pixels (at 320x200 resolution - you could have a 2800-tall 640x400 room)."
Thread

9.) CJ: "(...) in fact, [calling game.exe --setup] is all that the winsetup.exe program does."
Thread

10.) CJ: "You can rename winsetup.exe to anything you like, it will still work."
Thread?

11.) CJ: "(...) AGS doesn't actually use [Media Player] itself [to play avi videos], but it uses the same [DirectShow] that MP does."
Thread

12.) CJ: "(...) ReleaseCharacterView doesn't change the loop number back, so he will go to facing in whichever direction the loop that was playing in the animation was."
Thread

13.) CJ: "FaceLocation will only allow [a character] to face directions which he can actually walk in."
Thread

14.) CJ: "FaceCharacter/FaceLocation don't update the screen, you have to put a Wait(1); afterwards if you want that to happen."
Thread

15.) ???: "When using a NewRoom() or NewRoomEx() (...) AGS finishes the remaining lines in the script and then goes to the new room.
You can use 'return;' to abort the rest of the script.
____NewRoom(5);
____return;
will prevent the rest of the script running first."

16.) Scorpiorus: "(...) the [RunDialog command] is always started last."
Thread

17.) Scoriporus: "(...) [if music disabled or no sound card] GetMP3PosMills() always returns 0 (...)"
Thread

18.) ??? "(...) (music, sprites) are left 'as-is', so it's a good idea to use MP3's where you can."


The following may be obvious to experienced programmers, but I find it worth mentioning:

19.) Character to mask quotemarks in strings: \
Example: Display("These are called \"quotemarks\" ");

20.) Character for a line break in strings: [
Example: Display("Adventure Game Studio [ [ Copyright 1995-2004 Chris Jones");


As you can see I have numbered all of the above so feel free to comment, confirm or deny in regard to newer versions.

Do you have anything similar to add?
#2703
Excellent. Good work with the function!

Glad I could help.  :)
#2704
Alright, so try this:

Global script

Top of global script:

int walkto=-1;

end of global script:

export walkto;

on_mouse_click function:

walkto=-1; // stop queued action commands

Script header

import int walkto;

Room script

Repeatedly_execute for room script (Note: it's not named "repeatedly_execute"):

if (player.walking==0) { // player has finished walking
if (walkto > -1) { // player has reached a door
if (walkto==1) { // if door is hotspot 1
MoveCharacterBlocking(GetPlayerCharacter(), x2, y2,1);
walkto=-1; // reset variable
}
else if (walkto==2) { // if door is hotspot 2
MoveCharacterBlocking(GetPlayerCharacter(), x3, y3,1);
walkto=-1; // reset variable
}
}
}

You could put the above in the global script rep_ex, but as I said depending on how many rooms/doors you have, it may get a bit crowded in there. If you DO put it in the global script, the walkto variable has to be assigned a unique number for every hotspot in the game!

In the "Any click" for each hotspot:

MoveCharacter(EGO,GetHotspotPointX(1),GetHotspotPointY(1)); // move ego to hotspot 1 non-blocking
walkto=1; // execute action 1 after ego reached hotspot

Is this what you were looking for?
#2705
Beginners' Technical Questions / Re:Music
Thu 05/02/2004 13:02:59
Is it possible most beginners have the windows default "Hide file extensions for known file types" enabled?
When they rename their music files to music1.mid for example the file is actually called music1.mid.mid and therefore isn't played? Or does AGS compensate for that?
Just wondering...
#2706
QuoteI want to make a global function for it so that I won't have to write the same code for the same thing in every room...

As I said, I don't think it's possible to stop a script without blocking.

Could you elaborate what x2 and y2

MoveCharacterBlocking(GetPlayerCharacter(), x2, y2,1);

this refers to? Where is point B? Is it the same in every room or specific to the hotspot?
#2707
QuoteHope we all helped, especially Gilbot.

Yeah, I really appreciate it! Thank you!
#2708
I've remembered I put that line there because the right-mouse-button-cycles-cursor-modes had to work with the inventory too.

My on_event function just looks like this now:

 if (event==GUI_MDOWN) {
  if (IsButtonDown(RIGHT)==1)
     myInterfaceClick(data,GetGUIObjectAt(mouse.x,mouse.y),2); // call custom interfaceclick function
  else if (IsButtonDown(LEFT)==1)
     myInterfaceClick(data,GetGUIObjectAt(mouse.x,mouse.y),1); // call custom interfaceclick function
 }

Basically I've removed the normal interface_click function and replaced it with my own myInterfaceClick.
The important thing is, the on_event function is called by inventory items and the inventory area as well, so this approach now works across the whole gui.
Man, I'm happy the way it turned out.  :D
#2709
While the problem may be related, I think

interface_click (data,GUIButton);

was the bad line here though. You see, pressing the left mouse button sets GUIButton to 1. Since the interface_click function has the parameters GUI and BUTTON (not MOUSE button, but object number), it's reasonable to assume this has something to do with it.
I'm in the middle of rewriting this whole part, so I can't make certain, but maybe your bug report was a bit premature.
I don't like bothering CJ with stuff that is most likely not his fault because I know the feeling. :)
So sorry CJ if this turns out to be my bad.
#2710
I've upped the file again, and you're right, correcting that comment helped.

However, I'm not sure the line I posted above is not somehow to blame too. Looking deeper into my script (which has been put together from various posts and whatnot), I'm not quite convinced the behavior wasn't due to some fault of mine.

But, who am I to argue? ;)
#2711
For everyone who took a look at it, ignore the "if (interface == 9)" it was from my testing.
Anyway, I've found the culprit myself:

on_event function
if (event==GUI_MUP)
interface_click (data,GUIButton);

I don't know where this came from, it was from fooling around earlier I guess, it doesn't even make sense...  :P

So thanks everybody for listening, but deleting this part helped.
#2712
Quoteare you sure that the size of button won't cover up the whole GUI?

Absolutely, the buttons are the default ones, nothing changed.

QuoteIf all attempts failed, maybe you can zip the files and upload them for us to check it for you (just the 3 files editor.dat, acsprset.spr and ac2game.dta are enough I think)

That would be great. Get it here.

Thanks a lot!
#2713
Nope, nothing happens if I comment out QuitGame(0); and put a Display("test"); in the other button's script.
It's so strange since everything else works perfectly fine.
#2714
Sorry for the late reply, but I had to gather my strength for all this text: ;)

As I understand it, AGS can't run two scripts at the same time, so it would be blocking either way, since no clicks could be processed while the script waits.

I use this workaround:

I've defined four variables in the global script

short lookat = -1; // storing what/who to look at next
short interact = -1; // storing what/who to interact with next
short talkto = -1; // storing what/who to talk to next
short use = -1; // storing what/who to use active inventory with

which I export of the end of the global script

export lookat,interact,talkto,use;

and import them into the script header, so they can be used in all (room) scripts too

import short lookat;
import short interact;
import short talkto;
import short use;

Now, if the user clicks on an object for example, I put

MoveCharacter(EGO,GetObjectX(0),GetObjectY(0)); // move ego to blue cup
lookat=ID_BLUECUP; // look at blue cup when ego finished walking there

in there. Note that 0 is the number of the object you want the action for.
ID_BLUCUP is defined at the beginning of the room script as

#define ID_BLUECUP    201

It is 201 in this example, but basically just has to be a unique number to differentiate all objects/hotspots/characters. Be sure to assign unique numbers to all objects/hotspots/characters.
For example, I use
numbers 101+ for hotspots
numbers 201+ for objects
numbers 301+ for characters
and numbers 501+ for inventory items.
This is important, because the action variables will be checked by both room and global script.

Now, to check if EGO has reached his destination, I use the repeatedly_execute of the room script

if (player.walking==0) { // player has finished walking
if (lookat > -1) { // player has to look at something
if (lookat==ID_BLUECUP) { // set by clicking on the object
lookat=-1; // reset variable
DisplaySpeech(EGO,"My, it's a blue cup!");
}
}

Note that in order for this to work, you also have to reset all variables when the user clicks the mouse, so he doesn't look at the cup when he finished walking although the user moved him somewhere else. So put in the global on_mouse_click function

...
else if (button==LEFT) {
...
lookat=-1; // stop queued look commands
interact=-1; // stop queued interact commands
talkto=-1; // stop queued talk commands
use=-1; // stop queued use inventory commands
...
ProcessClick(mouse.x, mouse.y,GetCursorMode());
...

That's it basically. Characters are handled in the global script, so you may want to put in its repeatedly_execute function

if (player.walking==0) { // player has finished walking
if (talkto > -1) {
  if (talkto==ID_MAN) {
     talkto=-1;
     FaceCharacter(EGO,MAN);
     RunDialog(1);
  }
}
}

You could of course put the room's repeatedly_execute stuff in the global script, but depending on how many rooms you're going to use, it may get a bit crowded in there. So I decided to handle objects and hotspots in the room script only.

Phew, my longest post ever. Now I'm exhausted. :P

Hope this helps  :)

strazer

P.S. This works for unhandled events too, just use

#define ALLOBJECTS 200

for example and script the appropriate actions in the unhandled_event function.

EDIT

Hm, re-reading the original question I may have gone overboard a bit. Sorry if this doesn't answer your question directly, but it should give you an idea on how to accomplish what you're trying to do.
Anyway, it fits the thread title quite well I think, so maybe it will be of some help to someone else looking for ideas.
#2715
QuoteTry changing the line to QuitGame(1); and see if that quitting game behaviour was indeed caused by executing that line.

I assumed it was since it was quitting without any message at all, but yes, QuitGame(1); confirms it is that line that gets executed.

I've just tried it with a new gui, same settings, except I forgot to set the buttons to "Run Script" at first, but they executed the line anyway. ???

It's a simple gui, one label (object 0), two buttons (1 and 2), that's all.
I don't get it...
#2716
No change. :(

But in a strange way it pleases me that it baffles the elders as much as me. ;D

I read a post of Spyros where he mentioned he uses UltraEdit to check brackets, so I downloaded the trial version and checked the entire global script. Everything seems to be in order.

I'll recreate the gui and see if it helps.
#2717
I suggest creating a transparent GUI (background color 0), put a label on it and set the label text to "@OVERHOTSPOT@" (without quotes).
Then in the "repeatedly_execute" function of the global script, put

SetGUIPosition(YOURGUINUMBERHERE,mouse.x,mouse.y);

Move the label on the gui until it's as far away from the cursor as you like. That's it.

While the encompassing hotspot is a good workaround, I think this is better. It's what I use anyway.
#2718
The game is fine and the graphics of the enhanced version are perfectly fine too IMO:


from MobyGames
#2719
No change.  :(

Quoteare both buttons set to "Run script" letf click action

Yep, as stated above.

Thanks for the reply though!
#2720
Quote
I also tried to make an effect when my character receives an item. That, also, doesn't seem to work.

You can have a sound played whenever something is added to the inventory, with script.

Go to menu "Script" -> "Edit global script..." and  check if there is already a function named "on_event".
If not, just copy and paste the following in the global script:

function on_event (int event,int data) {
 if (event==ADD_INVENTORY) { // something added to inventory
   PlaySound(1); // plays sound effect no. 1
 }

}

If there is already an on_event function, just copy the bold lines in there.
SMF spam blocked by CleanTalk