i am a little ashamed that i am such a "nudnik" and i feel very silly about all this questions which 12 years old children can answer (since i can be their grandmother) and after i used the help of jinny and scorpious this is the right script.
// room script file
string sequence;
function hotspot13_a() {
// script for hotspot13: Use inventory on hotspot
int itemused = character[GetPlayerCharacter()].activeinv;
//not neccessary, just for convenience
//this will store the item number that was used
if ((GetGlobalInt(4) == 0) && (itemused == 26)) {
//if the first item in the sequence was used
LoseInventory(26);
String sequence++;
Display("you have in the pot full glass of orangejuice");
}
else if ((GetGlobalInt(4); == 1) && (itemused == 21)) {
//if the second item in the sequence was used
LoseInventory(21);
sequence++;
Display("you have in the pot grounded wheat");
}
else if ((GetGlobalInt(4); == 2) && (itemused == 22)) {
//if the third item in the sequence was used
LoseInventory(22);
sequence++;
Display("You have in the pot coconut milk");
}
else if ((GetGlobalInt(4); == 3) && (itemused == 18) {
//if the fourth item in the sequence was used
LoseInventory(18);
sequence++;
Display("you have in the pot the honey");
}
if (StrLen(sequence) < 4) {
int item = character[GetPlayerCharacter()].activeinv;
Display("put %d", item);
StrFormat(sequence, "%s%d", sequence, item);
if (StrLen(sequence) == 5) {
if (StrCaseComp(sequence, "26212218")==0) {
Display("very good - you've made the medicin");
} else {
Display("nothing happen");
StrCopy(sequence, "");
}
}
}
}
function room_a() {
// script for room: Player enters screen (before fadein)
StrCopy(sequence, "");
}
but all the time there are mistakes that i can not understand. like "string not define" and so. may be the script man among you can fix it?
i want to finish my game which i am very proud of (i download the ags only 3 weeks ago and overcome a lot of problems myself - and i read very carfully all the turitorials including gui and lots of things i cannot understand. when i see the questions of others and the answers i am so envey......) i hope i would be able to help others too.
well i can tell you becouse i am a woman i alow myself even to cry of anger. but i hope someone nice young guys will fix it for me!!!!
well, sorry for talking so much.
dikla
P.S. i am not reading it again. whatever will be will be.
Well, what are the exact errors?
Oh wait, I see them. Check out the Beginners' FAQ (www.rain-day.com/harbinger/faq) for the section about variables. use that to correctly declare strings, etc.
pls - i dont understand too much about scripting. when i write
in the global script "int sequence" it says: "unexepted string" which is the next row as you can see in the script.
pls write to me the 2 first lines. since i did not scripted this script but copied it and changed the item's no. i dont know what "string sequence" mean (unless i know that string is not int. pls correct it.
dikla
Ah, I see you combined both Ginny's and my scripts. Sorry for not making it clear enough but they are a bit different approachs to solve the same problem. So you can use either one or another but not both together.
I see that you changed the numbers in the script I posted:
if (StrCaseComp(sequence, "26212218")==0)....
I suppose they are items numbered 26, 21, 22 and 18 respectively. But it's another matter than just 1,2,3,4,5 because this way you can use items 262, 12, 21, 8 and it will work too, unfortunately.
Therefore here is a slightly improved version of the code I posted before:
// room script file
string sequence;
string correct;
function StrGetNumDots(string text) {
int i=0, num=0;
while (i<StrLen(text)) {
if (StrGetCharAt(text, i)=='.') num++;
i++;
}
return num;
}
function hotspot13_a() {
Ã, // script for hotspot13: Use inventory on hotspot
if (StrGetNumDots(sequence) < StrGetNumDots(correct)) {
int item = character[GetPlayerCharacter()].activeinv;
string itemName;
GetInvName(item, itemName);
Display("put %s", itemName);
StrFormat(sequence, "%s%d.", sequence, item);
if (StrGetNumDots(sequence) == StrGetNumDots(correct)) {
if (StrCaseComp(sequence, correct)==0) {
Display("very good - you've made the medicin");
} else {
Display("nothing happen");
StrCopy(sequence, "");
}
}
}
Ã,Â
}
function room_a() {
Ã, Ã, // script for room: Player enters screen (before fadein)
StrCopy(sequence, "");
StrCopy(correct, "26.21.22.18."); // specify the correct order of items here (*each number has to be followed by a dot!*)
Ã,Â
}
See if it works and let us know ;)
my dearest! you made me happy! it work very very good. i am so happy i cant tell you how much.
i have another problem - i didnt creat the bottle medicie yet. how do i put in "addinventoryitem"? or what - so i can give the inventory the medicin?
b. it said the name that i call the inventory item. but "halfcocnut" should be "very special milk" so do i have to change it in the inventory name? or ican change it in the script? i think that it is in the inventory. ist's it?
but it work so well. i am so happy. thank you thank you.
while we on it, may be u can realy help me. i need to add to my inventory the errows up and down ( 4 and 5 buttons in the gui) but i have the script in my gui for inventory. so why i dont see it when the player open the inventory so he can scroll up and down?
thank you again dikla
You're welcome :)
Quote from: dikla on Wed 12/05/2004 23:10:52i have another problem - i didnt creat the bottle medicie yet. how do i put in "addinventoryitem"? or what - so i can give the inventory the medicin?
That's quite easy, put an AddInventory() function with the inventory item number specified just after the Display("very good...."):
if (StrCaseComp(sequence, correct)==0) {
Display("very good - you've made the medicin");
AddInventory(MEDICIN_ITEM_NUMBER_HERE);} else {...
Quoteb. it said the name that i call the inventory item. but "halfcocnut" should be "very special milk" so do i have to change it in the inventory name? or ican change it in the script? i think that it is in the inventory. ist's it?
Yeah, it takes the name of the inventory item from the editor and displays it. But if you want it to display another alternative name then add the following line:
int item = character[GetPlayerCharacter()].activeinv;
string itemName;
GetInvName(item, itemName);
if (StrCaseComp(itemName, "halfcocnut")==0) StrCopy(itemName, "very special milk");Display("put %s", itemName);
StrFormat(sequence, "%s%d.", sequence, item);
Quotewhile we on it, may be you can realy help me. i need to add to my inventory the errows up and down ( 4 and 5 buttons in the gui) but i have the script in my gui for inventory. so why i dont see it when the player open the inventory so he can scroll up and down?
Do you mean you don't see these scroll buttons or the GUI itself?
no. i see the line in the script of gui. my inventory is custom one, but in my inventory i can not see the arrows up and down, so all i see is 8 items 4 in each row 2 rows and that it. if u collect other items you dont see it in the inventory. how can i add arrows?
thanks, dikla
As I understand your custom inventory GUI is displayed correctly but you do not see the scroll arrows, although you did add two buttons (to represent arrows) onto the inventory gui, right?
If that is it, try the next:
open the GUI editor, choose your inventory gui, select one of the scroll buttons and remove its image.
To remove button's image double click on the Image property and you'll find yourself in the sprite editor. Now select the sprite number 0 (an AGS magic blue cap :)). Btw, it's the very first sprite in the Sprite Editor's main folder. As a result the scroll button would appear with no image.
Then just test the game and see if it is displayed at all (with no image at least) :P
How does it go?
now i know the problem. i can use the arrows when i open my invetory during the game. but the are far away you cant see it. just touch it with the mouse.
i think the problem is that the errow is black!!! that is why i dont see it. if i could change the color to grey or something....
i see the empty images no. 1 and 4 and it is seems to be empty. but i am sure it is because they are black. what should i do>
thanks dikla
Heh, yeah. I did suspect they are just invisible. What color is your inventory GUI background, is it black?
I think somebody already had the exactly same problem with the scrolling buttons.
You can solve it by redrawing those sprites (1st and 4th) and then replacing the old ones.
But, out of curiosity, what color depth is your game designed at, hi-color or 256-colour?
i use 16 colors ,
i tried changing the background color , it didnt help
also i didnt understand the answer that someone got
thats why i posted
when i changes the GUIs->inventory (moved the ok botton and the magnifying glass botton possition X\Y)
it did not change in the game (maybe thats the real problem ??)
Quote from: dikla on Thu 13/05/2004 20:07:30
i use 16 colors ,
You mean 16bit (i.e. hi-color)? Or you use the palette? You can check it in the AGS editor's palette section.
Quotealso i didnt understand the answer that someone got
thats why i posted
I remember that answer didn't resolve the problem, so I'm trying to replicate the arrows problem to find out what's wrong.
Quotewhen i changes the GUIs->inventory (moved the ok botton and the magnifying glass botton possition X\Y)
it did not change in the game (maybe thats the real problem ??)
hmm... that's strange. Try delete your game's exe file from the gamename\COMPILED folder and then test again.
first of all it 16 colors no 16bit
i del' the exe file - didnt help
waiting for a new answer
tnkx in adv'
Quote from: dikla on Thu 13/05/2004 20:28:00first of all it 16 colors no 16bit
Could you run the game and hit Ctrl-V. What does
"Running: ......" line say?
Btw, what AGS version do you use?
Quote from: Scorpiorus on Thu 13/05/2004 20:16:45
Quotealso i didnt understand the answer that someone got
thats why i posted
I remember that answer didn't resolve the problem, so I'm trying to replicate the arrows problem to find out what's wrong.
Here is that thread, btw http://www.agsforums.com/yabb/index.php?topic=11456.0 I wonder if he managed to solve that thing.
Try running the game in a windowed mode, what about the arrows then?
running 320x200 at 16-bit
mod/xm [;auer doscarded
i can tell you that i read the link you gave me it made me more confused. i saw you gave someone soloution that he was pleased with but do i have to put it in global script instead of the 4 and 5 bottons?
my version is 2.60.698
by the way - is it a bug in the ags? because it cant be that i am the only one that does not see the arrows. they should come when i open the inventory with 8 items.
i cant move the arrows at all.
as someone said before me - iam loosing my heir turning bold almost. because if i dont fix the problem i can kiss goodby my game...
hellllllllllllllllllp.. dikla
Heh, don't panic I believe it's sort out-able. ;)
Could you sent me some of your project files, for me to look into? I need then ac2game.dta and editor.dat.
ive send it to your email - thanks dikla
Ok, open the main global script and find the next function:
function show_inventory_window () {
Ã, // This demonstrates both types of inventory window - the first part is how to
Ã, // show the built-in inventory window, the second part uses the custom one.
Ã, // Un-comment one section or the other below.
Ã,Â
Ã, // ** DEFAULT INVENTORY WINDOW
Ã, InventoryScreen();Ã, <--------- comment out this line
/* <--------- remove this
Ã, // ** CUSTOM INVENTORY WINDOW
Ã, GUIOn (INVENTORY);Ã,Â
Ã, // switch to the Use cursor (to select items with)
Ã, SetCursorMode (MODE_USE);
Ã, // But, override the appearance to look like the arrow
Ã, SetMouseCursor (6);
*/ <--------- remove this
}
Thus you'll get:
function show_inventory_window () {
Ã, // This demonstrates both types of inventory window - the first part is how to
Ã, // show the built-in inventory window, the second part uses the custom one.
Ã, // Un-comment one section or the other below.
Ã,Â
Ã, // ** DEFAULT INVENTORY WINDOW
Ã, // InventoryScreen();
Ã, // ** CUSTOM INVENTORY WINDOW
Ã, GUIOn (INVENTORY);Ã,Â
Ã, // switch to the Use cursor (to select items with)
Ã, SetCursorMode (MODE_USE);
Ã, // But, override the appearance to look like the arrow
Ã, SetMouseCursor (6);
}
Did it help?
hi,
1. thank you. it works. i can see the arrows.
2. new problem is that the items are now on each other not in the nice way they were (2 rows x 4 items per row). now i almost dont need the errows becaoue the inventory became huge and all the items are in it but they are on each other, with no constent space and even the first one is in the top top of the inventory,
3/ the good news (i think) that i read the scripts and i understand what you have told me to do (just use the custom inventory).
4. onther problem is that the inventory now is grey and not black althoug i change the color to 0.
thanks very much.
dikla
Quote from: dikla on Fri 14/05/2004 10:00:241. thank you. it works. i can see the arrows.
I'm glad that's sorted out. :)
Quote2. new problem is that the items are now on each other not in the nice way they were (2 rows x 4 items per row). now i almost dont need the errows becaoue the inventory became huge and all the items are in itÃ, but they are on each other, with no constent space and even the first one is in the top top of the inventory
Look up in the manual for a SetInvDimensions (int width, int height) command. Put it into your main global script's game_start() function:
function game_start() {
SetInvDimensions(WIDTH, HEIGHT);
}
You need to toy with WIDTH and HEIGHT values to achieve what you are after.
Quote4. onther problem is that the inventory now is grey and not black althoug i change the color to 0.
I'm not sure what you mean. Are you certainly sure you changed the
background color? Try putting 16 instead of 0.
all i need to know now is where i can arragne so the items will be in 2 rows 4 in each row in regular space between each inventory item' like it was in the beggining of my game. because now they are on each other and it does not matter if i change the hight and the width of the inventory
thanks
Well, try to resize (probably stretch) the inventory window itself. As for slot's height and width try higher values, say 100x100. But make sure you put it inside global game_start() function (one that was already there).
my dear scropious
you helped me so much, realy i should thank you. the problem indeed was in dimentions. in "start_game" i add the dimention (40, 40) and now i have to adjust all my sprites in the inventory to 40. but i am glad we salve the problem. it's pitty that the deafult inventory has this problem with the errows that does not work and we had to solve by swiching the GUI invnetory mode.
thank all again i hope it would help others -
dikla
No problem, you're welcome!
Quoteit's pitty that the deafult inventory has this problem with the errows that does not work and we had to solve by swiching the GUI invnetory mode.
Yep, that's a strange one. The build-in inventory dialog has arrows if items can't be fitted in the inventory area anymore. That's odd they appear invisible on some systems.