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

Question involving using Strings to display a value
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Mon Sep 18, 2006 6:40 am    Post subject: Reply with quote

msw188 wrote:
If hide string doesn't work, I can only think of two possible solutions, that are really just cheats. First is to clear the string. Then the string will still be on the screen, but since it has no characters nothing ought to be shown...?

I tried Clear String, it didn't seem to work. ._.

msw188 wrote:
Another possibility may be to reload the map. Do strings outlast map loads? I have not used strings outside of textboxes before. Or maybe you could position the string in some ungodly place where the player has no chance of ever seeing it. Not sure if your map even has such a place.

Well, I played the 'test.rpg' that came with the O.H.R. source and stuff, and the strings are still shown when I move to another map. So I guess that they would still show.

I suppose I'll have to try sticking them somewhere where the player can't see them. ^^;

msw188 wrote:
Is hide string broken? The string commands seem overly complicated. I think show no value is used to eliminate strings sometimes too, depending...

No, it's not broken —
Plotscripting Dictionary wrote:
hide string (ID)
Makes a string previously displayed with show string at or center string at disappear. Has no effect on strings displayed with show string

— although now that I look at it closer, I find that the documentation says that it's supposed to ONLY work with Show String At and Center String commands… I misread it. >___<

msw188 wrote:
Oh yeah, the problem I was considering with left and right was basically this. You are on RED and you press right. Tag 15 is turned off and Tag 16 is turned on. However, then in the part of the code (GREEN) Tag 16 is checked and it is on, so I was afraid there was a chance that

if(checktag(16)==on), then, (if(key is pressed(key:right)), then...

would run, so tag 16 would be switched back off, and tag 17 would be switched on, and then the same thing would happen again in BLUE, until the computer decided that the key was no longer pressed. But it was only a guess; if you are not having any problems scrolling through, then I must have been mistaken.

Oh. Heh, to clear this up a bit — I labeled tages 15, 16 and 17 OnHTBC-R. OnHTBC-G and OnHTBC-B (respectively). The 'HTBC' standing for Hero Text Box Color, and the -R, -G and -B being Red, Green and Blue. :) So if you're on Red, then tag 15 (OnHTBC-R) would be on, then you press right and the script turns tag 15 off and tag 16 (OnHTBC-G) on, that way the game knows you're on the Green selector of the Hero Text Box Color modifier. :)

Sorry for all the trouble this caused… I guess it's fixed now. :D Thanks for the help, msw188. :)
Back to top
View user's profile Send private message Yahoo Messenger
Inferior Minion
Metric Ruler



Joined: 03 Jan 2003
Posts: 741
Location: Santa Barbara, CA

PostPosted: Mon Sep 18, 2006 8:56 am    Post subject: Reply with quote

I don't think you understand what msw188 is referring to. You have three blocks of code:
  • Red Handling (tag 15)
  • Green Handling (tag 16)
  • Blue Handling (tag 17)

Take this pseudo-code (meaning it's not valid code, but shows flow) for instance:


Code:

if ( tag 15 on and Pressed Right ) {   # When in the Red State, this is true
   turn tag 15 off  # Leave the Red State
   turn tag 16 on  # Enter the Green State
}  # Tag 16 is now on

if ( tag 16 on and Pressed Right ) { # Since 16 was just turned on, this might also be true
    turn tag 16 off # Leave the Green State
    turn tag 17 on # Enter the Blue State
} # Tag 17 is now on

if ( tag 17 on and Pressed Right ) { # Since 17 is now turned on, this might be tru
    turn tag 17 off # Leave the Blue State
    turn tag 15 on # Enter the Red State
}


This assumes that key is pressed (key) continues to return true throughout that script call but I don't know enough about plotscripting to remark on it's behavior. As msw188 stated, if you are able to move between the colors by pressing left and right, then you don't have anything to worry about. If you find that pressing right leaves you back in the Red state, then you need to use else statements:

Code:

if ( tag 15 on ) {
   # All your Red State Checks
} else if ( tag 16 on ) {
   # All your Green State Checks
} else if ( tag 17 on ) {
   # All your Blue State Checks
}

_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Mon Sep 18, 2006 11:12 am    Post subject: Reply with quote

Okay, I think I see now. I think. I need to take a break from plotscripting, my head hurts.
Back to top
View user's profile Send private message Yahoo Messenger
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Mon Sep 25, 2006 7:34 pm    Post subject: Reply with quote

Okay, I'm back again (and I edited the thread's subject so it's just a bit more relevant).

How would I use strings to display values such as Hero's Current HP/Hero's Maximum HP, Hero's Current MP/Hero's Max MP and the Days Spent/Hours Spent/Minutes Spent Playing stats the way this (faked) screenshot I made here has them (minus the little symbols, I know how to add those. :D)?



Actually, come to think of it — how do I get strings to display all of those except the map name (the <blank> Plains) and the little colored symbols. >.>;;
Back to top
View user's profile Send private message Yahoo Messenger
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Mon Sep 25, 2006 7:53 pm    Post subject: Reply with quote

There are a few extra things to consider here. They all deal with alignment. For instance, how do you want HP and MP to be handled if the hero's current or max has less than five digits? I'm guessing that you still want the equipment aligned the same on the right, but how should the HP/MP display change? Should the slashes always be in the spot they are now, or should it look like:
1234/1324
22323/32222

or do you want it 'right aligned', etc.

Similar questions arise for the time. What if the days have less than three digits? Should the comma stay where it is now, or move over? Depending on your answers to these questions, I can see this being a considerable pain (unless I'm just not thinking of an easy way to get around these issues).
Back to top
View user's profile Send private message Visit poster's website
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Mon Sep 25, 2006 8:06 pm    Post subject: Reply with quote

msw188 wrote:
There are a few extra things to consider here. They all deal with alignment. For instance, how do you want HP and MP to be handled if the hero's current or max has less than five digits? I'm guessing that you still want the equipment aligned the same on the right, but how should the HP/MP display change? Should the slashes always be in the spot they are now, or should it look like:
1234/1324
22323/32222

or do you want it 'right aligned', etc.

Well, since I'm probably going to be using seperate strings for each 'category' (one for the "HP: <current_value>/<max_value>", one for the Map Name thing, etcetera) — I'd go with having the slash move:
HP: 5235/5667
HP: 223/4567
HP: 2/443

Sort of a variable-width pair of values. :D

msw188 wrote:
Similar questions arise for the time. What if the days have less than three digits? Should the comma stay where it is now, or move over? Depending on your answers to these questions, I can see this being a considerable pain (unless I'm just not thinking of an easy way to get around these issues).


Yeah, the commas would be done similarly to the slashes in the HP and MP categories:
TIME: D: 0, H:3, M:32
TIME: D: 11, H:21, M:57
TIME: D: 129, H:4, M:0

And the equipment area — well, since each item has an eight-character limit for it's name — those would stay static.

Edit: If it helps, you don't have to use the exact same X/Y coordinates that I have them stuck on in the snapshot. I just need a, "This is some code that you could use to do this: <code>" sort of a thing.
Back to top
View user's profile Send private message Yahoo Messenger
Bob the Hamster
OHRRPGCE Developer




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

PostPosted: Tue Sep 26, 2006 7:21 am    Post subject: Reply with quote

Kizul Emeraldfire wrote:
Okay, I'm back again (and I edited the thread's subject so it's just a bit more relevant).

How would I use strings to display values such as Hero's Current HP/Hero's Maximum HP, Hero's Current MP/Hero's Max MP and the Days Spent/Hours Spent/Minutes Spent Playing stats the way this (faked) screenshot I made here has them (minus the little symbols, I know how to add those. :D)?



Actually, come to think of it — how do I get strings to display all of those except the map name (the <blank> Plains) and the little colored symbols. >.>;;


Well, to build the string that displays the hero's HP, I would ddo something like this:

Code:

$1="HP: "
append number(1,get hero stat(hero, stat:HP, current stat))
append ascii(1,47)
append number(1,get hero stat(hero, stat:HP, maximum stat))



Displaying equipment names is slightly trickier. You need a temporary string for copying. I reccomend using string ID 0 for a temporary string.

Code:

$2="WEAPON: "
get item name(0,check equipment(hero, slot:weapon))
2 $+ 0


That last part, 2 $+ 0 atkes the contents of string 0 and copies it onto the end of string 2
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Tue Sep 26, 2006 11:57 am    Post subject: Reply with quote

Oh, I see now! It's only supposed to be ONE equals sign! That's why those never worked for me, I kept using two by mistake. XD

Now that I know this, this will be a lot easier. Thanks James! :D

Hmm, I've been messing with it a bit — I'm doing it one half at a time — and the HP, MP and location things work good, but the Time doesn't update like it should. I spent about three minutes in-game, and the minutes value just stayed at 0.

Also, is there a way to have a textbox stay shown without having to use NPCs to fake it?

Failing that, is there a way to suspend NPC walls and/or obstructions for only certain NPCs (that way I can have it look as if there's a textbox there, but it doesn't mess up the other NPCs or the hero or anything)?
Back to top
View user's profile Send private message Yahoo Messenger
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Tue Sep 26, 2006 12:13 pm    Post subject: Reply with quote

Unfortunately, I'm pretty sure that the answer to both of those last two questions is "no". The only thing I can think of is to have to use the 'put NPC' command to allow pixel-based movement, which has no conception of walls. This sounds very messy. If you can find a color for the strings that allows them to stand out, it might be better to eliminate the box... or could this be accomplished with vehicle-NPCs???
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: Tue Sep 26, 2006 9:50 pm    Post subject: Reply with quote

Strings displayed on screen with showstringat always display their current state: changing the string will change what is displayed on screen.

Strings displayed with showstring and embedded in textboxes will only display their content at the moment showstring is called or the textbox is called.

However, your time string doesn't contain
"TIME: D: {days of play}, H: {hours of play}, M: {minutes of play}",
it contains "TIME: D: 0, H: 0, M: 0"
And it's going to contine to display that until you change it.

Future versions should have the ability to draw boxs and rectangles to let you fake textboxes, but if it is absolutely necessary to display a textbox and let the hero continue to move, your best bet is to script hero movement yourself. Obviously you won't be able to display 2 textboxes on screen at once. If you need to, I agree with msw, ditch the box.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Tue Sep 26, 2006 10:36 pm    Post subject: Reply with quote

The Mad Cacti wrote:
Strings displayed on screen with showstringat always display their current state: changing the string will change what is displayed on screen.

Strings displayed with showstring and embedded in textboxes will only display their content at the moment showstring is called or the textbox is called.

However, your time string doesn't contain
"TIME: D: {days of play}, H: {hours of play}, M: {minutes of play}",
it contains "TIME: D: 0, H: 0, M: 0"
And it's going to contine to display that until you change it.


Actually, my string does contain that:

Code:
script, show time, begin

$26="TIME:D:"
append number (26,days of play)
append ascii (26,44)
append ascii (26,72)
append ascii (26,58)
append number (26,hours of play)
append ascii (26,44)
append ascii (26,77)
append ascii (26,58)
append number (26,minutes of play)
show string at (26,18,34)
end

I think I'm doing something wrong here. XD

Edit: to clear things up, just in case you couldn't tell, those Append ASCII commands show ',H:' and ',M:' — the way I have the font, the spaces between those characters is unneeded.

The Mad Cacti wrote:
Future versions should have the ability to draw boxs and rectangles to let you fake textboxes, but if it is absolutely necessary to display a textbox and let the hero continue to move, your best bet is to script hero movement yourself. Obviously you won't be able to display 2 textboxes on screen at once. If you need to, I agree with msw, ditch the box.


Well it's not exactly NECESSARY, it's just that the strings look better with something behind 'em. I guess I'll just ditch the box itself for now and wait'll I can fake it. :D I AM going to keep the stats and stuff though, box or no box.
Back to top
View user's profile Send private message Yahoo Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Wed Sep 27, 2006 6:38 am    Post subject: Reply with quote

Oh, so you are calling showtime everytime you want the string to update (every so now and then or every tick/minute)? I don't see why daysofplay, etc, should not work.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Wed Sep 27, 2006 10:46 am    Post subject: Reply with quote

Huh, THAT'S what that problem was — I wasn't doing anything wrong in the Show Time script or any of the OTHER scripts — I just wasn't calling THOSE scripts enough in Show Stat Box:

Code:
script, show statbox, begin

variable (forevar)

for (forevar,0,10,0) do (
show HP
show MP
show Location
show Time
wait
))

Imagine that without the For loop I just added, and that's what I had that wasn't working. XD Now that I've added it though, it works fine. :D I guess I'll do the equipmenty things and stuff now. :)
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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