Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Could somoene help me with a script ?
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Tue Oct 11, 2005 7:33 am    Post subject: Could somoene help me with a script ? Reply with quote

I've made this key is pressed script. It works when I use it but after a few
seconds I see the message "script error" interpreter overloaded.

Could somoene help me to solve this problem ?
As always thanks very much for the help !
#---------------------------------------------------------------------------
script, getquickscript, begin

suspend Npcs
suspend player

if (check tag(tag:acc)==ON) then, begin
running:=false
if ((running==false),and, (key is pressed (any key)==false) )then , begin

if (herodirection(me)==right) then, begin
(running:=true)
(set hero speed (me, 11)), then,
(walk hero (me, east, 2)),then,
(set hero speed (me, 4)), then,
(wait for hero (me)), then,
(running:=false), then
(wait (3)))
else, begin

if (herodirection(me)==left)then,begin
(running:=true)
(set hero speed (me, 11)), then,
(walk hero (me, west, 2)), then,
(set hero speed (me, 4)), then,
(wait for hero (me)), then,
(running:=false), then
(wait (3)))
else, begin

if (herodirection(me)==up)then,begin
(running:=true)
(set hero speed (me, 11)), then,
(walk hero (me, north, 2)),then,
(set hero speed (me, 4)), then,
(wait for hero (me)), then,
(running:=false), then
(wait (3)))
else, begin

if (herodirection(me)==down) then, begin
(set hero speed (me, 11)), then,
(walk hero (me, south, 2)),then,
(set hero speed (me, 4)), then,
(wait for hero (me)), then,
(running:=false), then
(wait (3)))


resume Npcs
resume player
end
#--------------------------------------------------------------------------------


The get script you can read above is autorun script. (but the script luna follows me isn't)

The key is pressed script contains the following code

#-------------------------------------------------------------------------
#This script allows the pet to follow the hero as the tag is checked "on"
#the script is on all the maps as the "on-keypressedscript"

script, luna follows me, begin

hero is walking (0) #substitute this for the hero you want
hero direction (0) #=direction
npcplace #(*,*,direction,*)
my keyboard

if (launchgetquickscript)then, begin
get quick script
end

if (launchpausescript) then, begin
mypausescript
end

end #end on the plotscript
#------------------------------------------------------------------------
#This script allows me to customise the keyboard

script, my keyboard, begin

suspend npcs
suspend player

if (key is pressed(key: r), and, jumping == false, and, hero is walking(me) == false) then (

variable (tilex, tiley)
tilex := hero x(me)
tiley := hero y(me)
if (hero direction(me) == north) then (tiley -= 2)
if (hero direction(me) == south) then (tiley += 2)
if (hero direction(me) == east) then (tilex += 2)
if (hero direction(me) == west) then (tilex -= 2)
#now check if they can jump to the tile 2 spaces ahead
if (readmapblock(tilex, tiley) == 10) then,
(jumping := true ) then,

(variable (i, walkx, walky, hx, hy, jump) #Debut du code pour le saut
suspend player
suspend Npcs
if (hero direction(me) == north) then (walky := -4) #walk at normal speed north
if (hero direction(me) == south) then (walky := 4)
if (hero direction(me) == east) then (walkx := 4)
if (hero direction(me) == west) then (walkx := -4)
jump := -5
hx := hero pixel x(me)
hy := hero pixel y(me)
for (i, 0, 10) do (
put hero (me, hx, hy + jump)
hx := hero pixel x(me) + walk x
hy := hero pixel y(me) + walk y
jump += 1
wait
)
resume player
resume npcs
end, then, #fin du code pour le saut
(jumping := false)
end # end of the jump script

if (key is pressed(key: z))
then, begin
#Key is pressed z pour accelerer
set tag (tag:acc, ON)
launchgetquickscript:=true
end

if (key is pressed(key: numlock)), then, begin #Key is pressed pour faire pause
set tag (tag:pause, ON)
#Key is pressed numlock pour faire pause
#increment (pauseispressed, 13)
launchpausescript:=true
end

#if (check tag(149)==OFF) then, begin
#if (wait for key (menukey))then, begin
#launchlockedkeyboard:=true
#end #end of the wait for key command
#end #end of the tag

Resume npcs
Resume player

end #end of the plotscript here


Some explanations:

The global variables allows me to launch the script from the key is pressed script. The global variable check command are on the keyboard script because if I put on other place the command simply doesn't work.

Feel free to ask for further details if there are still things that you don't understand because as everybody has already noticed, I am very good to make myself missunderstood!

Anyway, thanks very much for keeping on providing help and support!


bis_senchi
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Raekuul
Delicious!




Joined: 31 Mar 2004
Posts: 641
Location: Nowhere

PostPosted: Tue Oct 11, 2005 8:39 am    Post subject: Reply with quote

Are you *supressing minor warnings?
_________________
A broken clock is still right twice a day.
Back to top
View user's profile Send private message Visit poster's website
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Wed Oct 12, 2005 11:58 pm    Post subject: ?? What do mean by minor warnings ? Reply with quote

It's the first I've heard about "minor warnings". Could you please explain me what it is ??

Thanks for the help !
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Uncommon
His legend will never die




Joined: 10 Mar 2003
Posts: 2503

PostPosted: Thu Oct 13, 2005 6:31 am    Post subject: Reply with quote

That means it doesn't whine at you for defining variables you don't use, etc, etc.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Sat Oct 15, 2005 8:51 am    Post subject: Here is what happen Reply with quote

When I compile the script there are no error message. When I press w the character walk but when I start to press a key as the phero gets quick on the screen I got the following error message.

"script error. Interpreter overloaded ". and then "failed to load script 48" (that is to say my on-kepressed script which I named "luna follows me")

Feel free to ask for further informations!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Ysoft_Entertainment
VB Programmer




Joined: 23 Sep 2003
Posts: 810
Location: Wherever There is a good game.

PostPosted: Sat Oct 15, 2005 6:47 pm    Post subject: Reply with quote

ok, first of all, you cannot have multiple "then" without "if", and your quick script is full of them.
_________________
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
View user's profile Send private message Send e-mail Visit poster's website
tgfcoder




Joined: 14 Oct 2005
Posts: 37
Location: Australia

PostPosted: Sat Oct 15, 2005 7:20 pm    Post subject: Hmm Reply with quote

The code is REALLY poorly structured. It needs to be in a code tag, or at least be consistent with begin's with enclosing ends. Luckily for you I have rewritten it! I'm not an expert at this, there still may be bugs.

Code:

script, getquickscript, (
  suspend npcs
  suspend player

  if (check tag(tag:acc) == 1) then, (
    running := false

    if ((running==false), and, (key is pressed (any key) == false)) then, (
      if (herodirection(me) == right) then, (
        running := true
        set hero speed (me, 11)
        walk hero (me, east, 2)
        set hero speed (me, 4)
        wait for hero (me)
        running := false
        wait (3)
      )
      else, (
        if (herodirection(me) == left) then, (
          running := true
          set hero speed (me, 11)
          walk hero (me, west, 2)
          set hero speed (me, 4)
          wait for hero (me)
          running := false
          wait (3)
        )
      )
      else, (
        if (herodirection(me) == up) then, (
          running := true
          set hero speed (me, 11)
          walk hero (me, north, 2)
          set hero speed (me, 4)
          wait for hero (me)
          running := false
          wait (3)
        )
      )
      else, (
        if (herodirection(me) == down) then, (
          set hero speed (me, 11)
          walk hero (me, south, 2)
          set hero speed (me, 4)
          wait for hero (me)
          running := false
          wait (3)
        )
      )
    )
  )

resume npcs
resume player

)


I assume that's the way you want it to work, as I have no idea what you're trying to accomplish, also with no intention of trying to figure out Ha ha ha!

As for the Luna Follows Me script, I dunno what I can do there.
Hope it helps Really confused
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Oct 16, 2005 4:15 am    Post subject: Reply with quote

An if can't have more than one then or else. If it does, it is ignored, and everything is run anyway. Something like
Code:

if (something)
then (do something)
then (do something more)
then (do even more)

if (is it A?)
then (is A)
else (
  if (is it B?)
  then (not A, is B)
)
else (
  if (is it C?)
  then (not A or B, is C)
)


Is wrong and should be

Code:

if (something)
then (
  do something
  do something more
  do even more
)

if (is it A?)
then (is A)
else (
  if (is it B?)
  then (not A, is B)
  else (
    if (is it C?)
    then (not A or B, is C)
  )
)




Firstly, you should probably not use a speed of 11, this does not divide into 20. If your hero gets misaligned, change the speed from 11 to 10.

I think you can get the scripts working with a few small changes without needing to rewrite it.

Firstly, I changed tgf's version of getquickscript a little futher. I removed the line
running := false
because otherwise running is ALWAYS false on the next line, if ((running==false) ... . The point of having running is to stop the code from being run again if it already is happening.

Also, I removed the elses because they do nothing.

Code:
script, getquickscript, (
  suspend npcs
  suspend player

  if (check tag(tag:acc) == 1) then, (
    if ((running==false), and, (key is pressed (any key) == false)) then, (
      if (herodirection(me) == right) then, (
        running := true
        set hero speed (me, 11)
        walk hero (me, east, 2)
        set hero speed (me, 4)
        wait for hero (me)
        wait (3)
        running := false
      )
      if (herodirection(me) == left) then, (
        running := true
        set hero speed (me, 11)
        walk hero (me, west, 2)
        set hero speed (me, 4)
        wait for hero (me)
        wait (3)
        running := false
      )
      if (herodirection(me) == up) then, (
        running := true
        set hero speed (me, 11)
        walk hero (me, north, 2)
        set hero speed (me, 4)
        wait for hero (me)
        wait (3)
        running := false
      )
      if (herodirection(me) == down) then, (
        set hero speed (me, 11)
        walk hero (me, south, 2)
        set hero speed (me, 4)
        wait for hero (me)
        wait (3)
        running := false
      )
    )
  )

resume npcs
resume player

)


Next, I got rid of more extra then's which break the code in the jumping part of mykeyboard. Replace your code with this:

Code:

if (key is pressed(key: r), and, jumping == false, and, hero is walking(me) == false) then (

  variable (tilex, tiley)
  tilex := hero x(me)
  tiley := hero y(me)
  if (hero direction(me) == north) then (tiley -= 2)
  if (hero direction(me) == south) then (tiley += 2)
  if (hero direction(me) == east) then (tilex += 2)
  if (hero direction(me) == west) then (tilex -= 2)
  #now check if they can jump to the tile 2 spaces ahead
  if (readmapblock(tilex, tiley) == 10) then(
    jumping := true

    variable (i, walkx, walky, hx, hy, jump) #Debut du code pour le saut
    if (hero direction(me) == north) then (walky := -4) #walk at normal speed north
    if (hero direction(me) == south) then (walky := 4)
    if (hero direction(me) == east) then (walkx := 4)
    if (hero direction(me) == west) then (walkx := -4)
    jump := -5
    hx := hero pixel x(me)
    hy := hero pixel y(me)
    for (i, 0, 10) do (
      put hero (me, hx, hy + jump)
      hx := hero pixel x(me) + walk x
      hy := hero pixel y(me) + walk y
      jump += 1
      wait
    )

    #fin du code pour le saut
    jumping := false
  )
) # end of the jump script


I also got rid of the extra suspend and resume statements.

Tell me if that works Happy
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
tgfcoder




Joined: 14 Oct 2005
Posts: 37
Location: Australia

PostPosted: Sun Oct 16, 2005 12:13 pm    Post subject: Reply with quote

Wow, teamwork. Someone who actually knows PS? Amazing; I'm so used to low level coding I try to deallocate memory in OHR. Neutral Crying

Code:

script, end, (
  if (check tag(10)), (
    deallocate(1024)
    game over
  )
  else, (
    show text box(29)
  )
)


Spot which line the compiler caught.
Back to top
View user's profile Send private message
Mike Caron
Technomancer




Joined: 26 Jul 2003
Posts: 889
Location: Why do you keep asking?

PostPosted: Sun Oct 16, 2005 6:56 pm    Post subject: Reply with quote

is it the check tag bit? Those tricky HamsterSpeak gremlins are all over the place... Wink

And, you'll find that anyone named "The Mad Cacti" or "Moogle1" or "James Paige" will know more about plotscripting than there is to know. Really.
_________________
I stand corrected. No rivers ran blood today. At least, none that were caused by us.

Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
tgfcoder




Joined: 14 Oct 2005
Posts: 37
Location: Australia

PostPosted: Mon Oct 17, 2005 1:38 am    Post subject: Reply with quote

=Lolx:)
Back to top
View user's profile Send private message
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Sat Oct 22, 2005 6:49 am    Post subject: Reply with quote

I've tested the new get script several times and I have bad news. It doesn't work. The interperter is still overloaded and there are problems to launch the script lunafollowsme.

Does anyone could make a script map? what script is suposed to launch sub-scripts ? Here's the pic in my mind

Luna follows me

sub-script A get quickscript launched with a global variable. go to my keyboard script and then to get quick script.
sub-script B get pausescript launched with a global variable. go to me keyboard script and then to the pause script

On the keyboard tags are turned on and are required by the script to start.
I would also like to add an sub script C that would allows me to lock the keyboard.

I make launch scripts from the keyboard script because the script were too big. Launching script from my keyboard script is the only to make the keyispressed command valid. If I make launched the script directly from Lunafollowsme, nothing happens when I press the keys.

Could somoene help me to solve this problem ?
Thanks in advance for the help!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mike Caron
Technomancer




Joined: 26 Jul 2003
Posts: 889
Location: Why do you keep asking?

PostPosted: Sat Oct 22, 2005 9:01 am    Post subject: Reply with quote

You can easily use keyispressed from another type of script by having a loop:

Code:
variable(waiting)
waiting:= true
while(waiting) do, begin
if(key is pressed(any key)) then (waiting:= false)
wait(1) #really important!!!!!1
end


So, your script would probably look something like this:

Code:
while(true) do, begin #loop forever (make sure it's only launched once!!!!!!!)
  if(check tag(tag:asc), and, key is pressed(any key)) then, begin
    #... put the conditionals in here
  end
  wait(1) #really really really ... important.
end

_________________
I stand corrected. No rivers ran blood today. At least, none that were caused by us.

Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Raekuul
Delicious!




Joined: 31 Mar 2004
Posts: 641
Location: Nowhere

PostPosted: Sun Oct 23, 2005 3:49 am    Post subject: Reply with quote

Even though the wait would get done every-single-time a key is pressed...
_________________
A broken clock is still right twice a day.
Back to top
View user's profile Send private message Visit poster's website
Mike Caron
Technomancer




Joined: 26 Jul 2003
Posts: 889
Location: Why do you keep asking?

PostPosted: Mon Oct 24, 2005 10:08 am    Post subject: Reply with quote

Nonono, this isn't an onkeypress script. Read what I said:

Me wrote:
You can easily use keyispressed from another type of script by having a loop:

_________________
I stand corrected. No rivers ran blood today. At least, none that were caused by us.

Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
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