Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Inventory Activate/Deactivate Messages
Inventory Activate/Deactivate Messages
2003-06-21, 1:09 PM #1
I made a hotkeyable jetpack. The first cog that actually activates it works perfectly. The 2 hotkey cogs that control the up/down movements is where I'm having the problems. I can't get the deactivated message to work. I want activated to work only when the button is pressed, and deactivated when it's released. However, I don't want icons for those functions to show up when I use them, or in the inventory icon "list" at the bottom of the screen. Here's the cogs:
Code:
# DogSRoOL's Wasteland - Cog Script
# Written by Brandon "DogSRoOL" Bull
#
# jpUp.COG
#
# Changes inventory for Jetpack "up" feature.
# 
# You may not use this cog without permission.
# Get Permission at:
# GuitarOfGold@aol.com
# GuitarOfGold@yahoo.com
# IM available on both.
symbols
Message      Activated                                                        
Message      Deactivated                                                      
int          upbin=117                                                        
int          dnbin=118                                                        
Thing        player                                                           
end                                                                           

code
Activated:
	player = GetSourceRef();
	SetInv(Player, upbin, 1);
	SetInv(player, dnbin, 0);
	Return;

Deactivated:
	player = GetSourceRef();
	SetInv(Player, upbin, 0);
	Return;
end
Second cog:
Code:
# DogSRoOL's Wasteland - Cog Script
# Written by Brandon "DogSRoOL" Bull
#
# jpDown.COG
#
# Changes inventory for Jetpack "down" feature.
# 
# You may not use this cog without permission.
# Get Permission at:
# GuitarOfGold@aol.com
# GuitarOfGold@yahoo.com
# IM available on both.
symbols
Message      Activated                                                        
Message      Deactivated                                                      
int          upbin=117                                                        
int          dnbin=118                                                        
Thing        player                                                           
end                                                                           

code
Activated:
	player = GetSourceRef();
	SetInv(Player, upbin, 0);
	SetInv(player, dnbin, 1);
	Return;

Deactivated:
	player = GetSourceRef();
	SetInv(Player, dnbin, 0);
	Return;
end

[edit]I should also mention that when these inventories are at 1, the jetpack cog applies an upward or downward force to the player, depending on which one is activated. As a result, both up & down inventories cannot be 1 at the same time.[/edit]
------------------
"The Just shall live by faith." - Galatians 3:11
To edit is human... To COG is divine!!

pegasus_1984: Stop bushing that dang suck button.
guitarofgold: NOOOOOOOOO!!!!
-------[end post]-------

[This message has been edited by DogSRoOL (edited June 21, 2003).]
Catloaf, meet mouseloaf.
My music
2003-06-21, 1:37 PM #2
*cough*print("deactivated");*cough*see if that works*cough*in your deactivated messages*cough*

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.

The 2 riddle!

[This message has been edited by Descent_pilot (edited June 21, 2003).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2003-06-21, 1:53 PM #3
Quote:
<font face="Verdana, Arial" size="2">I can't get the deactivated message to work. I want activated to work only when the button is pressed, and deactivated when it's released. However, I don't want icons for those functions to show up when I use them, or in the inventory icon "list" at the bottom of the screen.</font>


I doubt there's anything wrong with your cogs. It sounds like you want deactivated to run without making your items bin for an item (0x2). But that won't work, deactivated will only be called if the items bin is for an item, power, or weapon.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-06-21, 2:06 PM #4
The icon only shows up if you use ActivateBin(), I think. But like SM said, I am pretty sure your cogs work, just checking every end tho.

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.

The 2 riddle!
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2003-06-22, 6:36 PM #5
The cogs work fine. But the inventory selection list is flickery, plus nothing shows up for the up & down functions. The icon doesn't show up in the top right corner, however, which is what I want.

------------------
"The Just shall live by faith." - Galatians 3:11
To edit is human... To COG is divine!!

pegasus_1984: Stop bushing that dang suck button.
guitarofgold: NOOOOOOOOO!!!!
-------[end post]-------
Catloaf, meet mouseloaf.
My music
2003-06-22, 7:13 PM #6
Right, the icon will not show in the top-right corner unless you activate the bin.

As for the flickering effect, do you have a value of at least one assigned to your bin. The flickering effect is caused when you have a bin available (via 0x20 or SetInvAvailable()), but don't have anything in the bin. JK will show your icon the selection box, but then remove it because there's nothing in the bin.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-06-22, 9:28 PM #7
aah. I have minimum value of 0, max of 1. It changes depending whether the button is pressed or not so I can reference it in another cog with inventory verbs. Perhaps I should try SendMessage(); instead?

------------------
"The Just shall live by faith." - Galatians 3:11
To edit is human... To COG is divine!!

pegasus_1984: Stop bushing that dang suck button.
guitarofgold: NOOOOOOOOO!!!!
-------[end post]-------
Catloaf, meet mouseloaf.
My music
2003-06-23, 8:05 PM #8
I take it you have a pulse or something in your main cog to check these bins? The most simple solution is to use 1 & 2 instead of 0 & 1.

But if your main cog is running a pulse, then it would be a lot better to make your code event-based if you can.

You could create a new bin for your main cog and use the changed event to tell the cog what to do. The value of this new bin would 0 for off, 1 for up, and 2 for down. Your two hotkey cogs would set this bin instead of their own - they would always have a value of 1 in their own bins.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-06-23, 9:04 PM #9
That sound much more efficient.

------------------
"The Just shall live by faith." - Galatians 3:11
To edit is human... To COG is divine!!

pegasus_1984: Stop bushing that dang suck button.
guitarofgold: NOOOOOOOOO!!!!
-------[end post]-------
Catloaf, meet mouseloaf.
My music

↑ Up to the top!