Bug fix

Kon-Tiki Hi, I've got yet another problem ::) This time, it's just a bug I noticed while programming my bar. If I do 'talk man' and I'm near a person I can talk to, it first says the thing it should say when you're not near a person. It works fine with the bartender, but the other person I've programmed already gives that problem.
Here's my code:

if(said("talk","man")){
if(posn(o0,50,125,65,137)) {
set(f100);
}
if(posn(o0,5,115,20,140)) {
set(f101);
}
if(posn(o0,106,126,124,145)) {
set(f102);
}
if(posn(o0,35,104,140,120)) {
set(f103);
}
else {
print("My text.'");
}
}


I hope this makes sense.

-Kon-Tiki-
Rainer I'm not 100% sure what you're trying to do, but I think you want to put return(); statements at the end of each if statement, after you set each flag, but before the curly brace.
happyturk2 Yeah, what's happening is that it's seeing:

if(posn(o0,35,104,140,120)) {
set(f103);
}
else {
print("My text.'");
}

And if it's not near the person in that third if statement, no matter whether it's near any of the others, it's going to the else and returning the message.

It'd be nifty if AGI had an 'else if' to go with the if and else; things like this would be a lot simpler. But you can either use returns as said, or just nest the if statements to simulate an 'else if':

if(said("talk","man")){
if(posn(o0,50,125,65,137)) {
set(f100);
}
else {
if(posn(o0,5,115,20,140)) {
set(f101);
}
else {
if(posn(o0,106,126,124,145)) {
set(f102);
}
else {
if(posn(o0,35,104,140,120)) {
set(f103);
}
else {
print("My text.'");
}
}
}
}
}
sonneveld it's not so much as else if option but allowing you to have an if statement without {} brackets.

- Nick
Kon-Tiki Thanks, it's working fine now. I figured the nested if-else statements out yesterday before going to sleep. It's pretty dull that I've looked over that option. Also, to see what I was trying to do, you'll have to wait a couple more days. The demo will then be ready (I'm not letting too much about it out yet, I've already said a bit too much :-X) I've still got some questions left (although they don't concearn logic, but the game itself): 1) Which name do you prefer? [a] Little Pirate Tales of the Ocean [c] Piraatje [d] Something else. 2) Should the character have a name? [a] Yes No [c] Don't care These are just small things, but it could be handy while making the finishing touches. -Kon-Tiki-
sonneveld Well you need to mention "pirate" because that's your main selling point.. How about "Pirate Adventures on the Ocean"? (joke)

I think you should pick a name for your character. I find I identify with the hero better than if I use my own name.

- Nick
Andrew_Baker Yeah, I like Little Pirate, and I agree with Nick that the player should get to use his/her own name. It's a really standard convention in a lot of Japanese games to assume the central character is representative of the player (This is why Mario never speaks).

Keep working:)
Kon-Tiki Ok, planned to name him 'Jake'. First 'Jake the kid', and while getting further in the game, getting a better nickname. I can still do that, but I'll have to search the code of Huize 44 before I can make the user choose his own name. It'll take another hour ;) (Which sets the total to +-10h. Dagnabbit.)

Ok, I'll see to it that it gets done and, if 'Little Pirate' really is better than for example 'The rise and fall of pirate Jake', I'll keep it.

Thanks

-Kon-Tiki-
sonneveld as much as I like agreeing with everybody, I meant Kon-Tiki should pick the name. I didn't know about the Japanese convention, but I always picked the default names when I played Square rpg's. :)

- Nick
Kon-Tiki I'll see what I can do. If I have the time to make the player choose the name, I'll put it in the game. If the player doesn't choose a name, it'll use a default name. This'll only be in the game if I have time today to put it in(wow: when the rest's finished.) Otherwise, the name'll be Jake.

-Kon-Tiki-
Kon-Tiki That feature'll be in it. (btw: Real life got in the way. The demo'll be ready tommorow or, when I got lots of problems, the day after that, but normally tomorrow.)

-Kon-Tiki-