Community

AGI Programming => Mega Tokyo AGI Archive => Topic started by: Allen on August 25, 2004, 07:05:30 AM

Title: Character customisation errors.
Post by: Allen on August 25, 2004, 07:05:30 AM
Hey, I just recently wrote up this code, but it doesn't work properly. It is supposed to check s1 for a name, then go to the next label. It does all of this, but for one thing.
After the name part, when you push F8, the character portrait changes, so you can change how you look. Eg, race, hair color, etc. This doesn't work. it just stays at loop 0. (empty cel)
I've spent about 2 days figuring this out, but to no avail.
It's not a problem with setting the key, because using F8 in another logic works. I think it's just a nice little bug that I keep missing.

Code: [Select]
if (isset(f5)) {
  load.pic(v0);
  draw.pic(v0);
  discard.pic(v0);
  show.pic();
  animate.obj(o1); //Player Portrait
  load.view(3);
  set.view(o1,3);
  position(o1,8,50);
}
else{return();}

statsheet:
if (!isset(f17)) {
  goto(getname);
}
else {
  goto(hasname);
}

return();

getname:
text.screen();
status.line.off();
set(f17);
prevent.input();
get.string(s1,"What is your name?\n\n  My Name Is: ",1,10,16);
set.string(s2,"");
if (compare.strings(s1,s2)) {
  set.string(s1,"Rachley");
}
graphics();
goto(statsheet);
return();

hasname:
reset(f17);
set.text.attribute(0,15);
display(4,16,"%s1");
set.text.attribute(15,0);
draw(o1);
v70 = 0;

if (controller(c34)) { //F8
if(v70 == 0){ //Portrait loop no.
v70++;
set.loop(o1,1);
return();
}
if(v70 == 1) {
v70++;
set.loop(o1,2);
return();
}
if(v70 == 2){
v70++;
set.loop(o1,3);
return();
}
if(v70 == 3){
v70++;
set.loop(o1,4);
return();
}
if(v70 == 4){
v70++;
set.loop(o1,5);
return();
}
if(v70 == 5){
v70++;
set.loop(o1,6);
return();
}
if(v70 == 6){
v70 = 1;
set.loop(o1,1);
return();
}
}
return();

// Messages
#message 1 "What is your name?\n\n  My Name Is: "
#message 2 ""
#message 3 "Rachley"
#message 4 "%s1"
It's probably a blatant bug in there, but I don't see it. If it makes me look stupid, please be nice about it. ;D
Title: Re:Character customisation errors.
Post by: robingravel on August 25, 2004, 08:08:56 AM
I guess you forget to add Draw in your code. Add it to each subroutine you have like this one.

Quote
if(v70 == 1) {
v70++;
set.loop(o1,2);
draw(o1);
return();
}

It should work.


Robin Gravel
Title: Re:Character customisation errors.
Post by: Allen on August 25, 2004, 09:27:17 AM
 ::)
I knew it was something stupid. Thanks, Robin.
Title: Re:Character customisation errors.
Post by: Kon-Tiki on August 25, 2004, 09:31:39 AM
Be glad it's no ; you forgot, or a curly bracket placed wrong. Such little stupidities're the most common bug, and are severe headaches when debugging ;)
Title: Re:Character customisation errors.
Post by: Allen on August 25, 2004, 09:45:24 AM
Argh, just tested and it didn't fix it.
Could it be the prevent.input(); command that's doing it?
Title: Re:Character customisation errors.
Post by: Allen on August 25, 2004, 09:55:07 AM
Argh, never mind. I'll get round this another way.