Post new topic    
Metal Slime
Send private message
Compiling fails but no message 
 PostSun Mar 03, 2013 7:47 pm
Send private message Reply with quote
There is an Error in this script, the import/compiling fails, but there is no messege telling me what's wrong.
I thought i'd report it as a bug, unless this is already known.

I wanted to import/complie plot scripts, as i've almost forgotten everything about plotscripting I played try and error, correcting the mistakes the OHR complained about.
But after I wrote 'case (<20>6) I got no Error messege.

The whole script lookes like this:

include, plotscr.hsd
include, bla.hsi

plotscript, random-battle, begin
# fight a random formation
fight formation (random (1,2))
end

plotscript, die in battle, begin
# checks if the Tag with the ID TAG-ID is set off, and makes you die in battle. If the tag is set on,
# you can't die in battle.


if (check tag(5)==OFF)
then, begin
game over
end
end

plotscript, checking tag and using door, begin
# checks if a tag is true (checktag:Teleport) and then does use a door
if (checktag (tag:Teleport) ) then
(
use door (1)
)
end

plotscript, changing the palette, begin
# changes the default palette
load palette (1)
end

plotscript, ecyclopedia, begin
# uses a random number and then calls the according text box

switch (random (1,10)) do, begin
case (1) do
(
show textbox(1)

)
case (2) do
(
show text box (16)
)
case (3) do
(
show text box (16)
)
case (4) do
(
show text box (16)
)
case (5) do
(
show text box (16)
)
case (6) do
(
show text box (16)
)
case (7) do
(
show text box (16)
)
case (8) do
(
show text box (16)
)
case (9) do
(
show text box (16)
)
end
end

plotscript, radom encounter base, begin
# a random encounter, or an item or just a text messege
switch (random (1,20))
case (>5)
(
#textbox text: There's nothig there!
show textbox (1)
)
case (>6)
# fight against a random formation, in this case one from 1 to 5
fight formation (random (1,5))
)
case (<20)
# a textbox that tells you, you found an item
# give you that item number 1
show textbox (2)
#get item (item,1)
)
end




By retrying, the compilter told me:



Edit: Edit: posting the script workred, must have been a copy past error. xD
Liquid Metal King Slime
Send private message
 
 PostSun Mar 03, 2013 8:17 pm
Send private message Reply with quote
Can you re-post the script using http://pastebin.com/ ?

Posting in the forum without using the code tag destroys any indentation, but even with the code tag, scripts that use comparison operators that contain > and < can be mangled by the forum.

Pastebin will let you post the script cleanly, so I will hopefully be able to figure out what is wrong.
Metal Slime
Send private message
 
 PostSun Mar 03, 2013 8:22 pm
Send private message Reply with quote
This should be the paste-bin link. Smile
http://pastebin.com/Zdz3L8BD
Liquid Metal King Slime
Send private message
 
 PostSun Mar 03, 2013 8:33 pm
Send private message Reply with quote
Oh, yes, now I see the problem.

You cannot use operators in "case" the way you are doing.

this is wrong:

Code:
switch (random (1,20))
case (>5) 
(


If you want to check a range values, you will need to use an if/then. Case is the wrong tool for the job.

Try something more like this

Code:
variable(r)
r := random(1,20)
if(r > 5) then


It also looks as if you are missing a few (

What example were you using to learn how to use the switch/case commands? That example might need to be updated or clarified.
Metal Slime
Send private message
 
 PostSun Mar 03, 2013 9:00 pm
Send private message Reply with quote
Thanks for your help with that script! Smile

I'll try
Code:
variable(r)
r := random(1,20)
if(r > 5) then


The example I used, were some of my old scripts.
I looked them up in the ploctscript dictionary: http://hamsterrepublic.com/ohrrpgce/docs/plotdictionary.html
But I didn't thought about they could be out dated. But on the other hand it's been quite long time, that's why I've forgotten so much. :P

And, what about the compiler giving such a strange message? I'm just courious. Grin
Metal King Slime
Send private message
 
 PostMon Mar 04, 2013 9:58 am
Send private message Reply with quote
Yes, that is a very interesting error message. I would guess that HSpeak is getting stuck in an infinite loop. But I couldn't reproduce it, probably because I am using a different HSpeak version than you.
Metal Slime
Send private message
 
 PostMon Mar 04, 2013 11:05 am
Send private message Reply with quote
I'm using the alectromancy-version. It says so: alectromancy 20120615
Display posts from previous: