Post new topic    
Metal Slime
Send private message
Plotscript Questions 
 PostTue Sep 27, 2011 8:58 am
Send private message Reply with quote
Hello,
I need help with plotscripting, again.

1)
I have written this script.
And get an error message that an end or ) is missig.

Maybe I used to many of ( and )s? Is it okay to use an 'else if' in scripts?

Quote:
plotscript, auto-battle, begin
If (check tag (tag:Winter)), then (fight formation (random (1,2))
else (check tag (tag:Fruehling)), then (fight formation (random (3,4))
else (check tag (tag:Sommer)), then (fight formation (random (5,6))
else (chek tag (tag:Herbst)), then (fight formation (random (7,8))
end
end



2)
Is there a Funktion like system day that gets the systems weekday?
I didn't find one in the plotscript dictionary.

Thank for your help.
Slime Knight
Send private message
Re: Plotscript Questions 
 PostTue Sep 27, 2011 9:19 am
Send private message Reply with quote
Code:
plotscript, auto-battle, begin
if (check tag (tag:Winter)==true))
then (fight formation (random (1,2)))
else

if (check tag (tag:Fruehling)==true))
then (fight formation (random (3,4)))
else

if (check tag (tag:Sommer)==true))
then (fight formation (random (5,6)))
else

if (check tag (tag:Herbst)==true))
then (fight formation (random (7,8)))
else

end

end


Try this code instead, I've corrected parts of the code you where missing several ")"'s as well missing the ==true part in the tag check.

Also what way are you using this? I'd recommend this as the Instead-Of-Battle script if you're not already doing this.

I don't think that there is a System Weekday function, tell me why you're using it and I might be able to suggest a different function in its place.
Metal Slime
Send private message
 
 PostTue Sep 27, 2011 9:58 am
Send private message Reply with quote
Thank you! Grin
I think there where one ) to much, it's working now.
Yes, I wanted to use it as an Instead-Of-Battle script, to make diffrent enemys appear depending on the seasons. Smile

The weekdays I wanted like to use in a simmliar way.
They should set a tags on and off, so I could easyliy use them in the Editor, for example just saying „if tag monday = true“, then the shopkeeper tells you he dosen't work on that day.
The script for the seasons and months will be run everytime you use a door. For the weekdays it sould have been be the same.
At least that was the idea.

I thougt about asking the player on gamestart for the correct weekday. Then I'd have to make a script that counts the weekdays up to 7 and restart again or something like this.
I was just hoping that there'd be a funktion for the weekday, so I didn't think a lot about how to do it manualy xD

But maybe you have an better idea?
Metal Slime
Send private message
 
 PostTue Sep 27, 2011 1:51 pm
Send private message Reply with quote
I just realised that if I try to compile theese two scripts, Hamsterspeak.exe says there is an end missing, if i put an extra end in it, it says there are to many ends in it.
If I complie the scripts one by one, hamster speak dosen't complain at all.
But I have to use both ot them, of course.
I'm confuesd. Confused

Quote:
#-----------------------------------------------------------
plotscript, auto-battle, begin
if (check tag (tag:Winter)==true)
then (fight formation (random (1,2)))
else

if (check tag (tag:Fruehling)==true)
then (fight formation (random (3,4)))
else

if (check tag (tag:Sommer)==true)
then (fight formation (random (5,6)))
else

if (check tag (tag:Herbst)==true)
then (fight formation (random (7,8)))
else

end
end
end
#--------------------------------------------------------------
plotscript, Jahreszeiten, begin

#Abfrage für Montate inc. Jahreszeit
# Achtung: Die Tags müssen wieder auf off gesetzt werden!

# Zuerst off-setztn

# Monate
set tag (tag:januar, off)
set tag (tag:februar, off)
set tag (tag:maerz, off)
set tag (tag:april, off)
set tag (tag:mai, off)
set tag (tag:juni, off)
set tag (tag:juli, off)
set tag (tag:august, off)
set tag (tag:september, off)
set tag (tag:oktober, off)
set tag (tag:november, off)
set tag (tag:dezember, off)
# Jahreszeiten
set tag (tag:Winter, off)
set tag (tag:Fruehling, off)
set tag (tag:Sommer, off)
set tag (tag:Herbst, off)

#Abfrage und on-setzen
switch ( system month ) do, begin
case (1) do
(
set tag (tag:januar, on)
set tag (tag:Winter, on)
#optional
show text box (15)
)
case (2) do
(
set tag (tag:februar, on)
set tag (tag:Winter, on)
#optional
show text box (16)
)
case (3) do
(
set tag (tag:maerz, on)
set tag (tag:Fruehling, on)
#optional
show text box (17)
)
case (4) do
(
set tag (tag:april, on)
set tag (tag:Fruehling, on)
#optional
show text box (18)
)
case (5) do
(
set tag (tag:mai, on)
set tag (tag:Fruehling, on)
#optional
show text box (19)
)
case (6) do
(
set tag (tag:juni, on)
set tag (tag:Sommer, on)
#optional
show text box (20)
)
case (7) do
(
set tag (tag:juli, on)
set tag (tag:Sommer, on)
#optional
show text box (21)
)
case (8) do
(
set tag (tag:august, on)
set tag (tag:Sommer, on)
#optional
show text box (22)
)
case (9) do
(
set tag (tag:september, on)
set tag (tag:Herbst, on)
#optional
show text box (23)
)
case (10) do
(
set tag (tag:oktober, on)
set tag (tag:Herbst, on)
#optional
show text box (24)
)
case (11) do
(
set tag (tag:november, on)
set tag (tag:Herbst, on)
#optional
show text box (25)
)
case (12) do
(
set tag (tag:dezember, on)
set tag (tag:Winter, on)
#optional
show text box (14)
)
end
end
end
Metal Slime
Send private message
 
 PostTue Sep 27, 2011 2:28 pm
Send private message Reply with quote
Why are there 3 end's at the end of Jahreszeiten? Seems to me there should only be two of them there (one for the switch function, one for the script). My guess is that when you do them separately, you are only doing the first script (which seems fine).
I am Srime
Metal Slime
Send private message
 
 PostTue Sep 27, 2011 2:41 pm
Send private message Reply with quote
Thanks!
I removed the end that was to much.

but now HamsterSpeak.exe says:
Quote:
Error in line 2 (...) expected top-level declaration but found plotscript.


What does top-level declaration mean? Is it something like 'include' ?
Metal Slime
Send private message
 
 PostTue Sep 27, 2011 2:53 pm
Send private message Reply with quote
Remember to 'include, plotscr.hsd' at the beginning of your script!
Metal Slime
Send private message
 
 PostTue Sep 27, 2011 3:16 pm
Send private message Reply with quote
I did.
I also included the .hsi - file as well. But i forgot to update it...
I did export the new .hsi-file, and after that i tryed to compile both scripts and got an other error:
Quote:
ERROR: in line 1254 of plotscr.hsd
0, script
Expected script trigger name, but found declaration script


Sad
Liquid Metal King Slime
Send private message
 
 PostTue Sep 27, 2011 3:32 pm
Send private message Reply with quote
I find that indenting your script makes it much easier to find errors with mismatched "(" or "begin" and ")" or "end"

Here is what your auto-battle script looks like if you properly indent all your "then" and "else" blocks. You were missing a )

Code:

plotscript, auto-battle, begin
  if (check tag (tag:Winter)==true) then(
    fight formation(random (1,2))
  )else(
    if (check tag (tag:Fruehling)==true) then(
      fight formation (random (3,4))
    )else(
      if (check tag (tag:Sommer)==true) then(
        fight formation (random (5,6))
      )else(
        if (check tag (tag:Herbst)==true) then(
          fight formation (random (7,8))
        )else(
        )
      )
    )
  )
end


Here is another way of writing the same script. it uses no "else" blocks, so the indentation and parenthesis is less confusing:

Code:

plotscript, auto-battle, begin
  if (check tag (tag:Winter)==true) then(
    fight formation(random (1,2))
    exit script
  )
  if (check tag (tag:Fruehling)==true) then(
    fight formation (random (3,4))
    exit script
  )
  if (check tag (tag:Sommer)==true) then(
    fight formation (random (5,6))
    exit script
  )
  if (check tag (tag:Herbst)==true) then(
    fight formation (random (7,8))
    exit script
  )
end
Metal Slime
Send private message
 
 PostTue Sep 27, 2011 3:53 pm
Send private message Reply with quote
Thanks!

I used your version of the script.
But I do still get the error about plotscr.hsd. Confused
Liquid Metal King Slime
Send private message
 
 PostTue Sep 27, 2011 3:58 pm
Send private message Reply with quote
Quote:
ERROR: in line 1254 of plotscr.hsd
0, script
Expected script trigger name, but found declaration script



This is a strange error message. Maybe you have an old copy of plotscr.hsd? I looked at line 1254, and on that line was just "end" Then I searched for "0, script" and that was on line 1347

What version of custom are you using?

Could you please open plotscr.hsd and copy-and paste it to http://pastebin.com/ then post the pastebin url here.
Metal Slime
Send private message
 
 PostTue Sep 27, 2011 4:01 pm
Send private message Reply with quote
I think you've included plotscr.hsd twice in your script by accident. I get the same error message if I try to compile a script that has two lines of 'include, plotscr.hsd'.
Metal Slime
Send private message
 
 PostTue Sep 27, 2011 4:25 pm
Send private message Reply with quote
Hey, thank you!
Oh, I did include it twice. Sorry. -.-"
I removed it and now i could compile the script! Grin

@James: I'm using ypsilonform+2 on my laptop. Shall I still send the plotscr.hsd copy?
Liquid Metal King Slime
Send private message
 
 PostTue Sep 27, 2011 4:37 pm
Send private message Reply with quote
marionline wrote:

@James: I'm using ypsilonform+2 on my laptop. Shall I still send the plotscr.hsd copy?


No need to send the plotscr.hsd copy now. SOunds like RMSephy solved your problem :)

ypsiliform+2 is pretty old. Zenzizenzic has a lot of bugfixes.
Metal Slime
Send private message
 
 PostTue Sep 27, 2011 4:44 pm
Send private message Reply with quote
Thanks to everyone, who helped! Grin
Finally the scritps do run! Smile

I'll start using the newer version of the OHR on my netbook.
Display posts from previous: