 |
Castle Paradox
|
| View previous topic :: View next topic |
| Author |
Message |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Tue Sep 04, 2007 8:32 am Post subject: |
|
|
Darn, I can't seem to get the idea of keypress scripts taking precedence over the actual keypress into my head! Even though this isn't what Bis is after, apparently. Plus things could still get weird if the player decides to empty the first caterpillar slot (pets in the lead!) or gets more heroes. Doesn't really matter here.
I can still imagine a problem with holding down the arrow keys. If a player is holding down a direction, the keypress script is going to called continuously. Because of the wait command, won't the first script be interrupted the entire time the player is doing so? I agree that the tags make sure that the keypress script won't actually DO anything, but it will interrupt the original keypress script, won't it? So the second set npc position command is never run until game stop receiving keypresses? _________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com |
|
| Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Sep 04, 2007 8:58 am Post subject: |
|
|
| msw188 wrote: | Darn, I can't seem to get the idea of keypress scripts taking precedence over the actual keypress into my head! Even though this isn't what Bis is after, apparently. Plus things could still get weird if the player decides to empty the first caterpillar slot (pets in the lead!) or gets more heroes. Doesn't really matter here.
I can still imagine a problem with holding down the arrow keys. If a player is holding down a direction, the keypress script is going to called continuously. Because of the wait command, won't the first script be interrupted the entire time the player is doing so? I agree that the tags make sure that the keypress script won't actually DO anything, but it will interrupt the original keypress script, won't it? So the second set npc position command is never run until game stop receiving keypresses? |
I think I'll definitely add a command to do fancy and more powerful keypress blocking next version. And commands to create fake keypresses. It seems to have uses all over the place.
There are no wait commands that are not tag-checked. When the onkeypress script is called, it does nothing, and terminates immediately, so the first instance of npcplace will then continue to run.
Actually, there is a potential problem. On the tick that npcplace finishes, the onkeypress script is called but does nothing, when it might have been expected to call npcplace again. (It's not specific to these scripts, ignore whether it's actually a problem here) _________________ "It is so great it is insanely great." |
|
| Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Tue Sep 04, 2007 9:31 am Post subject: |
|
|
What I'm saying is that when the onkeypress script is called the second time, it terminates immediately and the first instance of npcplace will continue, BUT it won't get anywhere because the player is still holding down the key and so it gets interrupted again right away by a third 'do-nothing' onkeypress script, and this would continue to occur until the player lets go of the key for a tick.
I think I may just have a misunderstanding of what happens when a script is interrupted by a second script, and what a wait command means. I always sort of envisioned it as: wherever you are in the original script, put the new script right on that line and then begin evaluating from there. If the new script has no waits, this means do everything in that script AND everything forward in your current script until you hit a wait, all at once if possible. But I always think of a script as pausing at a wait, and since the keypress script is going to be called continuously it seems that it would stack up and the wait(2) will never be finished because it would always be regarded as being right after the doing nothing of the keypress scripts resulting from holding the key down.
A suspend key (scancode) command would be a really nice command to have (together with a resume key command, of course) though. _________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com |
|
| Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Sep 04, 2007 8:43 pm Post subject: |
|
|
Well, I suppose that's an accurate enough way of thinking about stacked scripts, except that you seem to think that wait(2) would be rerun everytime the script is interrupted by another and resumed.
Think about it like this: wait(2) is only run once. Then the script "execution pointer" is currently AFTER the wait(2), and the wait(2) command also puts the script in wait mode.
In this mode, every time the script became active (ie, after the onkeypress script does nothing and quits, or if it is not run at all), instead of running, the script interpreter considers the wait condition. The wait timer is decreased by 1, and if it's now 0, the script is resumed. _________________ "It is so great it is insanely great." |
|
| Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Wed Sep 05, 2007 7:47 am Post subject: |
|
|
Ah, I think my problem is that I felt like the wait command would wait before it started to count down, so to speak. Nevermind, I understand now I think. So with the wait(2), the onkeypress script would potentially be called and do nothing twice, but this would have no affect on gameplay, or so it seems to me now. _________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com |
|
| Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sun Sep 09, 2007 12:50 am Post subject: I can't use hsimport.exe anylonger! |
|
|
Ok! I've made some tests and it didn't get right. I think
I will have to customize the arrows keys or use the each step script.
Anyway, when I use hsimport it tells me "HS file is of a different version. Version found was 3"
Could somoene tell me what to do to use hsimport.exe again?
As always thanks you for your help and your answers! Good luck on making your games to all of you! _________________ It's time to make games! |
|
| Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Sun Sep 09, 2007 6:24 pm Post subject: Re: I can't use hsimport.exe anylonger! |
|
|
| bis_senchi wrote: | Could somoene tell me what to do to use hsimport.exe again?
As always thanks you for your help and your answers! Good luck on making your games to all of you! |
Don't use hsimport anymore. It has not been updated for the new version.
Instead, custom can import scripts directly.
| Code: | | custom.exe mygame.rpg myscript.hs |
Or you can drag an drop both your game and your compiled script into custom.exe at the same time. |
|
| Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Mon Sep 10, 2007 9:49 pm Post subject: Don't use Hsimport anymore |
|
|
James Paige wrote | Quote: |
Don't use hsimport anymore. It has not been updated for the new version.
Instead, custom can import scripts directly.
| Code: | | custom.exe mygame.rpg myscript.hs |
|
Thank you! That's exactly what I needed to know.
I've made some more tests and the each step script seems useful but I don't know why I don't managed to fake caterpilar the way I was when npcs was just behind the hero on the same x or y line... What with a while loop.
Could somoene confirm that the each step script is launched (as said in the name) each time we press the arrow keys?
Here are the new scripts:
| Code: |
defince script (21, eachstepscript, none)
define script (autonumber, npcplace, none)
#---------------------------------------------------------------------
script, eachstepscript, begin
if(check tag(tag:honda follows me)==on, xor, check tag(tag:jono follows me)==ON) then, begin
npcplace
end
end# end of plotscript
#-----------------------------------------------------------------------
script, npcplace, begin
if (herodirection(me) ==left) then, begin
if(check tag(tag:honda follows me)==on, and, honda moves==false) then, begin
honda moves:=true,
suspend npcs,
set npc position (4, heroX+1, heroY+1) ,
set npc frame (4, 0),
wait(2),
set npc frame (4, 1),
set npc direction (4, left),
resume npcs,
honda moves:=false,
wait(1)
end #end for the tag
else, begin
if (herodirection(me) ==right) then, begin
if(check tag(tag:honda follows me)==on, and, honda moves==false) then, begin
honda moves:=true,
suspend npcs,
set npc position (4, heroX--1, heroY+1) ,
set npc frame (4, 0),
wait(2),
set npc frame (4, 1),
set npc direction (4, right),
resume npcs,
honda moves:=false,
wait(1)
end #end for the tag
end #end for the esle begin
else,begin
if (herodirection(me) ==up), then, begin
if(check tag(tag:honda follows me)==on, and, honda moves==false) then, begin
honda moves:=true,
suspend npcs,
set npc position (4, heroX+1, heroY+1) ,
set npc frame (4, 0),
wait(2),
set npc frame (4, 1),
set npc direction (4, up),
resume npcs,
honda moves:=false,
wait(1)
end #end for the tag
end #end for the esle begin
else,begin
if (herodirection(me) ==down) then, begin
if(check tag(tag:honda follows me)==on, and, honda moves==false) then, begin
honda moves:=true,
suspend npcs,
set npc position (4, heroX--1, heroY+1) ,
set npc frame (4, 0),
wait(2),
set npc frame (4, 1),
set npc direction (4, down),
resume npcs,
honda moves:=false,
wait(1)
end #end for the tag
end #end for the esle begin
end #ends for the if directions
end
end
end
if (herodirection(me) ==left) then, begin
if(check tag(tag:jono follows me)==on, and, jono moves==false) then, begin
jono moves:=true,
suspend npcs
set npc position (17, heroX+1, heroY--1),
set npc frame (17, 0),
wait(2),
set npc frame (17, 1),
set npc direction (17, left),
resume npcs
jono moves:=false,
wait(1)
end #end for the tag
else, begin
if (herodirection(me) ==right) then, begin
if(check tag(tag:jono follows me)==on, and, jono moves==false) then, begin
jono moves:=true,
suspend npcs
set npc position (17, heroX--1, heroY--1),
set npc frame (17, 0),
wait(2),
set npc frame (17, 1),
set npc direction (17, right),
resume npcs
jono moves:=false,
wait(1)
end #end for the tag
end #end for the esle begin
else, begin
if (herodirection(me) ==up) then, begin
if(check tag(tag:jono follows me)==on, and, jono moves==false) then, begin
jono moves:=true,
suspend npcs
set npc position (17, heroX+1, heroY--1),
set npc frame (17, 0),
wait(2),
set npc frame (17, 1),
set npc direction (17, up),
resume npcs,
jono moves:=false,
wait(1)
end #end for the tag
end #end for the esle begin
else,begin
if (herodirection(me) ==down) then, begin
if(check tag(tag:jono follows me)==on, and, jono moves==false) then, begin
jono moves:=true,
suspend npcs,
set npc position (17, heroX--1, heroY--1) ,
set npc frame (17, 0),
wait(2),
set npc frame (17, 1),
set npc direction (17, down),
resume npcs,
jono moves:=false,
wait(1)
end #end for the tag
end #end for the else begin
end #ends for the if directions
end
end
end
end #end for the script
#-----------------------------------------------------------------------
|
As always thank you for your help and your answers. _________________ It's time to make games! |
|
| Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Tue Sep 11, 2007 7:27 am Post subject: |
|
|
You're ifs, elses, begins and ends are mixed up. This is MUCH easier to see if you use indentation in your script, as in below:
| Code: | script, npcplace, begin
if (herodirection(me) ==left) then,
begin
if(check tag(tag:honda follows me)==on, and, honda moves==false)
then, begin
honda moves:=true,
suspend npcs,
set npc position (4, heroX+1, heroY+1) ,
set npc frame (4, 0),
wait(2),
set npc frame (4, 1),
set npc direction (4, left),
resume npcs,
honda moves:=false,
wait(1)
end #end for the tag
else,
begin
if (herodirection(me) ==right) then, begin
|
The idea is that each time you use the word begin, it should be on its own line and should be indented one 'unit' (some people do one extra space, some people indent two extra spaces) further than the line before it, and one 'unit' less than the line after it. Then any time you use the word end, it should also be on its own line and should be indented one 'unit' less than the line before it, and one 'unit' more than the line after it. (all of this is ignored for the begin and end that start and stop the entire script)
General Example for indenting: | Code: |
#stuff, not indented at all
#stuff, not indented at all
if(indentation==fun),then #still not indented
begin #here is "begin", so we indent one more than what is before
showtextbox(55) #this is after a begin, so we indent one more
waitfortextbox #same indentation
if(indentation==really fun),then #same indentation
begin #new line for begin, indented one more
walk npc (2,2,2) #after a begin, so indent one more
end #here is "end", so we indent one less than line before
showtextbox(66) #this is after an end, so we indent one less
waitfortextbox #same indentation
end #new line for end, indented one less
#stuff indented one less, so no indentation
|
Notice how begins and ends always line up with each other, making it clear what things happen when. The only thing that may get strange is having two ends in a row. When this happens, you need to make the second end indented TWO less units than the first end to make sure everything lines up properly.
Anyway, in your script, if the hero is not facing left, none of the other stuff is ever run. The script would be better organized as follows:
| Code: | if(checktag(tag:hondafollowsme)==on,and,hondamoves==false) then,
begin
if (herodirection(me)==left) then,
begin
#honda following code for left, indented four units
end #end of this directional if
else
begin
if (herodirection(me)==right) then,
begin
#honda following code for right, indented six units
end
else
begin
if (herodirection(me)==up) then,
begin
#honda following code for up, indented eight units
end
else
begin
if(herodirection(me)==down) then,
begin
#honda following code for down, indented ten units
end #this is indented 9
end #two ends in a row means go back two units - this is 7
end #this is 5
end #this is 3
end #this is 1, and closes the tag check
#here do the EXACT SAME THING starting with checking jono's tag,
#then going through the directions one at a time,
#each one should be indented the same as that other part |
Do you understand the difference? Here I start by checking if the person should be following, then go through direction by direction, instead of checking the direction first. As always, ask any questions you need to.
Oh, and you still have not changed the xor in the first script to an or. _________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com |
|
| Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Thu Sep 13, 2007 10:18 pm Post subject: After some tests... |
|
|
I made some tests: I put
| Code: |
if(check tag(tag:honda follows me)==on, and, honda moves==false) then, begin
|
just before
| Code: |
if (herodirection(me) ==left) then, begin
|
before as msw188 advised me to put the command line this way but it didn't change anything so I guess I can leave the code as advised.
When I test my game: I manage to make one of the Npc(JonoUchi kun) to follow me while some steps but when I go too far away, jono does not follow me anylonger.
I'll also have a few troubles with the second Npc (honda-kun) but I will give more details in a futur post.
As I explained in my previous the problem is to launch the script again. Could somoene tell me how to create a While Loop adapted to the situation?
The while loop have to be activated each time I press an arrow key and unactived when the npc have finished moving (so I may have to turn it :=false at the end of npc place script)
Where should I put the while (npc moving) do, begin command line? and I also have a question about the wait (1) command: could somoene remember me where to put it? Is it just after the global variable is turned :=true or is it just after it is turned :=false? I this kind of situation it is obligation to put it to prevent the game.exe from freezing
As always thanks for you help and advice! _________________ It's time to make games! |
|
| Back to top |
|
 |
Ysoft_Entertainment VB Programmer

Joined: 23 Sep 2003 Posts: 810 Location: Wherever There is a good game.
|
Posted: Fri Sep 14, 2007 6:46 am Post subject: |
|
|
you can put wait(1) command anywhere in a while loop. Just make sure its by itself. _________________ Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals. |
|
| Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Fri Sep 14, 2007 6:57 am Post subject: |
|
|
There is no need for a while loop as long as this is an on keypress script. The real issue is, first, your npcplace code that you posted last is wrong. It will only work correctly when you are walking to the left. If it is working in other directions, than you cannot have posted the code correctly. If you look at my version, it is not just putting the line
| Code: | | if(check tag(tag:honda follows me)==on, and, honda moves==false) then, begin |
before the directional check. All of your begins, ends, ifs and elses need to be changed to follow my outline of code to fix the directional problem, both in Honda's and Jono's sections of the script.
I also noticed that you're positioning for the jono and honda NPCs is inconsistent. For example, it seems to me based on your left and right code you would always like jono and honda to be one tile 'behind' the hero. But in your up code for jono, you set NPC 17 to position herox+1, heroy--1, which would be one tile to the right and one tile above (and thus in front of) the north facing hero. You should double check all of those parts.
In all honesty, I can't figure out why this would work part of the time, but not for long. The only way I can see this happening is if you start out going left and then start going other directions (because in your code, left is the only thing that should work correctly).
I don't know what you're trouble with having both follow is, but I need to keep saying that as of your last posted code, NPCplace will NEVER run if both tags honda follows me and jono follows me are on. This is because in your keypress script you have the line
| Code: | | if(check tag(tag:honda follows me)==on, xor, check tag(tag:jono follows me)==ON) then, begin |
It should be
| Code: | | if(check tag(tag:honda follows me)==on, or, check tag(tag:jono follows me)==ON) then, begin |
_________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com |
|
| Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sat Sep 15, 2007 4:05 am Post subject: Msw188 were right! |
|
|
I carefully read your post I manage the problem with the arrows. As you guessed, it appeared to be a problem with "end" command line that weren't correctly indented. Sorry about that
In your last post, you wrote that my code should be
| Code: |
if(check tag(tag:honda follows me)==on, or, check tag(tag:jono follows me)==ON) then, begin
|
I think (but I may be wrong) that xor I what need because I need to launch the script npc place
1- When Jono follows me (Tag Jono follows me is active)
2- When Honda follows me (Tag Honda follows me)
3- When BOTH Jono and Honda follows me (Both tag are activated)
When I test the script I still can't have 2 npcs following me and I think this
is because 1) a problem with the code above 2) the if check tag command lines in the script are not correctly indented and the script ends too early.
As I carefully checked the indentation in Npc place I think that 1) is the reason why Npc place is launched and which explains why when the 2 tags are turned ON none of the npcs follows me. _________________ It's time to make games! |
|
| Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Sat Sep 15, 2007 11:14 am Post subject: |
|
|
Okay, I'll admit that I'm no computer science expert, but I always thought in the OHR that xor meant exclusive or. That is to say, it follows this truth table:
TRUE xor FALSE ==> TRUE
TRUE xor TRUE ==> FALSE **
FALSE xor TRUE ==> TRUE
FALSE xor FALSE ==> FALSE
Notice the starred line. This is your problem. On the other hand, or works the same as xor except for the starred line:
TRUE or FALSE ==> TRUE
TRUE or TRUE ==> TRUE **
FALSE or TRUE ==> TRUE
FALSE or FALSE ==> FALSE
Thus, "or" is what you really want for scenarios 1, 2, and 3 to all trigger npcplace. If that doesn't fix it, then there is probably still a problem with your various ends. Try it with "or" first, but if that doesn't work could you post your revised npcplace script? _________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com |
|
| Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Mon Sep 17, 2007 8:46 am Post subject: The new version of the scripts |
|
|
Here are the new version of the script
| Code: |
#-----------------------------------------------------------------------
script, npcplace, begin
if(check tag(tag:honda follows me)==on, and, honda moves==false) then, begin
if (herodirection(me) ==left) then, begin
honda moves:=true,
suspend npcs,
set npc position (4, heroX+1, heroY+1) ,
set npc frame (4, 0),
wait(2),
set npc frame (4, 1),
set npc direction (4, left),
resume npcs,
honda moves:=false,
wait(1))
else, begin
if (herodirection(me) ==right) then, begin
honda moves:=true,
suspend npcs,
set npc position (4, heroX--1, heroY+1) ,
set npc frame (4, 0),
wait(2),
set npc frame (4, 1),
set npc direction (4, right),
resume npcs,
honda moves:=false,
wait(1))
else,begin
if (herodirection(me) ==up), then, begin
honda moves:=true,
suspend npcs,
set npc position (4, heroX+1, heroY+1) ,
set npc frame (4, 0),
wait(2),
set npc frame (4, 1),
set npc direction (4, up),
resume npcs,
honda moves:=false,
wait(1))
else,begin
if (herodirection(me) ==down) then, begin
honda moves:=true,
suspend npcs,
set npc position (4, heroX+1, heroY--1) ,
set npc frame (4, 0),
wait(2),
set npc frame (4, 1),
set npc direction (4, down),
resume npcs,
honda moves:=false,
wait(1))
end #end for the esle begin
end
end
end, else, begin #end first tag
if(check tag(tag:jono follows me)==on, and, jono moves==false) then, begin
if (herodirection(me) ==left) then, begin
jono moves:=true,
suspend npcs
set npc position (17, heroX+1, heroY--1),
set npc frame (17, 0),
wait(2),
set npc frame (17, 1),
set npc direction (17, left),
resume npcs
jono moves:=false,
wait(1))
else, begin
if (herodirection(me) ==right) then, begin
jono moves:=true,
suspend npcs
set npc position (17, heroX--1, heroY--1),
set npc frame (17, 0),
wait(2),
set npc frame (17, 1),
set npc direction (17, right),
resume npcs
jono moves:=false,
wait(1))
else, begin
if (herodirection(me) ==up) then, begin
jono moves:=true,
suspend npcs
set npc position (17, heroX--1, heroY+1),
set npc frame (17, 0),
wait(2),
set npc frame (17, 1),
set npc direction (17, up),
resume npcs,
jono moves:=false,
wait(1))
else,begin
if (herodirection(me) ==down) then, begin
jono moves:=true,
suspend npcs,
set npc position (17, heroX--1, heroY--1) ,
set npc frame (17, 0),
wait(2),
set npc frame (17, 1),
set npc direction (17, down),
resume npcs,
jono moves:=false,
wait(1))
end #end for the esle begin
end
end
end #end for the tag
end # else begin check tag jono
end #end for the script
#---------------------------------------------------------------------------
# Autorun script
script, autorunmap6 , begin
if (check tag (tag:jono follows me), xor, check tag (tag:honda follows me)) then, begin
friends follow us:=true
end
while (friends follow us ==true) do, begin
if (check tag (tag:honda follows me)==on), then, begin
Alter NPC (4, NPCstat:move type, NPCmovetype:stand still)
Alter NPC (4, NPCstat:move speed,0)
end
if (check tag (tag:jono follows me)==on), then, begin
Alter NPC (17, NPCstat:move type, NPCmovetype:stand still)
Alter NPC (17, NPCstat:move speed,0)
end
place friends on map
end #end of the while command
end #end of the plotscript
#---------------------------------------------------------------------------
script, eachstepscript, begin
if (check tag(tag:honda follows me)==on) then, begin
npcplace
end, else, begin
if (check tag(tag:jono follows me)==on) then, begin
npcplace
end #end for the tag
end #end for the else begin
end# end of plotscript
#---------------------------------------------------------------------------
|
The script works well only when one of the tag is activated and then the npc starts to follow. _________________ It's time to make games! |
|
| 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
|