 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
DemocraticAnarchist Sleep Deprived

Joined: 26 Apr 2003 Posts: 137 Location: :noitacoL
|
Posted: Sat May 17, 2003 12:57 pm Post subject: Sequenced boxes? |
|
|
Hey people.
I made a script to display news articles when you used a newspaper. It displays a text box, turns on a tag, displays another box which turns on a tab and resets the first one etc..
The thing i it freezes after the second box is shown. Any ideas?
Thanx. |
|
Back to top |
|
 |
Grandtrain
Joined: 02 Feb 2003 Posts: 85
|
Posted: Sat May 17, 2003 1:59 pm Post subject: |
|
|
I don't get it. Why are you turning on and off tags? |
|
Back to top |
|
 |
DemocraticAnarchist Sleep Deprived

Joined: 26 Apr 2003 Posts: 137 Location: :noitacoL
|
Posted: Sun May 18, 2003 10:11 am Post subject: Heh... |
|
|
To be honest i dont really know I want to display one of four text boxes when an npc is used, but in random order. I dont know what value random (x,y) returns, or whether it can be used in if statements, so i was screwing around with tags-
Code: |
include, plotscr.hsd
include, plotscr.hsi
global variable (10,shownnews)
define script (11,mapstart,none)
script, mapstart, begin
set tag (34,on) #news1 is current item
set tag (35,off)#and others are not
set tag (36,off)
set tag (37,off)
write global (10,0)
end
define script (35,randnewsrandomize,none)
script, randnewsrandomize, begin
random (1,4)
if (random==1)
set variable (shownnews,1)
else if (random==2)
set variable (shownnews,2)
else if (random==3)
set variable (shownnews,3)
else if (random==4)
set variable (shownnews,4)
end
define script (36,randnews,none)
script, randnews, begin
suspend player
if (shownnews==1)
then (show text box (68)
else if (shownnews==2)
then (show text box (69)
else if (shownnews==3)
then (show text box (70)
else if (shownnews==4)
then (show text box (71)
set variable (shownnews,0)
resume player
end
|
The 1st script is called on entering the map
The 2nd is called on walking within 1 space of the npc
The 3rd is on use of Npc
Ideas?
Thanx
[/code] |
|
Back to top |
|
 |
Blazes Battles Inc. I'm a chimp, not a
Joined: 25 Jan 2003 Posts: 505
|
Posted: Sun May 18, 2003 10:50 am Post subject: |
|
|
Ah... I don't have time to explain most of the errors, but from what I see, the first script is entirely unneeded. If you need the tags thing for some unseen reason, add it into the script I'm going to post. And the second script can be put into the third. And you don't need a global variable, just a normal variable. And 'plotscr.hsi' won't make any sense unless your rpg is plotscr.rpg. Remember you need to export the script stuff before using it, and I'll change that to 'filename.hsi.' Please replace filename with your RPG names, and also note that this script doesn't require the .hsi file at all.
The following script will be triggered by the npc.
Anyway, here's how it should be read:
Code: | include, plotscr.hsd
include, filename.hsi
define script (36,randnews,none)
script, randnews, begin
variable (shownnews)
set variable (shownnews,random(1,4))
if (shownnews==1)
then(show text box(68)
wait for text box)
else(if(shownnews==2)
then(show text box (69)
wait for text box)
else(if(shownnews==3)
then(show text box (70)
wait for text box)
else(show text box (71)
wait for text box)))
end |
Basically, you don't understand if statements (you were missing parentheses in scripts two and three, and you forget 'then' statements in script two, and you don't need the final if statement in scripts two and three) and have some unnecesary commands. Suspend and resume player commands aren't necesary because when a text box is shown you can't do anything anyway. You also don't understand variables too well (you had a 'random' command, but then tried to use it as a variable, which you can't because it wasn't defined and because random is a plotscripting command, and didn't ever define shownnews as anything other than 0 because of it. Also, you don't need to use 'write global' in that first script because the global variable is already defined. Thus, you only need 'set variable'. I, however, changed it from a global variable to a normal variable because global variables are unnecesary unless you want the information carried to different maps, which wasn't necesary in the script.). Finally, you split up scripts too much. Frankly, the tags at the beginning are completely unneeded unless you were going to use them for something else, in which case, write them back in at the top of the script I posted. _________________ Preserve OHR history! Do it for the children! |
|
Back to top |
|
 |
DemocraticAnarchist Sleep Deprived

Joined: 26 Apr 2003 Posts: 137 Location: :noitacoL
|
Posted: Mon May 19, 2003 12:26 pm Post subject: Thanx |
|
|
Heh. That was a stupid mistake w/ the parenthesis. I was typing, not copy&paste and i cant type for nuts. That ant the hsi/hsd thing weren't actually in th real script. Thanks for pointing out t=how to use random properly. Damn dictionary of commands says nowt about how to use it  |
|
Back to top |
|
 |
Blazes Battles Inc. I'm a chimp, not a
Joined: 25 Jan 2003 Posts: 505
|
Posted: Mon May 19, 2003 5:56 pm Post subject: |
|
|
Heh, it's better that you weren't copying and pasting. It takes too much time, takes too long to find things and you don't learn anything. And about the random thing, for future reference, whenever a command returns a value it's (basically) useless unless used with a command that's either a logic operator or does something in the actual game, visible or otherwise... or used to help define another value, but then that's also useless unless whatever, and so on. _________________ Preserve OHR history! Do it for the children! |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Thu May 22, 2003 8:53 am Post subject: super-simplified random news script |
|
|
This script can be made even simpler.
Code: |
script, randnews, begin
show text box(random(68,71))
wait for text box
end
|
All it does is pick a random number from 68 to 71 and then use that as the text box number. Simple as pie! (why is pie simple? Delicious, yes, but why simple (well, MOST pie is delicious. I don't care for cherry pie personally.))
The only reason you would need to use a series of "if" "then" statements is if your news-article text-boxes were not in order, for example:
Code: |
script, randnews, begin
variable(shownews)
shownews:=random(1,4)
if(shownews==1)
then(show text box(157))
if(shownews==2)
then(show text box(13))
if(shownews==3)
then(show text box(28))
if(shownews==4)
then(show text box(6))
wait for text box
end
|
|
|
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
|