Debugging Again

This forum is meant for posting anything related to Adventure Maker that doesn't fit in the other forums.Please post technical questions in the Technical Support Forum!

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Debugging Again

Postby JasonMc » Tue Jul 20, 2010 6:57 pm

Okay, I'm having some weird anomalie with my inventory script...

I need to get the inventory action programmed into KeyGuard, so I'm using this:

Code: Select all
If KeyID = 7 and inven=1 Then HIDEINVEN
If KeyID = 7 and inven=0 Then SHOWINVEN


Here are the HIDEINVEN and SHOWINVEN procedures.

Code: Select all
sub HIDEINVEN()
inven = 1
InventoryCanvasObject.visible=false
InventoryBackgroundObject.visible=false
For Each x in InventoryItemObject
x.visible=false
Next
End Sub

sub SHOWINVEN()
inven = 0
InventoryBackgroundObject.visible=true
For Each x in InventoryItemObject
x.visible=true
Next
End Sub


HIDEINVEN responds to the "I" key, but when I press "I" again, SHOWINVEN does not execute. I have confirmed that the variable "inven" does change from "0" to "1" when the HIDEINVEN procedure is executed.

Why is SHOWINVEN not responding to the "I" key?
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA

Postby ShadowHunter » Tue Jul 20, 2010 7:50 pm

The procedure "HIDEINVIN" should toggle the variable "inven" to 0 instead of 1 (and visa versa ) else the value never changes correctly and your statement is never evaluated true.
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby JasonMc » Tue Jul 20, 2010 7:59 pm

I swapped the whole kit and caboodle as suggested, and it isn't working.

I changed it in the procedures, the KeyGuard, and the button, and it has the same problem.
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA

Postby ShadowHunter » Tue Jul 20, 2010 10:46 pm

You did make "inven" a global variable, right? Please post your reworked code...
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby JasonMc » Tue Jul 20, 2010 11:36 pm

Menu Button:
Code: Select all
If inven=0 then HIDEINVEN
If inven=1 then SHOWINVEN


KeyGuard Key:
Code: Select all
If KeyID = 7 and inven=0 Then HIDEINVEN
If KeyID = 7 and inven=1 Then SHOWINVEN


Procedure:
Code: Select all
sub HIDEINVEN()
inven = 0
InventoryCanvasObject.visible=false
InventoryBackgroundObject.visible=false
For Each x in InventoryItemObject
x.visible=false
Next
End Sub

sub SHOWINVEN()
inven = 1
InventoryBackgroundObject.visible=true
For Each x in InventoryItemObject
x.visible=true
Next
End Sub


"inven" is a global integer variable.
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA


Return to Adventure Maker General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron