|
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sun Mar 18, 2012 6:06 am Post subject: I've managed to make appear my collection |
|
|
I've managed to make appear the portrait and the text putting the slice in the correct order! Thanks for making me noticing it!
Code: |
variable (collection)
collection := load slice collection (2)
sl := lookup slice (sli: test menu, collection)
get hero name (0, me)
set slice text (sl, 0)
#sl := lookup slice (sli: hero menu HP, collection)
#$0 = "HP: "
#append number (0, get hero stat (who, stat:hp, current stat))
#$0 + "/"
#append number (0, get hero stat (who, stat:hp, maximum stat))
#set slice text (sl, 0)
# Also set the portrait and whatever else
# ...
set parent (collection)
|
The strings are to put content heroes' names and hp/ mp points.
the set parent function make appear the collection.
How am I supposed to make disappear a slice collection? What commands am I supposed to use? I need to the opposite of set parent but I couldn't find it. _________________ 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 Mar 18, 2012 12:41 pm Post subject: |
|
|
No, "set parent" takes two arguments: the slice to move, and the slice to parent to. Calling it with a single argument should give you an error.
"free slice (slice)" deletes a slice. _________________ "It is so great it is insanely great." |
|
Back to top |
|
|
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Fri Mar 23, 2012 10:03 am Post subject: Some more questions |
|
|
Ok I"ve got some more questions
Quote: | set slice parent (collection, MENU CONTAINER) |
When I compile Hspeak.exe says that it doesn't recognised the command
set slice parent : could you please that it is a wip and that I need to download the lastest wip version so that hspeak can uses this command?
Another point concerns MENU CONTAINER
What does it refers to? A slice look up code?
Thanks for your help and have a nice week-end! _________________ It's time to make games! |
|
Back to top |
|
|
Bob the Hamster OHRRPGCE Developer
Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Fri Mar 23, 2012 10:32 am Post subject: Re: Some more questions |
|
|
bis_senchi wrote: | Ok I"ve got some more questions
Quote: | set slice parent (collection, MENU CONTAINER) |
When I compile Hspeak.exe says that it doesn't recognised the command
set slice parent : could you please that it is a wip and that I need to download the lastest wip version so that hspeak can uses this command?
|
The command is "set parent" not "set slice parent"
bis_senchi wrote: |
Another point concerns MENU CONTAINER
What does it refers to? A slice look up code?
Thanks for your help and have a nice week-end! |
MENU CONTAINER would be a variable that contains a handle to a slice.
If you want to use a lookup code, you would write it like this:
Code: | set parent (collection, lookup slice(sli:whatever lookup code)) |
|
|
Back to top |
|
|
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sat Mar 31, 2012 11:26 pm Post subject: Sorry for asking again a stupid question but... |
|
|
I've managed to make appear my slice collection on screen but when
I tried to make it disappear using the command line
Code: | free slice (collection) |
I've got an error saying invalid slice handle
Here is my test script. I've made a simple slice collection with a backgroud and two text items. I'm using the switch command as a tag to make the npc says something different later.
On case 0 he make displays the slice collection and on case 1 he makes it disappears.
Code: |
plotscript, test slice collection, begin
switch (npc slice test), do, begin
case (0) do, begin
variable (collection, menu container)
collection := load slice collection (2)
sl := lookup slice (sli: test menu, collection)
get hero name (0, me)
set slice text (sl, 0)
sl := lookup slice (sli: test menu hero HP, collection)
$0 = "HP: "
append number (0, get hero stat (me, stat:hp, current stat))
$0 + "/"
append number (0, get hero stat (me, stat:hp, maximum stat))
set slice text (sl, 0)
# Also set the portrait and whatever else
# ...
set parent (collection, MENU CONTAINER)
npc slice test:=1
wait (2)
exit script
end
case (1) do, begin
free slice (collection) ?
# use free slice (sl) ?
wait (2)
npc slice test:=0
wait (1)
exit script
end
end #end for the switch
end #end for the script
|
My question is simple how do I make disappear the invalid slice handle warnings?
Can anybody tell where does it come from?
As always thank for the help and good luck in making your games everybody. _________________ It's time to make games! |
|
Back to top |
|
|
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Apr 03, 2012 3:01 am Post subject: |
|
|
The 'collection' variable is only set in the "case (0)" part of the script. If the other part of the script is run instead, then collection will be equal to zero.
You could make 'collection' a global variable, or if there's only at most one 'sli: test menu' slice in existence, can write
Code: | sl := lookup slice (sli: test menu)
if (sl) then (free slice (sl)) |
_________________ "It is so great it is insanely great." |
|
Back to top |
|
|
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Mon Jun 11, 2012 8:54 pm Post subject: Another problem came up |
|
|
I finally managed to make a test with slice. The only thing is that a zero appear after my hero's name and I don't understand why
Code: |
#------------------------------------------------------------------------------------
plotscript, test slice coll, begin
switch (npc slice test), do, begin
case (0) do, begin
variable (collection)
collection := load slice collection (2)
# sl definit comme variables globales
sl := lookup slice (sli: test menu, collection)
sl2 := lookup slice (sli: test menu hero portrait, collection)
sl3 := lookup slice (sli: test menu hero level, collection)
sl4 := lookup slice (sli: test menu hero name, collection)
sl3 := lookup slice (sli: test menu hero level, collection)
$0 = "LV "
append number (0, get hero level (me))
$0 + " "
set slice text (sl3, 0)
# problem here?
sl4 := lookup slice (sli: test menu hero name, collection)
append number (1, get hero name (1, me))
$1 + " "
set slice text (sl4, 1)
#append number (0, get hero stat (me, stat:hp, current stat))
#$0 + "/"
#append number (0, get hero stat (me, stat:hp, maximum stat))
#set slice text (sl, 0)
# Also set the portrait and whatever else
# ...
#set parent (collection) #set parent permet d'afficher une slice collection
npc slice test:=1
wait (2)
exit script
end
case (1) do, begin
free slice (sl)
free slice (sl2)
free slice (sl3)
free slice (sl4)
wait (2)
npc slice test:=0
wait (1)
exit script
end
end #end for the switch
end #end of the script
#------------------------------------------------------------------------------------
|
_________________ It's time to make games! |
|
Back to top |
|
|
Bob the Hamster OHRRPGCE Developer
Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Tue Jun 12, 2012 6:33 am Post subject: |
|
|
Here is the problem:
Code: | append number (1, get hero name (1, me)) |
The "append number" is just for appending numbers, you don't need it at all. Change this line to:
Code: | get hero name (1, me) |
|
|
Back to top |
|
|
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sat Jun 16, 2012 6:08 am Post subject: Thanks a lot problem is solved |
|
|
Thanks! Deleting this line was very efficient!
I've got another problem, an old one which comes up again : script overloading
Code: |
#My key is pressed script
plotscript, luna follows me,
if (checktag(tag:luna follows me),xor,checktag(tag:artemis follows me)) then, begin
if (petisactive==false) then, begin
petisactive:=true
hero is walking (0) #substitute this for the hero you want
hero direction (0) #=direction
npcplace #(*,*,direction,*)
end, else, begin
petisactive:=false
wait (1)
end #end of if
end #end for the if check tag
if (key is pressed(key:esc), xor, key is pressed(key:alt)) then, begin
if (gamemenuisactive==false) then, begin
game menu
end, else, begin
#thus, game has not been launched
leave game menu
end #end of if (game menu is active)
end #end for the if key is pressed
if (key is pressed(key: r)) then, begin
my keyboard jump
end
#Key is pressed r pour sauter
if (key is pressed(key: z)) then, begin
my keyboard getquick
end
#Key is pressed z pour accelerer
if (keyval(key: pause)>>1) then, begin # key attn, pause makes game paused if pressed
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 for if key is pressed numlock
|
When I launched the game Ive got the following message: script interpreter overload. The debugger says the line occurs at the line npc place.
[quote= "custom debugger"]
Script error!
Script data may be corrupt or not supported . failed to load on key script 48 luna follows me, interpreter overloaded call chain (current last script)
luna follows me -> NPC Place
[/quote]
Could someone help me to get rid of the error? I tried to use a global variable to prevent overloading but it does not seem to be very efficient...
Thanks a lot in advance for the help! _________________ It's time to make games! |
|
Back to top |
|
|
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Wed Jun 20, 2012 11:27 pm Post subject: |
|
|
Your script is a bit hard to understand as there seem to be pieces missing . But it looks like the problem is probably in the following part:
Code: |
if (petisactive==false) then, begin
petisactive:=true
hero is walking (0) #substitute this for the hero you want
hero direction (0) #=direction
npcplace #(*,*,direction,*)
end, else, begin
petisactive:=false
wait (1)
end #end of if
|
I don't think that you should have a "wait (1)" there. Also, this looks quite strange; did you mean to write:
Code: | if (petisactive==false) then, begin
petisactive:=true
hero is walking (0) #substitute this for the hero you want
hero direction (0) #=direction
npcplace #(*,*,direction,*)
petisactive:=false
end #end of if
|
_________________ "It is so great it is insanely great." |
|
Back to top |
|
|
bis_senchi
Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Mon Jun 25, 2012 2:48 am Post subject: I finally managed to solve the problem by myself |
|
|
I would like to know if it possible to launch a script from a slice.
The idea would be the following, I would have the name of three different enemies and I would like to launch a plotscript with fight formation commands in it.
Do you think it is possible using slice or should I create a "classical menu" (with edit menu under custom)?
Thanks for the all help you provided until now and thank you in advance for the pieces of information. _________________ It's time to make games! |
|
Back to top |
|
|
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Jun 26, 2012 3:40 am Post subject: |
|
|
I assume you mean that you want a menu where the menu items are drawn using slices.
Slices are not supported by customisable ("classical") menus yet; so you would have to script your own menu.
Since that also requires some way to indicate which menu item is selected (such as by changing the colour of a rectangle or of the text) it is a little complicated. You need to give more details. But if the menu only has the names of the enemies, why not using a normal menu?
I had forgotten about adding slice support to menus. Maybe that's something I'll try for the next OHR release. _________________ "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
|