View previous topic :: View next topic |
Author |
Message |
Bobert-Rob The guy from years ago who made one good game

Joined: 13 Jun 2010 Posts: 17
|
Posted: Fri Jul 16, 2010 11:05 pm Post subject: Using a slice to show what item you get from an NPC? |
|
|
Alright, so I'm figuring out this slice stuff... slowly. I see you can use text with them? Like showing text.
See, what I'm thinking is... there are a lot of spots in my game where you'll get an item from a once only NPC. There's no textbox to show you what item you got, so the player has to dig through the items and figure out what they got. I'd really rather not write out the textboxes for each item. There's well over 200 items and that'd be lengthy. Not only the writing, but assigning each one to each NPC...
So I'm wondering if it's possible to be able to do this automatically with slices? Like, what code I'd use to get whatever item an NPC gives you (you know, when you set an NPC to give you an item on the map screen) and have the plotscript set the slice to show this over an empty textbox. That way I'd be able to just go through and assign the plotscript to each NPC and the script would take care of notifying the player they got whatever item they got. Take care of it all with a single script, y'know? Is this possible? |
|
Back to top |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Sat Jul 17, 2010 5:57 am Post subject: |
|
|
You want to use Strings, which I am assuming you know how to use in other languages?
Here's some documentation on getting started there:
http://gilgamesh.hamsterrepublic.com/wiki/ohrrpgce/index.php/Strings
I would just make a generic start for the string like "You got a " and then figure out the item name and concatenate it to the end. Then, when you are in the text box editor, you can call String x with ${Sx}. (You can see the other options in the text box editor too) |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Sat Jul 17, 2010 6:39 am Post subject: |
|
|
This reminds me that I should implement the request in '' . bug_title('331') . '' |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Sat Jul 17, 2010 9:16 am Post subject: |
|
|
The easiest way currently is to have a script something like this:
Code: | plotscript, get treasure, item, begin
get item(item)
get item name(1, item)
show text box(123)
end |
...where text box 123 says, "You got a ${S1}!"
No string manipulation required. _________________
|
|
Back to top |
|
 |
Bobert-Rob The guy from years ago who made one good game

Joined: 13 Jun 2010 Posts: 17
|
Posted: Sat Jul 17, 2010 7:30 pm Post subject: |
|
|
Ah, so I'd just throw the item number in the script argument. A little more work than I figured, but all in all, the quickest solution available. And it works! So yay! |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sat Jul 17, 2010 8:22 pm Post subject: |
|
|
Bobert-Rob wrote: | Ah, so I'd just throw the item number in the script argument. A little more work than I figured, but all in all, the quickest solution available. |
If you want to be lazier, you can skip giving the script argument, and do what you described:
Code: | plotscript, item giver, dummy, npc ref, begin
get item name(1, read npc (npc ref, NPC stat: give item) -- 1)
show text box(123)
end |
_________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
|