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

Item trickery - best approach?

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Thu May 06, 2010 6:39 pm    Post subject: Item trickery - best approach? Reply with quote

Hi everyone. I'm trying to arrange an item in my first game to work differently depending on a tag. If the tag is off, then the item should call a textbox that leads to some stuff. If the tag is on, then the item should act like a standard healing item.

The problem is that if I have the item call a textbox leading to a script, then the script has no way to make the item act like a normal item. That is to say, even if I script the effect of the item (as I have done for the original version of the game), the menu for picking what hero to heal does not 'match' the regular one if a healing item is used - it doesn't show HP, and more importantly it doesn't allow use to continue until the item runs out. Now I suppose this could be done with complicated scripting, but then the item menu would not be able to pause other scripts in the background very easily.

So I am wondering what the best tactic would be. Right now I'm thinking that I will just have two copies of the item, and having an everykeypress, waitless script that swaps copies of items based on the tag.

I wanted to ask here first if anyone can think of an easier way of doing this, only because this will mean I have to go through about 90 maps putting in this script as my 'keypress' script and/or adding it to the front of already existing keypress scripts. And it shouldn't have any effect on background scripts if it's waitless, should it?
_________________
My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161

This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
Back to top
View user's profile Send private message Visit poster's website
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Thu May 06, 2010 8:27 pm    Post subject: Reply with quote

Man you have me stumped.
There isn't a "use item" command, is there?

I looked through the PS dictionary and found this:
outside battle cure (attack, target, attacker)
but I guess that's not what you want because you want the player to designate the cure target, not the script.
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Thu May 06, 2010 8:39 pm    Post subject: Reply with quote

Yeah, it is a little disheartening how little customizability there is with items. I've thought about this a bit more, and I think I have no choice but to go with the keypress script. The only issue is that I have a game that is over 25 hours long, and I'm in the middle of playtesting it and at 12 hours, and I don't want to have to retest all of the scenarios in those 12 hours that involve background scripts. So can anyone confirm that a keypress script that has nothing but if checks and NO WAITS cannot interfere with a background script?
_________________
My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161

This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
Back to top
View user's profile Send private message Visit poster's website
The Drizzle
Who is the Drizzle?




Joined: 12 Nov 2003
Posts: 432

PostPosted: Thu May 06, 2010 10:40 pm    Post subject: Reply with quote

You could just make two items with identical names but different effects. Then swap one out for the other if the tag is on.
_________________
My name is...
The shake-zula, the mic rulah, the old schoola, you wanna trip? I'll bring it to yah...
Back to top
View user's profile Send private message AIM Address
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri May 07, 2010 7:32 am    Post subject: Reply with quote

msw188 wrote:
So can anyone confirm that a keypress script that has nothing but if checks and NO WAITS cannot interfere with a background script?


That's right, as long as it doesn't contain any commands that cause hidden waits - things like '"teleport to map". But your script won't have any.

But there's a potentially easier solution: rather than do the check in in an on-keypress key, have you considered creating a wrapper script around the items menu? If your main menu pauses scripts, then I think you should be able to work around it by using the "Close menu if selected" menu item bitset (and reopening the main menu after the Items menu, if desired)

Items need some improvements. We don't really have clear ideas for this; it would be good to hammer out a plan for a more flexible item system.

And we really need global on keypress, on footstep, etc, scripts. This is planned, but since scripts interfere with each other so easily, we seem to be waiting until that is fixed first.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Fri May 07, 2010 7:48 am    Post subject: Reply with quote

To the Drizzle:
Yes, that's exactly what I'm trying to do. I was going to swap them out on every keypress, but now I am intrigued by...

To TMC:
Hm, I didn't think of closing the Main Menu to allow my script to run before the item menu. Here's a question then. If my itemmenu wrapper script looks like:

swapitems
openitemmenu
while(itemmenu is open)
(wait 1)
open main menu

will the item menu, and all item use, still pause background scripts? Furthermore, is there an easy way to check if the itemmenu is still open? I guess maybe just (topmenu<>false). Would that work, do you think?
_________________
My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161

This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
Back to top
View user's profile Send private message Visit poster's website
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Fri May 07, 2010 8:59 am    Post subject: Reply with quote

Okay, I discovered the answers to some of my previous questions, and my item wrapper script now looks like:
Code:
script,Itemmenu,begin
if(checktag(tag:knowsStMd)==false ,and, checktag(tag:Ma in Party)==true),then
 begin
  getitem(199,inventory(204))
  deleteitem(204,inventory(204))
 end
else
 begin
  getitem(204,inventory(199))
  deleteitem(199,inventory(199))
 end
itemsmenu
end


The only problem I have is that I can't find a good way to bring back the main menu after the item menu closes. If I just put the command "main menu" at the end of the script, the menu gets called over top of text boxes if I chose an item that calls a text box. If I put a "wait for text box" command in before calling the main menu, it still pops up over later text boxes if the item chosen led to a textbox that led to a script that led to more stuff happening. If anyone has any ideas around this that would be great, but otherwise it looks like I'm going to have to let the item menu NOT lead back to the main menu, which is regrettable but not gamebreaking.

Hm, as I typed that, I thought, maybe a keyispressed check? So that if the itemmenu was closed via ESC or ALT, then the main menu opens since there must not be a textbox visible at that point? Then the main menu wouldn't come back from picking done, but would still come back if the player merely 'cancelled' the use of the item menu...

I have another problem now as well. I know it is possible for a 'pick hero' menu (called by the "pick hero" plotscripting command) to appear over top of a textbox with choice enabled; is it possible for the pick hero menu to appear over other text boxes as well? If it is, I can't figure out how. If not, I think this is a bug - it shouldn't matter whether a text box has choice enabled, it should either always allow the pickhero menu to appear or never.

EDIT:
I just tried my keyispressed idea for closing the item menu, and it seems to work great! I'm still stumped as to what is going on with my text box+pick hero thing though.
_________________
My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161

This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
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 May 08, 2010 8:39 am    Post subject: Reply with quote

msw188 wrote:
I have another problem now as well. I know it is possible for a 'pick hero' menu (called by the "pick hero" plotscripting command) to appear over top of a textbox with choice enabled; is it possible for the pick hero menu to appear over other text boxes as well? If it is, I can't figure out how. If not, I think this is a bug - it shouldn't matter whether a text box has choice enabled, it should either always allow the pickhero menu to appear or never.


That's interesting. Yes, there is a bug here, but you're mistaken: there's no difference between textboxes with and without choices.

The "pick hero" and item use menus take screenshots when invoked and use them as backgrounds to a completely separate menu, pausing the rest of the engine.

So if you write
Code:
show textbox(#)
pick hero

the menu comes up before the textbox is drawn.

If you place a wait(1) in between you'll see the textbox for an instant, and then no textbox behind the menu. This is where there's an actual bug: the pickhero menu is using the wrong frame as background: the previous frame before the current one (internally there is a (useless since the port from DOS) double buffering scheme).

If you place a wait(2) in between, you'll see the textbox with the first line of text for an instant, and then a blank box behind the menu.

Quote:
I just tried my keyispressed idea for closing the item menu, and it seems to work great!


That's simpler than what I would have suggested:
Code:
while (current textbox) do (wait, wait for textbox)

(or something like that: its hard to tell whether that works)
_________________
"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