|
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Mon Mar 16, 2009 9:56 pm Post subject: All right! I've made some tests and... |
|
|
Code: |
script, test string, begin
suspend player
$1="Hello "
#get hero name (2, hero:bob)
show text box (17)
wait for text box
resume player
end
|
All right! Here is a new version of the script! I have no problems with the first part : "Hello" appears but when I try to add the line (get hero name (2, hero:bob)) I see the whole things (get hero name (2, hero:bob)) in the text box instead of just the name.
The plotscript dictionnary says that the data will be stick into a string thanks to the command : how do I find in which string the data have been sticked and how do I make it appear on screen?
As always thanks for answering so quickly and so efficiently! _________________ It's time to make games! |
|
Back to top |
|
|
Spoon Weaver
Joined: 18 Nov 2008 Posts: 421 Location: @home
|
Posted: Mon Mar 16, 2009 10:34 pm Post subject: |
|
|
it's kind of funny, because right on the wiki page for the get hero name command it states that you can't use the hero:name constant.
http://hamsterrepublic.com/ohrrpgce/index.php/Plot_Get_hero_name.html
Quote: | how do I find in which string the data have been sticked and how do I make it appear on screen? |
You choose which string it goes into with the get hero name command.
get hero name (STRING#,hero#)
and you need simply to and the code ${s2} into a text box to have it show.
anyways, this is what you're looking for I think. Assuming, bob is the first character.
Code: | script, test string, begin
suspend player
$1="Hello "
get hero name (2, 0)
show text box (17)
wait for text box
resume player
end
|
And make sure text box 17 says, ${s1} ${s2}
Shortcut time: You don't need a script to do this. All you would need is a textbox that says, " Hello ${h0} "
I'm kinda of bewildered as to the reason for all this trouble you're going through. |
|
Back to top |
|
|
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Wed Mar 18, 2009 4:42 am Post subject: It works! Amazing! |
|
|
It works! amazing!
Hello! uses string 1 and get hero name uses string 2
How come that we can store using those numbers? Aren't they supposed to be used already?
Well that's really worthes to know that you can do things this way! Thanks a lot!
And guess what? I've got another problem
Code: |
script, go to the HQ, begin
suspend player
suspend Npcs
set on keypress script (none)
if (check tag(tag: choose HQ)==ON) #faire des recherches avec map: current map
then, begin
set variable (YourM,current map) #permet d'enregistrer notre position dans le jeu
set variable (YourX,herox(me))
set variable (YourY,heroy(me))
wait (8)
fade screen out (63,63,63)
tweak palette (63,63,63)
teleport to map (51, 9, 6)
wait (5)
reset palette
fade screen in
# show text box # Je peux éventuellement faire un commentaire à l'arrivée au Hq
end
set on keypress script (48)
Resume player
Resume Npcs
end
|
When I run the following script everything is fine but when I launch the reverse script, I come back to the right map but at 9, 6.
It appears that myX and myY location is stored in the variable a bit later in the same time as the teleport to map
That would explain why I came back to 9,6
Code: |
#This script is when you come from the HQ
script, go back from the HQ, begin
suspend player
suspend Npcs
if (check tag(tag: go back to party)==ON)
then, begin
fade screen out (63, 63, 63)
tweak palette (63,63,63)
teleport to map (YourM, YourX, YourY)
wait (5)
reset palette
fade screen in
end #end of the of check tag
Resume player
Resume Npcs
end
|
My question is very simple: how can I solve this little bug? _________________ It's time to make games!
Last edited by bis_senchi on Tue Mar 24, 2009 1:08 am; edited 1 time in total |
|
Back to top |
|
|
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sat Mar 21, 2009 10:27 pm Post subject: So? |
|
|
So? Could someone help me with this new problem? Thanks in advance for the help! _________________ It's time to make games! |
|
Back to top |
|
|
Spoon Weaver
Joined: 18 Nov 2008 Posts: 421 Location: @home
|
Posted: Sun Mar 22, 2009 1:06 am Post subject: |
|
|
um, without fully knowing how the script is run in the game I couldn't know for sure, but it's seems like the script might be running twice. maybe...
or it could be that the set variable (yourx,herx(me)) commands are faulty in some unknown way. which might make yourx be ignored.
or yourx might be a hidden built in global varible (which would be really neat and easier to use, but unlikely)
my advise is to try fiddling around with the script and whatever is activating the scripts till you either fix it, or get a different outcome that might give more insight as to the cause of the problem |
|
Back to top |
|
|
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sun Mar 22, 2009 1:45 am Post subject: |
|
|
I agree, it looks like maybe the script is running twice. Which script is ID 48? Do you have any other script that modifies YourX and YourY? Is there an autorun script on map 51? _________________ "It is so great it is insanely great." |
|
Back to top |
|
|
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sun Mar 22, 2009 9:54 pm Post subject: What tests should I do? |
|
|
Hello !
The Mad Cacti wrote: | Which script is ID 48? |
Well this is mykeypress script. The arrows key have been reinterpreted
with x,y detection to make an npc able to follow me
The Mad Cacti wrote: | Is there an autorun script on map 51? |
Yes there is!
Code: |
#Autorun script for map 51: Sailors HQ
script, map sailormoon51 , begin
while (my keyboard locked==true) do, begin
keyboard locked
end
while (place luna ==true) do, begin
place luna2
end
if (check tag(tag:lunafollowsme)==ON) then, begin
suspend player
suspend npcs
place luna:= true
wait (1)
resume player
resume npcs
end, else, begin # si le tag est off
create Npc (0, 2, 1) #Le Npc est invisible
alter NPC (0, Npcstat:picture, 0)
alter NPC (0, Npcstat:palette, 0)
wait for npc (0)
end #end of the if check tag
end #end of the plotscript
|
Each time the main hero (Usagi) the autorun check if Luna follows her or not. If she is an autonumber script (place luna 2) see above check if there is already a copie of the npc on the map and place it (using X,Y detection)
Code: |
# On place Luna sur toutes les cartes sauf la maison de sailormoon
script, place luna2, begin
if (check tag (tag:Npc1Artemis)==ON) then, begin
#On transforme Luna en Artemis car c'est Venus qui prend les commandes
suspend player
suspend npcs
alter NPC (0, Npcstat:picture, 37)
alter Npc (0, Npcstat:palette, 14)
wait for npc (0)
wait (1)
resume player
resume npcs
end #end for if tag artemis
if (check tag (tag:lunafollowsme)==ON),then, begin
variable (Npc storage)
NPC storage:=npc reference(0,0)
if ((npc reference(0, 0)==NPC storage)==true) then, begin # if the original npc is not on the map then, begin
# things that happen if there are no copies of NPC ID 0 on the map
suspend npcs
suspend player
set variable (YourX,herox(me)) # On enregistre notre position sur la carte.
set variable (YourY,heroy(me))
set variable (MyDirection, hero direction(me))
if (MyDirection == left) then, begin
create NPC (0, (YourX +1),(YourY (0)), left),
place luna:= false
luna moves:= false
wait(1)
resume npcs
resume player
end, else, begin
if (MyDirection == right) then, begin
create NPC (0, (YourX --1),(YourY (0)), right),
place luna:= false
luna moves:= false
wait(1)
resume npcs
resume player
end, else, begin
if (MyDirection == up) then, begin
create NPC (0, (YourX),(YourY +1), up),
place luna:= false
luna moves:= false
wait(1)
resume npcs
resume player
end, else, begin
if (MyDirection == down) then, begin
create NPC (0, (YourX),(YourY --1), down),
place luna:= false
luna moves:= false
wait(1)
resume npcs
resume player
end #end of the last if directs
end
end
end
end, else, begin
suspend npcs
suspend player
# below things that happen if there is already an npc(0) on the map
set variable (YourX,herox(me)) # On enregistre notre position sur la carte.
set variable (YourY,heroy(me))
set variable (MyDirection, hero direction(me))
if (MyDirection == left) then, begin
set Npc position (0, (YourX +1),(YourY)),
set Npc direction (0, left),
place luna:= false
luna moves:= false
wait(1)
resume npcs
resume player
end, else, begin
if (MyDirection == right) then, begin
set Npc position (0, (YourX --1),(YourY)),
set Npc direction (0, right),
place luna:= false
luna moves:= false
wait(1)
resume npcs
resume player
end, else, begin
if (MyDirection == up) then, begin
set Npc position (0, (YourX),(YourY +1)),
set Npc direction (0, up),
place luna:= false
luna moves:= false
wait(1)
resume npcs
resume player
end, else, begin
if (MyDirection == down) then, begin
set NPC position (0, (YourX),(YourY--1)),
set npc direction (0, down),
place luna:= false,
luna moves:=false,
wait(1)
resume npcs
resume player
end #end of the last if direct
end #end of else begin between if directs
end
end
end #end for the if npc ref
end #end for the if (check tag (tag:luna follows))...
# Artemis and Dimos are Npc 0 and Npc16
if (check tag(tag:artemis follows me)==ON) then, begin
NPC storage:=npc reference(16,0)
if ((npc reference(16, 0)==NPC storage)==true) then, begin # if Npc 16 is not already on the map then...
suspend npcs
suspend player
set variable (YourX,herox(me)) # On enregistre notre position sur la carte.
set variable (YourY,heroy(me))
set variable (MyDirection, hero direction(me))
if (MyDirection == left) then, begin
create NPC (16, YourX +1, YourY--1),
Alter NPC (16, NPCstat:move type, NPCmovetype:wander),
Alter NPC (16, NPCstat:move speed,0) ,
set npc direction (16, MyDirection),
place artemis:= false,
artemis moves:= false,
wait(1),
resume npcs,
resume player,
end, else, begin
if (MyDirection == right) then, begin
create NPC (16, YourX--1, YourY--1),
Alter NPC (16, NPCstat:move type, NPCmovetype:wander),
Alter NPC (16, NPCstat:move speed,0) ,
set npc direction (16, MyDirection),
place artemis:= false,
artemis moves:= false,
wait(1),
resume npcs,
resume player,
end, else, begin
if (MyDirection == up) then, begin
create NPC (16, YourX--1, YourY+1),
Alter NPC (16, NPCstat:move type, NPCmovetype:wander),
Alter NPC (16, NPCstat:move speed,0) ,
set npc direction (16, MyDirection),
place artemis:= false,
artemis moves:= false,
wait(1)
resume npcs
resume player
end, else, begin
if (MyDirection == down) then, begin
create NPC (16, YourX--1, YourY--1),
Alter NPC (16, NPCstat:move type, NPCmovetype:wander),
Alter NPC (16, NPCstat:move speed,0) ,
set npc direction (16, MyDirection),
wait(1)
place artemis:= false,
artemis moves:= false,
resume npcs
resume player
end #end of the if directs
end
end
end
end, else, begin
suspend npcs
suspend player
set variable (YourX,herox(me)) # On enregistre notre position sur la carte.
set variable (YourY,heroy(me))
set variable (MyDirection, hero direction(me))
Alter NPC (16, NPCstat:move type, NPCmovetype:wander)
Alter NPC (16, NPCstat:move speed,0)
if (MyDirection == left) then, begin
set NPC position (16, YourX +1, YourY--1),
set npc direction (16, MyDirection),
place artemis:= false,
artemis moves:= false,
wait(1),
resume npcs,
resume player,
end, else, begin
if (MyDirection == right) then, begin
set NPC position (16, YourX--1, YourY--1),
set npc direction (16, MyDirection),
place artemis:= false,
artemis moves:= false,
wait(1),
resume npcs,
resume player,
end, else, begin
if (MyDirection == up) then, begin
set NPC position (16, YourX--1, YourY+1),
set npc direction (16, MyDirection),
place artemis:= false,
artemis moves:= false,
wait(1)
resume npcs
resume player
end, else, begin
if (MyDirection == down) then, begin
set NPC position (16, YourX--1, YourY--1),
set npc direction (16, MyDirection),
wait(1)
place artemis:= false
artemis moves:= false
resume npcs
resume player
end #end of the if directs
end
end
end
end #end for the if npc ref
end #end of the if check tag
end #end for the script
#---------------------------------------------------------------------------
|
There are many lines due to copy detection. (May be I should try to came up a lighter version... the main changes is just one line (use create NPC if there are no npc) and Set NPC position if there were already a copy.
Anyway, what tests should I make to try to see where the problem could come from? _________________ It's time to make games! |
|
Back to top |
|
|
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Mon Mar 23, 2009 2:01 am Post subject: |
|
|
Ah ha, so the problem seems to be that you set YourX and YourY in "place luna 2". Is this just for convenience, so that you can write
Code: | set Npc position (0, (X --1),(YourY)), | instead of Code: | set Npc position (0, hero x (me) -- 1,hero y (me)), | ? It looks like you meant for YourX and YourY to be local variables. Rename them to something else and declare them with variable, or just get rid of them _________________ "It is so great it is insanely great." |
|
Back to top |
|
|
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Tue Mar 24, 2009 1:07 am Post subject: And once again... it worked! Thank you so much! |
|
|
Thanks again to "The Mad Cacti!" Once again! It worked!
Here is another problem! An this one is a big one!
Code: |
#-----------------------------------------------------------------------
script, myonkeypress script, begin
if (key is pressed(key:esc), xor, key is pressed(key:alt)) then, begin # menu is unactivated
suspend player
wait (1)
menu #launch script with new menu in it
end
if (key is pressed(key: numlock)) then, begin
if (pauseisactive==false) then, begin
pause script
end, else, begin
#thus, pauseisactive must be true
unpaused script
end #end of the first if
end #end of the second if
#numlock is pressed for pause
#---------------------------------------------------------------------------
script,menu,textbox used=87,number of lines=3, backcolor=0, textcolor=15, choice color=5,x=160,y=100,spacing=8,begin
#Initialization of the menu
variable(MenuChoice,temp)
variable (sub_menu)
if(numberoflines<<4)then(numberoflines:=4) #We want to make sure that the minimum lines is 4
number of lines:=numberoflines--1
#The actual numbering is 0 based, not 1 based, meaning if the number of lines is 2, the count is 0, 1; not 1,2
menuchoice:=0 #default choice is 0 that is to say the first line , case (0) (see below)
sub_menu:=menuchoice
#this step clears the number of strings based on the number of lines.
#EX: number of lines = 2, it will clear string 0, 1; so if there are 8 lines menu choices, string
#0-7 will be cleared, so make sure you don't use those for anything important
for(temp,0,numberoflines)do(
if(backcolor>=1)then( #Since you cannot provide backcolor for outline style strings,
stringstyle(temp,string:flat) #its important to change the string style to flat
stringcolor(temp,textcolor,backcolor)
)else(stringcolor(temp,textcolor))
clearstring(temp)
stringfromtextbox(temp,textboxused,temp)
centerstringat(temp,x,y) #Change this to showstringat(temp,x,y) to make the menu be left-aligned
increment(y,spacing)
#vertical space between each string has to be >= 8, otherwise the strings will overlap
end
#highlights the default choice
stringstyle(menuchoice,string:flat)
stringcolor(menuchoice,textcolor,choicecolor)
#main loop, this is where all the menu browsing happens
while(keyispressed(key:enter)==false)do(
if(keyispressed(key:up))then( #Behavior for up key
while(keyispressed(key:up))do(wait(1)) #This turns off key repeat
if(menuchoice>>0)then( #makes sure that the menu cursor stays in place and doesn't go overboard
if(backcolor>>0)then(
stringstyle(menuchoice,string:flat)
stringcolor(menuchoice,textcolor,backcolor)
)else(stringstyle(menuchoice,string:outline))
decrement(menuchoice)
stringstyle(menuchoice,string:flat)
stringcolor(menuchoice,textcolor,choicecolor)
end
end
if(keyispressed(key:down))then( #Behavior for down key
while(keyispressed(key:down))do(wait(1)) #This turns off key repeat
if(menuchoice<<numberoflines)then( #makes sure that the menu cursor stays in place and doesn't go overboard
if(backcolor>>0)then(
stringstyle(menuchoice,string:flat)
stringcolor(menuchoice,textcolor,backcolor)
)else(stringstyle(menuchoice,string:outline))
increment(menuchoice)
increment(sub_menu)
stringstyle(menuchoice,string:flat)
stringcolor(menuchoice,textcolor,choicecolor)
end
end
wait(1) #very important prevents the menu from moving down
end
return(menuchoice) #returns the value of MenuChoice
#clears the strings we just used
for(temp,0,numberoflines)do(
hidestring(temp)
clearstring(temp)
end
Switch (sub_menu) do(
case(0)do(show text box (90)
sub_menu:=0) #submenu:=0 => reset sub menu
case(1)do(show text box (89)
sub_menu:=0)
case(2)do(show text box (88)
sub_menu:=0)
case(3)do(show text box (80)
sub_menu:=0)
case(-1)do(
return(menuchoice),
#clears the strings we just used
for(temp,0,numberoflines)do(
hidestring(temp)
clearstring(temp)
#wait for text box
) #end for for.. do
) #end for the switch
) #end for case (-1)
resume player #allows game to came back to normal
end #end of the plotscript
#--------------------------------------------------------------------
|
When my arrows goes down and then up the script goes crazy and can't
show the right text box (I'll implement sub menu later)
The second problem is that I would like to make it disappear using esc (I already managed to make it appear with).
The third and last problem is that I would the menu to be included in a text box to perfectly fake the basic menu.
The 2 main problems are the most important right now. As always thanks a million in advance for advise! _________________ It's time to make games! |
|
Back to top |
|
|
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Tue Mar 24, 2009 11:26 am Post subject: |
|
|
Well without looking at the script details too much, I can almost guarantee that you're better off learning how to use custom's own 'edit menu' feature - it will immediately get rid of any issues with keypresses. It'll look exactly like the regular menu in terms of background color, borders, etc. But you get to choose (in custom, without needing much if any plotscripting) what the selections in the menu say and what they do.
Let us know if this will work, or if you'd rather dive into altering your plotscript. _________________ 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: Tue Mar 24, 2009 10:25 pm Post subject: I check and it true effectively |
|
|
Well I've coded in all this line when the edit menus had not been implemented yet.
I checked and it effectiley true that I can get the same effect simply by editing a menu.
Anyway, It is always interesting to know that there are several ways to do what you want so if possible, I would like to embetter the code and try to make it fully works. As I've said in the last post there are 2 main problems :
Quote: |
When my arrows goes down and then up the script goes crazy and can't
show the right text box (I'll implement sub menu later)
The second problem is that I would like to make it disappear using esc (I already managed to make it appear with).
The third and last problem is that I would like the menu to seem to be included in a text box (to perfectly fake the basic menu or hand made menu under custom.exe)
|
Once all those problems is solved, I may put the code appart and explain how to use it on the wiki. I'll afford the occasion to clean my code and use a menu created custom.exe but since then...
As always thanks a million for the help! _________________ It's time to make games! |
|
Back to top |
|
|
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Fri Mar 27, 2009 6:19 am Post subject: After some tests... |
|
|
Well after some tests I managed to get why the reason why I couldn't get the right text box I used the upper key.
Code: |
if(backcolor>>0)then(
stringstyle(menuchoice,string:flat)
stringcolor(menuchoice,textcolor,backcolor)
)else(stringstyle(menuchoice,string:outline))
decrement(menuchoice)
increment(sub_menu)
# missing line need to be added in the part with #if(keyispressed(key:up))then( #Behavior for up key
stringstyle(menuchoice,string:flat)
stringcolor(menuchoice,textcolor,choicecolor)
end
end
|
By changing string oultine to string flat I managed to get a background but only around the word. Would it be possible to extend it? If yes how ?
I would like this menu background to look like exactly like the one under custom : with a blue text box with borders and a transparency effect
or at least with a border and a solid background
Thanks in advance for your help and advice![/code] _________________ It's time to make games! |
|
Back to top |
|
|
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sun Apr 05, 2009 6:10 pm Post subject: |
|
|
Well it just so happens that creating custom menus was one of the original purposes of slices! The slice tree was originally called the rect tree. "Rects" are rectangles/(text)boxes. They can have graphical box borders, just like textboxes.
I've never used them, but you can create a 300x180 box that looks like textbox style 0 in the middle of the screen like this:
Code: | box := create rect(300, 180, 0)
center slice(box)
#...
#delete the box
free slice (box) |
Have a look in the plotscripting dictionary. _________________ "It is so great it is insanely great." |
|
Back to top |
|
|
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sun Apr 05, 2009 11:27 pm Post subject: Well sorry to contract you but.... |
|
|
Sorry but when I compile, Hspeak.Exe says that it doesn't know the command.
(I've downloaded the last version of custom.exe, hspeak.exe and game.exe (from April 3th and the command is still unknown!)
Could you please look in your plotscript dictionnary and put here the line that concerns free slice and center slice?
I also need the transparency box effect. How am I supposed to modify the slice?
Thanks a lot and gook luck! _________________ It's time to make games! |
|
Back to top |
|
|
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Mon Apr 06, 2009 12:13 am Post subject: |
|
|
Make sure that you are using the copy of plotscr.hsd that came with the nightly build you're using.
Also, you can read the latest plotscripting dictionary here: http://hamsterrepublic.com/ohrrpgce/docs/plotdict.xml
You create a translucent box like this:
Code: | box := create rect(300, 180, 0)
set rect trans(box, true) |
_________________ "It is so great it is insanely great." |
|
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
|