 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Mon Nov 01, 2004 11:04 am Post subject: Questions about fight formation |
|
|
In the plotscript dictionary, fight formation is said to return the value true if the player wins the battle, and then false if he or she loses or runs away. I have two scripts that look like the following:
Code: | if(fightformation(30)),then
begin
...
end
if(fightformation(51)),then
begin
...
end |
The problem is that the first one doesn't work, but the second one does! What I mean is that in the first case(formation 30), the stuff under then never gets run, but in the second case(formation 51) the stuff gets run if you win, but not if you run away.
Has anyone else experienced this, or know what to do about it? Thank you in advance.
PS: I've actually run into this problem in the past, but I circumvented it. But now that I want a different death script, my previous methods no longer work. |
|
Back to top |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Mon Nov 01, 2004 11:06 am Post subject: |
|
|
lose the commas before the thens (use a space or skip a line) |
|
Back to top |
|
 |
Sephyroth Renegade Rebel Redmage Class A Minstrel

Joined: 04 Feb 2003 Posts: 644 Location: Schmocation
|
Posted: Mon Nov 01, 2004 11:21 am Post subject: |
|
|
Code: | if(condition) then,begin |
There is no comma before then. _________________ im realy ded  |
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Mon Nov 01, 2004 11:38 am Post subject: |
|
|
Wow guys, that was quick. Thanks! Unfortunately, I just tried that and it didn't change anything. Besides, I'm pretty sure that Hamsterspeak treats commas and hard returns as the same thing. I am kind of curious as to why
Code: | if(fightformation(30)) then |
compiles. I guess maybe the 'end' or ')' command has a hard return built into it...? Or maybe when it sees 'begin' or '(' its waiting for the counterpart and ignores what comes immediately after it even though there is no hard return or comma.
Anyway, does anyone have any other ideas about my problem here? |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Mon Nov 01, 2004 4:24 pm Post subject: commas are irrlevant |
|
|
Code: |
( = ,begin,
) = ,end,
newline = ,
,, = ,
|
commas are irrelevant in this case. In fact, all of the following examples compile and work exactly the same way
Code: |
if(fightformation(30)),then
begin
...
end
if(fightformation(30)),then, begin
...
end
if(fightformation(30)) then
begin
...
end
if(fightformation(30)) then,begin
...
end
if(fightformation(30)),,,,,,,,,,,,,,,,,,,,,then,,,,,,,,,,,,,,,,,,begin,,,,,,,
...
end
|
I suggest doing something like:
Code: |
show value(fightformation(30))
|
that will tell you the exact number that fight formation is returning, which should help narrow down this problem. |
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Mon Nov 01, 2004 9:22 pm Post subject: |
|
|
Okay, I did a test where I coded the following:
Code: | showvalue(fightformation(30))
wait(30)
showvalue(fightformation(51))
wait(30) |
Both came up with 0. This is very odd because usually the fightformation(51) command works just fine with the if command it is used in. The only differences I can think of between when it works and when it doesn't are:
1. In this test I used fightformation(51) with show value; when it worked, it was used in an if statement
2. In this test I used fightformation(51) on map 4 (I think); I used it on map 11 when it worked.
Thanks in advance |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Mon Nov 01, 2004 10:29 pm Post subject: |
|
|
I just realized how obvious the answer is here.
fightformation only returns true if you win the battle. If you run or die, it returns false. If you want to check for death, use a deathscript. _________________
|
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Tue Nov 02, 2004 12:07 am Post subject: |
|
|
Actually Moogle1, the problem is that what you (and the plotscript dictionary) are claiming is not happening. I AM winning the battles I'm referring to, and the value is still showing up as zero. Or, in the case of the original setup of the problem, I win the battle against formation 30, but the 'then' block under the if statement is not run. However, I also win the battle against formation 51, and the 'then' block under that if statement is run. Very strange.
Any other ideas? I'm beginning to think this may be the signs of some kind of bug in hamsterspeak, but it seems that someone would have run into this before. But please, if anyone else has any ideas about it, post'em. |
|
Back to top |
|
 |
Uncommon His legend will never die

Joined: 10 Mar 2003 Posts: 2503
|
Posted: Tue Nov 02, 2004 6:40 am Post subject: |
|
|
Just for clarity's sake, the numeric values of true/false are
Code: | false == 0
true == 1 | Right? |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Tue Nov 02, 2004 7:06 am Post subject: |
|
|
Yes, that's what the script should return. I'm tempted to go do a test case myself.
If all else fails, you could make the battles unescapable. That way, the death script will be called if the player didn't win. _________________
|
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Tue Nov 02, 2004 8:06 am Post subject: |
|
|
Just to clarify to Moogle1: The battles are inescapable. My trouble is that I have just made a custom death script similar to the Dragon Warrior system: when you die you retain your experience, but your money is halved, and you are revived at the last save point. I always liked this system better because then you wouldn't get so terribly frustrated if you died (at least your characters come out stronger for a second chance). However, this means that if a battle occurs as part of a script, I want the script to terminate if you lose the battle. Since there is no command to terminate a script I put the rest of the script within the 'then' block of the 'if' statement. |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Tue Nov 02, 2004 8:51 am Post subject: |
|
|
Set an abort tag in your death script. _________________
|
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Tue Nov 02, 2004 11:35 am Post subject: |
|
|
That's a good idea. I guess I'll need to reset it right before any script battle. I guess I'll also need a wait command right after the fightformation, but before the if check on the tag.
I'm still wondering what's wrong with the current method, however. This is the second problem I've had with Hamsterspeak (the first I mentioned a little while ago, that NPC Y(*) returns the ID number of the npc if there are no copies of the npc on the map; I don't think that this was ever resolved, and I just had to work around it). Should I send these to the bug-report on the OHR site, or is there still some chance I'm doing something wrong? (As you can probably tell, I'm VERY hesitant to claim the existence of a bug in Hamsterspeak unless I'm REALLY sure it is a bug) |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Tue Nov 02, 2004 3:48 pm Post subject: possible bug |
|
|
There might be a bug. I will have to double-check the code. Could sumbody enter this into bugzilla to remind me? |
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Tue Nov 02, 2004 4:14 pm Post subject: |
|
|
Hey, I'll post it as soon as my account password comes through. Actually, I'll post two; one for the fightformation, one for npcY.
Thanks to everyone for their help and suggestions. |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|