Scripting Help - need help with if else = + and values

Started by error17, Thu 28/06/2007 09:46:44

Previous topic - Next topic

error17

I really need help with this. Since the help tutorial said to contact technical forum, i want to ask this, and i need you to repl the answer to green_team_au@hotmail.com

Question:
I am trying to write a script using the text paser. so far it all works, when i type in walk to door my character walks to the cordinates then open the door, like that. but i am trying to get an inventory item to active. i wan the shoe to come off when you type :
if (Parser.Said("take [off] shoe")) {
then the command to say it is put into the inventory. but i want it to active something so that if i type take off shoe again, it will say "you have already taken it off!".
i have tried this:
i have given the item a value of 1 (in properties). then i made the commands (not in this exact, in correct way)  :
if parser take off shoe
if item 1 value == 1
display "ive put it in my inventory"
item 1 value + 1
}
if parser take off shoe
if item 1 value > 1
Display "already taken it off"
}

and that runs the game, but it doesnt make the value + 1. because i made this command :
if parser said shoe=1?
if item 1 value == 1
display "yes equals 1"
if parser said shoe=2?
if item 1 value > 1
display "yes equals 2"

but it worked for shoe=1?
i even made:?
if parser said add1
item value +1

then it still didnt work
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
i want know how to do this type of script command.... WHAT IS IT PLEASE EMAIL!

Gilbert

Can you post the real part of codes used in the script?
It's a bit hard for us to decipher your pseudo codes (especially when there are no formating and mixed up with the post messages which makes them very hard to read, but that's another issue) and sometimes it's not a problem with your idea, maybe you made some mistakes in your actual codes.

Snarky

If I understand you correctly, you want to know how to increment a value? OK, let's say you have a value var:

var = 0;

Then to increase the value of var by one, you can do:

var = var + 1;

Now var is 1. The next time it will be 2, and so on. Increasing a value by a number is such a common operation that there is a shortcut for it:

var += 1;

In fact, increasing by 1 is so common that there is yet another shortcut:

var++;

OK. Maybe you already knew this (it's pretty basic stuff). If that's what you're doing and it still doesn't work, it's probably because your value is local to the function, so it gets reset every time the function is called. Create the value outside of the function so that it is stored even after the function ends.

Ashen

Quote
i have given the item a value of 1 (in properties).

If you mean Custom Properties, then like it says in the manual:

Quote from: The Manual
Custom property values cannot currently be set from within the game script - they are read-only at runtime.
Which would explain why the value isn't changing. ints are the way to go here

But as Gilbot said, it's kind of hard to understand exatly what you've done if you don't post actual code / Interaction Editor commands (and if you're using Interaction Editor, it probably shouldn't be in this forum...).
I know what you're thinking ... Don't think that.

Gilbert

Yeah, just as Ashen said, this thread may not be even suitable here (probably more suitable in the Beginner's Tech. Forum).
However, as you mentioned using the parser I suppose it's about text sctipting, it's really hard to judge as the pseudo codes you posted are quite difficult to read.

error17

thanks guy's for your help.
I have tried other attempts.
and I have finally got it to work (cheers).
what i actually wanted to do was, if i tiped in the parser "take off shoe", he would take off his shoe, and to stop any user glitches, i wanted to make it if the user tipes that again it would say "Its already off".
you should get that but in codeing wise, i changed it to (in script): if the item is in the inventory display "its already off" else take it off, add to inventory ect.
I really appretiate the AGS program to be so easy. sorry for panicing, it is my first game.

I also am proud that i made this lock on my door in the game, where you have to type a 3 digit code in to open it, and i got it to open when the right code is in, and wrong when the wrong code was tiped in.
Does anyone have a skillfull idea like that? that i could add to my game?

SMF spam blocked by CleanTalk