I solved my first problem but now I have a new one.
I made a quick animation and set it to the end of all the other interactions. But the aneimations runs before everything else. Is there any way to fix this.
The run script you see is for moving the character from a room to the room with the interacted hotspot. This is how the interactins look like:
(http://www.2dadventure.com/ags/interactionseditor.png)
Try modifying http://www.agsforums.com/yabb/index.php?topic=14881.0 for your needs.
is there any other posible way then scripting. I have no idea what half of those sntences mean.
No.
But it's not that difficult:
Global script
function DisplayMessageAt (int message_number, int x, int y) { // create custom function
string message; // declare variable that holds the message text
GetMessageText(message_number, message); // put message text in variable
DisplayAt(x, y, GetTextWidth(message, 0), message) // display message text at specified coordinates
}
Script header
import function DisplayMessageAt (int message_number, int x, int y); // import function so it can be used in all rooms
Now whenever you need to display a message at certain coordinates, you choose the "Run script" action and write
DisplayMessageAt(7, 100, 200); // display message 7 at x=100 and y=200
Thanks for the help. But where exactly should I put this script into? Does it really matter where I put it in? Because the script is devided into sections.
Menu "Script" -> "Edit global script..."
// main global script file
function DisplayMessageAt (int message_number, int x, int y) { // create custom function
string message; // declare variable that holds the message text
GetMessageText(message_number, message); // put message text in variable
DisplayAt(x, y, GetTextWidth(message, 0), message) // display message text at specified coordinates
}
#sectionstart game_start // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
...
"Script" -> "Edit script header..."
// Main header script - this will be included into every script in
// the game (local and global). Do not place functions here; rather,
// place import definitions and #define names here to be used by all
// scripts.
import function DisplayMessageAt (int message_number, int x, int y); // import function so it can be used in all rooms
thanks. I'm going to try this right away.
I tried doing this but this is what poped up:
(http://www.2dadventure.com/ags/scripterror.PNG)
and this is what the script looks like now and the // main global script file is not missing. I just made a little goof when I copied the picture.
(http://www.2dadventure.com/ags/script.PNG)
The error message is correct, I missed the ";" , sorry.
Change
DisplayAt(x, y, GetTextWidth(message, 0), message) // display message text at specified coordinates
to
DisplayAt(x, y, GetTextWidth(message, 0), message); // display message text at specified coordinates
now that that's working. I have a nother problem. Use global mesages. And When I look at an object, the mesage does not display. What gives.
Do you mean the global message isn't displayed when you use this custom function?
If not, how do you display the message?
With the interaction editor? If so, what conditions/actions did you choose?
If you use script, what is the script code you use?
You must remember to provide more information, we're not psychic you know. :)
Sorry. I use the interactions menu. No scripting. I just tipe in the mesage in the global mesages pan.Ã,Â
The actual problem is that I want the mesage to be displayed in front of the inventory. Now when I try to read the mesage (with out the script you prowided)Ã, the mesage is displayed behind all the objects in the inventory.
I needed this script so that I could position the mesages in the top right corner of the screen (there are no objects there so you could read the mesage)
If there is any other solution to this problem I'm all ears.
1. Do you mean you have an inventory GUI turned on and a global message is displayed behind it?
3. Can you post the interaction and the exact sequence of interaction commands you use?
2. Can you provide a screenshot to demonstrate the problem?
no problem herre is all the info:
1. yes
2. In the inventory items I use interact with item. Then Look at item/ display mesage. Then I edit the mesage in the global mesages pane (if i misunderstood please forgive me)
3. here is the screen shot:
(http://www.2dadventure.com/ags/guiproblem.png)
Ah, I see want's happening - you probably have an 'always display text as speech' option turned on. And thus the text is displayed as an overlay and the overlays are always behind any GUI.
A workaround is, as follows:
Open GUI editor and create a new GUI, name it TEXTGUI
Set GUIs width to 200 and height to 100
Set GUIs visible property to Popup Modal
Next, add a Label control
Set label's properties (x:0, y:0, width:200, height:100, TextColor:4)
Finally, set GUIs background and foreground colour to 0 (thus we will only see a text and not the GUI itself)
Now, open the main global script and add the following lines at the top:
function DisplayText(int message_number, int x, int y) {
int gui = TEXTGUI;
SetGUIZOrder(gui, 1000);
string text;
GetMessageText(message_number, text);
SetLabelText(gui, 0, text);
SetGUIPosition(gui, x ,y);
GUIOn(gui);
while (WaitMouseKey(100)==0) { }
GUIOff(gui);
Wait(1);
}
Next, to the script header:
import function DisplayText(int message_number, int x, int y);
So, now open interaction editor and replace Display message action with RunScript, next press EditScript... button and add a function call:
DisplayText(MESSAGE_NUMBER_HERE, X_POSITION_HERE, Y_POSITION_HERE);
See if it works and let us know ;)
It did work. Thanks guys. This was realy buging me. The problem was that I realy needed a mesage to be displayed in the inventory becous without that an adventure game just isnt an adventure game.
QuoteBut the aneimations runs before everything else.
This is by design.
"Run script" (and "Run dialog" as well?) actions are always executed last.
You could put the scripting equivalent (SetCharacterView, AnimateCharacter, ReleaseCharacterView) at the end of the "Run script" action.
Btw, I'm no moderator, but please don't edit the thread if you have additional unrelated questions.
How are people supposed to find this thread if they experience similar problems? Better start a new thread or add another post to the bottom.
I don't exactly understand what you mean. What exactly am I supose to put in the script. Sorry if i'm anoying but I vould finaly like to make a game with animations and I don't know how. Please be patient with me.
And about the editing. Some people say that I should just edit my previus post some people say I shouldn't. What am I supose to do?
What people mean is that if you want to add a post that directly follows another post by yourself, you better edit that previous post and add what you want to add.
As for your problem, select the "Run script" action and press the "Edit script" button.
At the end of the script, put the following lines:
SetCharacterView(CHARACTERHERE, VIEWNUMBERHERE);
AnimateCharacter(CHARACTERHERE, LOOPHERE, DELAYHERE, REPEATHERE);
ReleaseCharacterView(CHARACTERHERE);
and replace the *HERE parameters with the values you used in the "Quick animation" action. (Check the manual!)
After you're done, you can remove the "Quick animation" action.
Edit:
Forgot a parameter for SetCharacterView
Look I'll post a new thread (sorry about that). But i still don't understand what you mean.Ã, I made the script but don't understand the other parts.