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

help with my item menu

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




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Sun Jan 03, 2010 2:01 am    Post subject: help with my item menu Reply with quote

I'm creating my own item menu.

I would like a script that checked how many item I have in the basic menu and stick in a global variable

I've tried with those 2 first before going further : shoronpos and nikuman
There are item nb 6 and 7 in the list you can edit in the item menu under custom.

I currently have 5 shoronpos and 5 nikumans when I check the item menu of the basic menu.

I would like to store this info to make it appear on my menu. I've tried

Code:

set variable (nb shoronpo, get item (6)) #stick the number of shoronpo we have
set variable (nb nikuman, get item (7)) #stick the number of nikuman


The code compile but it seems to me that I'm going to stick the number I've just given to the player (in the case, 0)

I can't just increment the variable each time the player find a treasure chest because it wouldn't work with the items bought in shops.

I think that the export global and import global may be what I need (it worked very well with time) but I don't see how to get the number of item we currently have.

The other solution would be to add a plotscript command that stores the number of a precise item (it could be found using item:name or its rank in the item menu)

As always thanks for the help!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Rimudora
Psychopath yandere
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 26 May 2005
Posts: 335

PostPosted: Sun Jan 03, 2010 12:13 pm    Post subject: Reply with quote

I think the command you're looking for is 'inventory(item #)', which tells you how many of an item you have.

Code:
nb shoronpo:=inventory(6)
nb nikuman:=inventory(7)
Back to top
View user's profile Send private message Send e-mail
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Mon Jan 04, 2010 9:45 pm    Post subject: Store text in a global variable. Reply with quote

'inventory(item #)' worked great! Thanks Rimudora !

I'm using strings to store text such as explained in
http://gilgamesh.hamsterrepublic.com/wiki/ohrrpgce/index.php/Strings
What is a string and how do I use it?

and I would like to the same using a global variable. I know it is possible possible to store text in variable : it happens when you use the command get hero name.

My question is : how to do with words (or phrases) such as

$1 ="Hello "
$2 ="Bob"

As always thanks a lot for your help!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Mon Jan 04, 2010 10:02 pm    Post subject: Reply with quote

I don't understand what you are asking. Do you want to store a string in a normal variable? That's not possible yet, sorry. You can only store strings in the special string variables numbered 0 to 31.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Tue Jan 05, 2010 10:35 pm    Post subject: Sorry, once again I made myself missunderstood Reply with quote

Sorry ! I made myself missunderstood again!

I would like to store text in global variable. I know that it s technically possible because you can already store heroes' names.

I would like to store simple text (like dialogue lines in the text boxes) in a global variable. Is it possible and if so, how do I do?

Thanks for the help!

P.S: Message number 400! Hurra !
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Wed Jan 06, 2010 2:36 am    Post subject: Reply with quote

Like I said, no, it isn't possible.

The closest thing you can do is to store a string ID number in a global variable, like this:
Code:
global variable (1, my string)

...

my string:= 1  # string ID 1
$my string="some text"

...

show string (my string)

_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Wed Jan 06, 2010 9:28 pm    Post subject: Thanks! It worthes knowing it! Reply with quote

Thanks! It sures is a worthy piece of information!

As always I've got another question! I would to make disappear (or to hide) a menu items while the item in question is not in stock.

Do you think I can do this using plotscripting ?
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Jan 08, 2010 8:46 am    Post subject: Reply with quote

The simplest way to do that is to just disable the menu item depending on a tag, and set the "Hide if disabled" bitset. You can set this in the menu editor (or even change the settings with the "set menu item tag" and "set menu item bit" commands)

Alternatively, you can use the "delete menu item" command.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Fri Jan 08, 2010 9:42 pm    Post subject: Script that ends too early Reply with quote

Thanks a lot! I'll use the hide if disabled bitset then!

I'm working on the script that will update my items by checking which items (and in what quantities) I have in Custom.exe's inventory, store
infos in variables and put it in the datas of the menu I've created.

There's a problem with the magic stone. Whereas I have magic stones in my inventory, the script ends too early and the items is still hidden when I test.

When I test with a simple test box and turn the tag 47 (tag: magic stone in stock, on) I finally appears!

What could be wrong with my script and what kind of test should I make?

Code:

#-------------------------------------------------------------
plotscript, items update for inventory, begin

suspend player

set variable (nb shoronpo, inventory (6))
set variable (nb nikuman, inventory (7))
set variable (nb magic stone, inventory (8))

if (nb shoronpo ==0) then, begin #if there's no items tag is turned off and item disappear from the menu
set tag (tag: shoronpo in stock, off)
end

if (nb nikuman ==0)then, begin
set tag (tag: nikuman in stock, off)
end

if (nb magic stone ==0) then, begin #PB TAG
set tag (tag: magic stone in stock, off)
end

wait (1)
set tag (tag: items inventory up, off) #clean unactivation for items stats script
update items:= false
wait (1)

resume player
 
end #end of the plotscript

_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Fri Jan 08, 2010 10:17 pm    Post subject: Finally it was not because of the script Reply with quote

Finally, the problem cam from the fact I didn't give magic stone a tag that confirms the item is in inventory!

Anyway I intend to add items all along the game so I think it would be a good idea to use the crtl variable to make repeat the operation for each
item.

I'm not very used to keying in with this variable. Could someone help me?

Thanks in advance for the help!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Jan 10, 2010 11:33 am    Post subject: Reply with quote

What do you meant by "crtl variable"?
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Mon Jan 11, 2010 12:14 am    Post subject: I was thinking about the article about the movie Reply with quote

I was thinking about using a variable just like in the article

How do I make a "fake" movie using backdrops?

But the items will be in different inventory slots, so it may create troubles with chosing the numbers... unless I decide that item from 6 to 22 will be items...

Yeah! I think I'll do that!

Code:

plotscript, test all items auto update, begin

suspend player
suspend npcs

 variable(ctr)

  # loop through items inventory (6, 22)

  for (ctr, 8, 22) do, begin
  #??? what should I put here ?
  end #end for "for (ctr)"

resume player
resume npcs
end #end for the script
#---------------------------------------------------------------------------



As always thanks a lot for the help!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Mon Jan 11, 2010 3:19 am    Post subject: Reply with quote

If you have a "have in inventory" tag for each item, and create a menu item in the menu editor in Custom for each item with "Enable if tag #=ON" and the "Hide if disabled" bitset, then you don't need any script at all. Items will disappear from the menu automatically. I thought that that is what you are doing? Did you decide not to do this?

But if you don't want to use tags at all, then you can create the menu completely by script:

Code:
  variable (item, menuitem, menu)

  menu := create menu

  # loop through items inventory (6, 22)
  for (item, 6, 22) do, begin
    # have at least one item
    if (inventory (item)) then, begin
      menuitem := add menu item (menu)
      # get the name of the item in string 0
      get item name (0, item)
      set menu item caption (menu item, 0)
    end
  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