 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
Jack the fool

Joined: 30 Jul 2004 Posts: 773
|
Posted: Sat Nov 27, 2004 1:20 pm Post subject: Script troubles |
|
|
im having trouble with this script, for some reason when i go to compile it, an error comes up saying:
"Unrecognised name deletehero. It has not been defined as script, constant, variable, or anything else"
Code: | include, plotscr.hsd, Zombie.hsi
define script (1,ondeath,0)
script,ondeath,begin
if (0,0,HP) then(deletehero(0))
end |
not really sure what to do, any help would be greatly appreciated _________________
 |
|
Back to top |
|
 |
Shadowiii It's been real.

Joined: 14 Feb 2003 Posts: 2460
|
Posted: Sat Nov 27, 2004 2:00 pm Post subject: |
|
|
When using delete hero you must use it in the form of hero:name. Ex:
Delete Hero (Hero:MichaelJackson) _________________ But enough talk, have at you! |
|
Back to top |
|
 |
Jack the fool

Joined: 30 Jul 2004 Posts: 773
|
Posted: Sat Nov 27, 2004 2:09 pm Post subject: |
|
|
Code: | include, plotscr.hsd, Zombie.hsi
define script (1,ondeath,0)
script,ondeath,begin
if (0,0,HP) then (delete hero (hero:0))
end |
i'm still getting the same error: Quote: | "Unrecognised name delete hero. It has not been defined as script, constant, variable, or anything else" |
_________________
 |
|
Back to top |
|
 |
Shadowiii It's been real.

Joined: 14 Feb 2003 Posts: 2460
|
Posted: Sat Nov 27, 2004 2:15 pm Post subject: |
|
|
Did you export the .hsi file from the rpg?
Did you add "include rpgname.hsi" at the beginning of your script?
Is the hero's name "0" (zero)?
If the hero's name is "Cloud", you have to put his actual name, not the number. _________________ But enough talk, have at you! |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Sat Nov 27, 2004 2:18 pm Post subject: |
|
|
It's not recognizing "delete hero," which seems to indicate it didn't load "plotscr.hsd" correctly. I'm not sure if you can do two includes on one line. Try making them two statements:
include, plotscr.hsd
include, zombie.hsi _________________
|
|
Back to top |
|
 |
Jack the fool

Joined: 30 Jul 2004 Posts: 773
|
Posted: Sat Nov 27, 2004 2:55 pm Post subject: |
|
|
Code: | include, plotscr.hsd
include, Zombie.hsi
define script (1,ondeath,0)
script,ondeath,begin
if (hero:Jack,0,HP) then (delete hero(hero:Jack))
end |
ok, now im getting this message: "If statement has 3 conditions. It should have only one. Use and and or for complex conditions." _________________
 |
|
Back to top |
|
 |
Camdog
Joined: 08 Aug 2003 Posts: 606
|
Posted: Sat Nov 27, 2004 3:34 pm Post subject: |
|
|
The code within an if statement should resolve to a single boolean value, either true or false. The way you have it right now, there are three values that evaluate in your if statement. Instead, you should plug your numbers into the appropriate function (in this case: get hero stat) and compare the result with what you want so you'll get the much sought after boolean result.
Code: | script, ondeath, begin
if(get hero stat(hero:jack,HP) == 0) then (delete hero(hero:jack))
end |
In other words, get hero stat returns the value of the stat you want, you compare it to 0, and the comparison returns true or false, which is what you need for the if statement to work.
Incidentally, just using 0 to identify the hero should work fine. Hamster Speak uses numbers as identifiers for everything. The hsi file just defines a bunch of constants that Hamster Speak changes back to numbers anyway. Using Hero:Jack instead of 0 will only make it more readable, if you care about that. |
|
Back to top |
|
 |
Jack the fool

Joined: 30 Jul 2004 Posts: 773
|
Posted: Sat Nov 27, 2004 3:42 pm Post subject: |
|
|
, got it working now, thanks for all your help! _________________
 |
|
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
|