Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Using a slice to show what item you get from an NPC?

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
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

PostPosted: Fri Jul 16, 2010 11:05 pm    Post subject: Using a slice to show what item you get from an NPC? Reply with quote

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
View user's profile Send private message Visit poster's website
JSH357




Joined: 02 Feb 2003
Posts: 1705

PostPosted: Sat Jul 17, 2010 5:57 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Sat Jul 17, 2010 6:39 am    Post subject: Reply with quote

This reminds me that I should implement the request in '' . bug_title('331') . ''
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Sat Jul 17, 2010 9:16 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address
Bobert-Rob
The guy from years ago who made one good game




Joined: 13 Jun 2010
Posts: 17

PostPosted: Sat Jul 17, 2010 7:30 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sat Jul 17, 2010 8:22 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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