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

custom shop script error?

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







PostPosted: Sun Jan 09, 2005 10:52 am    Post subject: custom shop script error? Reply with quote

The basic premise behind this is to create a custom shop which will equip an item on the lead party member. It would show a backdrop until the player hit one of the keys (defined as scancodes, I've already double checked to make sure they're correct) where it would equip the lead with an item, then return player control and remove the backdrop.

Except I've screwed up somewhere and it locks up immediately after the part where you can change the party leader. Maybe someone can figure out what the heck is wrong with this?


Code:
script,customshop,begin
 suspend player
 suspend box advance
 show text box (489)
 wait (7)
 wait for key (usekey)
 advance text box
 team menu
 wait (3)
 show backdrop (32)
 while ((checktag (tag:shopping))==(OFF)) do (

 if (key is pressed (71)) then (force equip (0,3,17),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (08)) then (force equip (0,3,17),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (72)) then (force equip (0,3,18),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (09)) then (force equip (0,3,18),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (73)) then (force equip (0,3,19),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (10)) then (force equip (0,3,19),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (75)) then (force equip (0,3,20),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (05)) then (force equip (0,3,20),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (76)) then (force equip (0,3,33),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (06)) then (force equip (0,3,33),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (77)) then (force equip (0,3,21),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (07)) then (force equip (0,3,21),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (79)) then (force equip (0,3,22),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (02)) then (force equip (0,3,22),show map, resume player, resume box

advance, set tag (tag:shopping,ON))
 if (key is pressed (80)) then (show text box (0), set tag (tag:shopping,ON))
 if (key is pressed (03)) then (show text box (0), set tag (tag:shopping,ON))
 if (key is pressed (81)) then (show map, resume player, resume box advance, set tag

(tag:shopping,ON))
 if (key is pressed (04)) then (show map, resume player, resume box advance, set tag

(tag:shopping,ON)))
 wait (1)
 set tag (tag:shopping,OFF)


end
Back to top
Fenrir-Lunaris
WUT




Joined: 03 Feb 2003
Posts: 1747

PostPosted: Sun Jan 09, 2005 11:14 am    Post subject: Reply with quote



I'm trying to do something like that, basically. I can get to the backdrop now, but when it pops up, the whole thing locks up (again).
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Jan 09, 2005 12:53 pm    Post subject: Reply with quote

You didn't put the wait(1) inside the while loop.
Should be:
Code:

    ...
    if (key is pressed (04)) then (show map, resume player, resume box advance, set tag(tag:shopping,ON))
    wait (1)
  )
  set tag (tag:shopping,OFF)

end

PS: You use too many brackets, and it makes your code harder to read. For example,
Code:
 while ((checktag (tag:shopping))==(OFF))


could be

Code:
 while (checktag(tag:shopping) == OFF)

which I think is easier to read, and has less risk of being incorrectly typed.

PSS: http://gilgamesh.dnsalias.org:8080/wiki/ohrrpgce/index.php/How_do_I_use_scancodes%3F
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Shadowiii
It's been real.




Joined: 14 Feb 2003
Posts: 2460

PostPosted: Sun Jan 09, 2005 1:33 pm    Post subject: Reply with quote

Poop, cacti beat me to it.

While making while loops that endlessly check, ALWAYS put wait's. I had this problem many a time when scripting Boss AI for 7th Day, and the side room scripts for PB2. The wait will not lag your code at all, actually, so don't worry about it. If you have an endless while loop (which is what that one is right now), it'll freeze.

You also could add a "wait for keypress" in the whileloop if you so desired, and it might work out just as well, or better.

EX
Code:
 while ((checktag (tag:shopping))==(OFF)) do (

wait for key (anykey)

if (key is pressed (71)) then (force equip (0,3,17),show map, resume player, resume box

advance, set tag (tag:shopping,ON))

_________________
But enough talk, have at you!
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