About Store Forum Documentation Contact



Post Reply 
RPG 2 inventory question (solved)
Author Message
ghreef Offline
Member

Post: #1
RPG 2 inventory question (solved)
I've banged my head for almost 10 hours now, to no avail. Where the heck, and how the heck would I add a value, or increase the value of weight in the inventory screen?

please, please .. I've poured through the tutorials and they just don't discuss this topic.
(This post was last modified: 07-25-2011 01:57 AM by ghreef.)
07-20-2011 09:58 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: RPG 2 inventory question
what do you mean add/increase value of weight?

you want to calculate total weight of items in the inv?

just iterate all elements and sum their weight
Flt weight=0; FREPA(items)weight+=items[i].weight;
07-23-2011 12:47 PM
Find all posts by this user Quote this message in a reply
ghreef Offline
Member

Post: #3
RE: RPG 2 inventory question
No, I mean updating the actual text field on the inventory gobj. There are two test fields, one for gold and one for weight. Example, when inventory update is called, I want to set the weight text field to 10. I've looked at all the tutorials and played around on my own, but can't find how to update/write to the text field. If anyone can show me how to do that, or where thats documented in the tutorials, I'd be grateful.
07-23-2011 01:30 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #4
RE: RPG 2 inventory question
check TextLine header file
07-23-2011 01:50 PM
Find all posts by this user Quote this message in a reply
ghreef Offline
Member

Post: #5
RE: RPG 2 inventory question
I will. Thanks. I don't mind learning with a point in the right direction. I also ge errors when I create a new textline object, but I'll start a new thread for that. smile

Thanks.
07-23-2011 04:22 PM
Find all posts by this user Quote this message in a reply
ghreef Offline
Member

Post: #6
RE: RPG 2 inventory question
That worked - thanks. (Still a bit painful, some better documentation might help)

How do I convert Int to a string format that will be accepted by the set function for text boxes?
Code:
Igoldval += 20;
   std::string s;
   std::stringstream out;
   out << Igoldval;
   s = out.str();
   gobjs.getText("Gold").set(s);

s isn't recognized for "set"
(This post was last modified: 07-24-2011 07:31 PM by ghreef.)
07-24-2011 07:30 PM
Find all posts by this user Quote this message in a reply
Dandruff Offline
Member

Post: #7
RE: RPG 2 inventory question
try S+s
07-25-2011 12:40 AM
Find all posts by this user Quote this message in a reply
ghreef Offline
Member

Post: #8
RE: RPG 2 inventory question
S+s doesn't work. It only takes a real number, not a variable. I did figure it out though:

Code:
U64 Igoldval;
Str Tgoldval;


Igoldval += 20;
Tgoldval=(Igoldval);
gobjs.getText("Gold").set(Tgoldval);
07-25-2011 01:57 AM
Find all posts by this user Quote this message in a reply
Post Reply