Need Help

VikingKing

Active Member
Here are the two pieces I am working on:

voicechat.iss
Code:
;Voice Chat Management
;by Vikingking

variable(global) string PushToTalk=test
variable string RelayKey
variable string ChatSession
variable bool UIExists
variable string BindsMade="not made!"
variable VoiceChatObj VoiceChat

function main()
{
	echo ${PushToTalk}
	ui -reload "${LavishScript.HomeDirectory}/Interface/skins/eq2/eq2.xml"
	ui -load -skin eq2 scripts/voicechat.xml
	UIExists:Set[TRUE]

	do
	{	
	}
	while ${UIExists}

	relay all bind -press Voicechat1 ${RelayKey} "relay ${ChatSession} press -hold ${PushToTalk}"
	relay all bind -release Voicechat2 ${RelayKey} "relay ${ChatSession} press -release ${PushToTalk}"
	${BindsMade}:Set["made!"]
}



objectdef VoiceChatObj
{
	method RefreshSessions(int tmpvar, int TotalSessions)
	{	
		TotalSessions:Set[${Sessions}+1]

		UIElement["SessionList@VoiceChat"]:ClearItems
		UIElement["SessionList@VoiceChat"]:AddItem[${Session}]
			if ${TotalSessions}!=1
			{
				do
				{
				UIElement["SessionList@VoiceChat"]:AddItem[${Session[${tmpvar}]}]
				}
				while ${tmpvar:Inc}<${TotalSessions}
			}
	}
}




function atexit()
{
	Echo Ending VoiceChat, Binds are ${BindsMade}
	
	ui -unload scripts/voicechat.xml
}
voicechat.xml
Code:
 <?xml version="1.0" encoding="UTF-8"?>
 <ISUI>
 	<Window name='VoiceChat'>
 		<X>150</X>
 		<Y>100</Y>
 		<Width>300</Width>
 		<Height>400</Height>
		<Title>Voicechat</Title>
		<TitleBar template='window.Titlebar'>
			<Children>
				<Text Name='Title' Template='window.Titlebar.Title' />
				<Button Name='Minimize' Template='window.Titlebar.Minimize' />
				<Button Name='Maximize' Template='window.Titlebar.Maximize' />
				<commandbutton name='Custom Close Button' Template='window.Titlebar.Close'>
					<Command>Script[voicechat]:End</Command>
				</commandbutton>
			</Children>
		</TitleBar>
 		<Children>

			<Text name='Warning'>
				<X>15</X>
				<Y>15</Y>
				<Font>
				   <Size>20</Size>
				</Font>
				<Height>40</Height>
				<Width>270</Width>
				<Alignment>Center</Alignment>
				<Text>Warning: Some keys will not work</Text>
			</Text>				

			<Text name='Warning2'>
				<X>15</X>
				<Y>40</Y>
				<Font>
				   <Size>20</Size>
				</Font>
				<Height>40</Height>
				<Width>270</Width>
				<Alignment>Center</Alignment>
				<Text>with this script</Text>
			</Text>				

			<Text name='PTT Prompt'>
				<X>140</X>
				<Y>120</Y>
				<Width>130</Width>
				<Height>15</Height>
				<Text>What is your PTT Key?</Text>
			</Text>

			<combobox name='PushToTalkEntry'>
				<X>140</X>
				<Y>140</Y>
				<Width>130</Width>
				<Height>15</Height>
				<ButtonWidth>15</ButtonWidth>
				<FullHeight>100</FullHeight>
				<Sort>Text</Sort>
				<Items>
				   <Item Value='1'>Ctrl</Item>
				   <Item Value='2'>Alt</Item>				   				

				   <Item Value='3'>Caps Lock</Item>				   			
				   <Item Value='4'>Mouse3</Item>	
				</Items>			   				
				<OnSelect>
				   declare tempvar string
				   echo ${This.SelectedItem.Text}
				   tempvar:Set[${This.SelectedItem.Text}]
				   echo tempvar: ${tempvar}
				   Script[voicechat].Variable[PushToTalk]:Set[${tempvar}]
				</OnSelect>
			</comboBox>

			<Text name='Activate Prompt'>
				<X>140</X>
				<Y>170</Y>
				<Width>130</Width>
				<Height>15</Height>
				<Text>What should activate it?</Text>
			</Text>

			<combobox name='ActivateEntry'>
				<X>140</X>
				<Y>190</Y>
				<Width>130</Width>
				<Height>15</Height>
				<ButtonWidth>15</ButtonWidth>
				<FullHeight>100</FullHeight>
				<Sort>Text</Sort>
				<Items>
				   <Item Value='1'>Ctrl</Item>
				   <Item Value='2'>Alt</Item>				   				

				   <Item Value='3'>Caps Lock</Item>				   			
				   <Item Value='4'>Mouse3</Item>	
				</Items>
			</combobox>


			<Text name='HelpMe'>
				<X>140</X>
				<Y>225</Y>
				<Width>150</Width>
				<Height>15</Height>
				<Wrap>1</Wrap>
				<Text>Display a keylist in console</Text>
			</Text>

			<commandbutton name='Keylist'>
				<X>145</X>
				<Y>250</Y>
				<Width>120</Width>
				<Height>20</Height>
				<Text>Keylist</Text>
				<Command>bind -keylist</Command>
			</commandbutton>

			<Text name='Session Prompt'>
				<X>40</X>
				<Y>75</Y>
				<Width>70</Width>
				<Height>15</Height>
				<Text>PTT Session</Text>
			</Text>


			<Text name='Refresh Prompt'>
				<X>70</X>
				<Y>95</Y>
				<Width>80</Width>
				<Height>15</Height>
				<Text>Refresh List</Text>
			</Text>

			<Commandbutton name='RefreshSessions'>
				<X>40</X>
				<Y>90</Y>
				<Width>20</Width>
				<Height>20</Height>
				<Text></Text>
				<AutoTooltip>Refresh your list of sessions</AutoTooltip>
				<OnLeftClick>
				  Script[voicechat].VariableScope.VoiceChat:RefreshSessions[1,1]
				</OnLeftClick>
			</Commandbutton>

			<listbox name='SessionList'>
				<X>40</X>
				<Y>115</Y>
				<Width>70</Width>
				<Height>180</Height>
				<SelectMultiple>0</SelectMultiple>
				<Sort>Text</Sort>
				<Items>
				</Items>
				<OnLoad>
				   Script[voicechat].VariableScope.VoiceChat:RefreshSessions[1,1]
				</OnLoad>
				<OnSelect>
				</OnSelect>
			</listbox>
 
			<commandbutton name='Execute'>
				<X>90</X>
				<Y>330</Y>
				<Width>120</Width>
				<Height>20</Height>
				<Text>Execute</Text>
				<AutoTooltip>This will begin the binds</AutoTooltip>
				<Command>
				  echo Coming Soon!
				</Command>
			</commandbutton>
 

 		</Children>
 	</Window>
 </ISUI>
 
Last edited:

VikingKing

Active Member
The issue is with the 'PushToTalkEntry' combobox and the variable PushToTalk. I have some echo debugs in there right now.

You'll see when you first load the script that it echos ${PushToTalk} and the console displays "test" as it should.

However, after the UI loads, for some reason the value of ${PushToTalk} becomes NULL, and the combobox is unable to set it to anything else.

What am I missing here?
 

VikingKing

Active Member
Update: making PushToTalk a global variable has solved the problem of it getting set to NULL, but the UI is still unable to set the it using Script[].Variable:Set[]
 

VikingKing

Active Member
Oh yeah, my theory is that the variable is stuck in limbo or something because of my do...while loop. However, I don't want the script to process until the user is done putting settings in the UI.

If there's a better way of doing this, let me know but that may not even really be the issue.
 

mycroft

Script Author: MyPrices
Update: making PushToTalk a global variable has solved the problem of it getting set to NULL, but the UI is still unable to set the it using Script[].Variable:Set[]
This is the command I use in myprices , the only time it hasn't worked as when UI had the wrong name in the command somewhere.

Code:
Script[myprices].VariableScope.MatchLowPrice:Set[TRUE]
 
Top Bottom