Post new topic    
Page «  1, 2, 3, 4, 5, 6  »
Liquid Metal King Slime
Send private message
 
 PostWed Feb 23, 2011 11:38 pm
Send private message Reply with quote
That error is coming from this line:

Code:
set slice text(sl, 0)


The error means that the sl variable has a zero in it. The only way that could happen is if this line failed:

Code:
sl := lookup slice(carlhealth, hud)


The reason this is failing is because you should NOT be passing the variable "carlhealth" as the first argument. You should be passing the sli:codename lookup code for the slice in your collection that will display the health value.

In the slice editor, press ENTER on your health text slice. look where it says "Lookup Code:" do you have name there for the lookup code? Or is it blank.

If you name the slice lookup code "carlhealth" then in the script you would write:

Code:
sl := lookup slice(sli:carlhealth, hud)
Metal Slime
Send private message
 
 PostThu Feb 24, 2011 12:00 am
Send private message Reply with quote
that is what i have it set to, exactly, and it is still failing.

Code:
script, show value in text slice, val, lookup code, begin
  variable(sl)
  sl := lookup slice(sli:carlhealth, hud)
  $0="100"
  append number(0, val)
  set slice text(sl, 0)
end
Liquid Metal King Slime
Send private message
 
 PostThu Feb 24, 2011 1:03 am
Send private message Reply with quote
Oh, I see the problem. I told you wrong. The lookup code is already being passed as an argument to the "show value in text slice", so you should write:

Code:

script, show value in text slice, val, lookup code, begin
  variable(sl)
  sl := lookup slice(lookup code, hud)
  $0=""
  append number(0, val)
  set slice text(sl, 0)
end


Node that this part that you changed was also wrong, although it was not causing the problem:

Code:

  $0="100"
  append number(0, val)


This will result in "100100". The $0="" part is just supposed to blank out the string before you append the actual value to it.
Metal Slime
Send private message
 
 PostThu Feb 24, 2011 1:16 am
Send private message Reply with quote
James Paige wrote:
This will result in "100100". The $0="" part is just supposed to blank out the string before you append the actual value to it.

oh, i was wondering what the heck that was supposed to be doing.

Code:
script, show value in text slice, val, lookup code, begin
  variable(sl)
  sl := lookup slice(lookup code, hud)
  $0=""
  append number(0, val)
  set slice text(sl, 0)
end

also, i don't see what was changed. it looks exactly the same.

what am i supposed to be doing here?
Liquid Metal King Slime
Send private message
 
 PostThu Feb 24, 2011 1:55 am
Send private message Reply with quote
this line was wrong:

Code:
sl := lookup slice(sli:carlhealth, hud)


it should be

Code:
sl := lookup slice(lookup code, hud)


but now that i think about it, that should not have totally broken things, it would have just caused both the health and the magic to be displayed in the health slot.

Could you export a copy of your slice collection and send it to me?

It would also be interesting to see the results when you do:

Code:
sl := lookup slice(lookup code, hud)
show value(sl)


You should be seeing some number larger than 0
Metal Slime
Send private message
 
 PostThu Feb 24, 2011 2:03 am
Send private message Reply with quote
sure, i could also just send you the game instead. i literally just started making it yesterday, so it's pretty tiny still. that should give you a better idea of what's going on, if you can see all the data in the game using CUSTOM.

oh, and as for the value when i added:

Code:
sl := lookup slice(lookup code, hud)
show value(sl)


it shows 0.
Metal Slime
Send private message
 
 PostFri Feb 25, 2011 10:21 pm
Send private message Reply with quote
the darndest thing just happened.

i combined the new game script with the display health and magic script, and now it works. the slice value even shows 3 instead of 0 now. wierd.
Liquid Metal King Slime
Send private message
 
 PostFri Feb 25, 2011 11:11 pm
Send private message Reply with quote
Interesting. I did look at the slice collection you sent me, and your lookup codes seems perfect.
Metal Slime
Send private message
 
 PostSat Feb 26, 2011 2:22 am
Send private message Reply with quote
James Paige wrote:
Interesting. I did look at the slice collection you sent me, and your lookup codes seems perfect.


it always was. i didn't change the coding itself, just removed the "end" in the new game script and "plotscript,blankety blank, begin" to make them the same script. now how can that be?
Metal Slime
Send private message
 
 PostWed Mar 23, 2011 6:21 pm
Send private message Reply with quote
how do i disallow the player from opening the menu normally?

i'm trying to create a custom menu screen with backdrops, music, etc. is there any way to block the normal use of the esc and alt buttons so they can be used by scripts?
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
Super Slime
Send private message
 
 PostWed Mar 23, 2011 6:28 pm
Send private message Reply with quote
suspend player does the trick. You will need to script hero movement if the player is continuously suspended.
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks
Liquid Metal King Slime
Send private message
 
 PostWed Mar 23, 2011 7:14 pm
Send private message Reply with quote
I really need to make a way to override the menu. it is silly to make people script their movement just because they want to replace the menu.
Metal Slime
Send private message
 
 PostWed Mar 23, 2011 7:30 pm
Send private message Reply with quote
Mogri wrote:
suspend player does the trick. You will need to script hero movement if the player is continuously suspended.


thanks anyway, but this wasn't the case. i got it working now. Smile

James Paige wrote:
I really need to make a way to override the menu. it is silly to make people script their movement just because they want to replace the menu.


not sure what you mean by "scripting movement", but why not have a command that disables key operations? sort of like this:

Code:
disable key (menu key)
if (key is pressed(key:Alt || key:Esc)) then, begin
suspend player
suspend npcs
fade screen out (0,0,0)
stop song
wait (5)
show backdrop (3)
open menu (menu:Main Menu)
wait (5)
fade screen in
play song (song:ddintermission)
end


disable key could disable normal use of certain keys. in this case, the menu key is disabled, preventing the menu from appearing normally. then, well, you can probably figure the rest out.
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
Liquid Metal King Slime
Send private message
 
 PostWed Mar 23, 2011 8:17 pm
Send private message Reply with quote
The way it will work (when I get around to implementing it) will be that somewhere in custom (probably in the general game data menu) you will be able to choose what happens when you press the menu key. Options will be to open a specific menu, to run a specific script, or to do nothing at all.
Metal Slime
Send private message
 
 PostSat Dec 03, 2011 4:48 pm
Send private message Reply with quote
finally found my old thread plotscripting thread! and yes, that means i have another question. is there some way to return the NPC last used by the player in a script? i want to store the position of the NPC that runs the script into a variable, but i don't want to create multiple scripts for every NPC to do this. i'm looking through the plotscripting dictionary right now, but i can't seem to find any commands that do something like this.
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
Display posts from previous:
Page «  1, 2, 3, 4, 5, 6  »