1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Greetings Guest!!

    In order to combat SPAM on the forums, all users are required to have a minimum of 2 posts before they can submit links in any post or thread.

    Dismiss Notice
  3. Greetings Guest, Having Login Issues? Check this thread!
    Dismiss Notice
  4. Hail Guest!,
    Please take a moment to read this post reminding you all of the importance of Account Security.
    Dismiss Notice

Conditional Statement to Detect Mounted State

Discussion in 'UO Enhanced Client Discussion' started by Llewen, Jan 10, 2017.

  1. Llewen

    Llewen Grand Inquisitor
    Stratics Veteran Stratics Legend Campaign Supporter

    Joined:
    Mar 3, 2006
    Messages:
    4,789
    Likes Received:
    250
    I'm wondering if it is possible with a command line script to set actions based on whether you are mounted or not? The problem is that if you are mounted, and you give the all kill command to a loose pet, the pet you are mounted on will refuse the command and lose loyalty.

    What I want is a conditional statement that will say "[pet name] kill" if I am mounted and "all kill" if I am not. It seems to me that this would be possible, I just don't know how to do it.
     
  2. petemage

    petemage Slightly Crazed
    Stratics Veteran

    Joined:
    Oct 6, 2013
    Messages:
    1,419
    Likes Received:
    1,185
    Code:
    script if WindowData.MountedObjId > 0 then SendChat(nil, L"/say puppy kill") else SendChat(nil, L"/say all kill") end
    Script commands are limited to 128 characters in length by default. The thing above is 117 chars in length, so there is quite a bit more space for alternative pet names than "puppy" :p

    If it gets more complex, you have to put it in a mod.
     
  3. Llewen

    Llewen Grand Inquisitor
    Stratics Veteran Stratics Legend Campaign Supporter

    Joined:
    Mar 3, 2006
    Messages:
    4,789
    Likes Received:
    250
    I will have to try that out. Thank you! I had a valuable pet go wild on me because I was giving kill commands to a pet while I was mounted.
     
  4. Llewen

    Llewen Grand Inquisitor
    Stratics Veteran Stratics Legend Campaign Supporter

    Joined:
    Mar 3, 2006
    Messages:
    4,789
    Likes Received:
    250
    Ok if you are using Pinco's UI, the script needs to go as follows:
    Code:
    script if IsRiding() then SendChat(nil, L"/say Dumbo kill") else SendChat(nil, L"/say all kill") end
    edit: Now I need to know if there is a way I can change the "/say" to a whisper.

    In Pinco's UI if you want to use a whisper, emote or yell in a command line script the syntax is as follows:

    Send chat to active chat window:
    Code:
    SendChat(nil, L"Hello World!")
    Say:
    Code:
    SendChat(nil, L"/say Hello World!")
    Emote:
    Code:
    SendChat(nil, L":Hello World!")
    Whisper:
    Code:
    SendChat(nil, L";Hello World!")
    Yell:
    Code:
    SendChat(nil, L"!Hello World!")
     
    #4 Llewen, Jan 19, 2017
    Last edited: Jan 27, 2017
  5. petemage

    petemage Slightly Crazed
    Stratics Veteran

    Joined:
    Oct 6, 2013
    Messages:
    1,419
    Likes Received:
    1,185
    It's supposed to be "/tell" or "/w" according to the ChatSettings.lua. However I couldn't make it work. I think it's something like "/tell <name> <message>" but I guess it would need some more testing with two players.

    Nevermind what I wrote earlier about it.

    Code:
    	ChatSettings.Channels[ SystemData.ChatLogFilters.SAY ]		   = ChatChannel( L"Say",			SystemData.ChatLogFilters.SAY,				"Chat",	 false,		  true,				false,		ChannelColor(215, 215, 1),	  SystemData.ChatLogFilters.SAY,		  L"/say" )
    	ChatSettings.Channels[ SystemData.ChatLogFilters.WHISPER ]	   = ChatChannel( L"Whisper",		SystemData.ChatLogFilters.WHISPER,			"Chat",	 false,		  true,				false,		ChannelColor(215, 215, 1),	  SystemData.ChatLogFilters.WHISPER,	  L"/tell" )
    	ChatSettings.Channels[ SystemData.ChatLogFilters.PARTY ]		 = ChatChannel( L"Party",		  SystemData.ChatLogFilters.PARTY,			  "Chat",	 true,		   true,				false,		ChannelColor(56, 191, 40),	  SystemData.ChatLogFilters.PARTY,		L"/party" )
    	ChatSettings.Channels[ SystemData.ChatLogFilters.GUILD ]		 = ChatChannel( L"Guild",		  SystemData.ChatLogFilters.GUILD,			  "Chat",	 true,		   true,				false,		ChannelColor(96, 231, 0),	   SystemData.ChatLogFilters.GUILD,		L"/guild" )
    	ChatSettings.Channels[ SystemData.ChatLogFilters.ALLIANCE ]	  = ChatChannel( L"Alliance",	   SystemData.ChatLogFilters.ALLIANCE,		   "Chat",	 true,		   true,				false,		ChannelColor(48, 215, 231),	 SystemData.ChatLogFilters.ALLIANCE,	 L"/alliance" )	
    	ChatSettings.Channels[ SystemData.ChatLogFilters.EMOTE ]		 = ChatChannel( L"Emote",		  SystemData.ChatLogFilters.EMOTE,			  "Chat",	 false,		  true,				false,		ChannelColor(215, 215, 1),	  SystemData.ChatLogFilters.EMOTE,		L"/emote" )
    	ChatSettings.Channels[ SystemData.ChatLogFilters.YELL ]		  = ChatChannel( L"Yell",		   SystemData.ChatLogFilters.YELL,			   "Chat",	 false,		  true,				false,		ChannelColor(215, 215, 1),	  SystemData.ChatLogFilters.YELL,		 L"/yell" )
    	ChatSettings.Channels[ SystemData.ChatLogFilters.SYSTEM ]		= ChatChannel( L"System",		 SystemData.ChatLogFilters.SYSTEM,			 "Chat",	 true,		   true,				true,		ChannelColor(255, 255, 255) )	
    	ChatSettings.Channels[ SystemData.ChatLogFilters.PRIVATE ]	   = ChatChannel( L"Private",		SystemData.ChatLogFilters.PRIVATE,			"Chat",	 true,		   true,				false,		ChannelColor(207, 56, 223) )
    	ChatSettings.Channels[ SystemData.ChatLogFilters.CUSTOM ]		= ChatChannel( L"Chat (Global)",  SystemData.ChatLogFilters.CUSTOM,			 "Chat",	 true,		   true,				false,		ChannelColor(75, 120, 230),	 SystemData.ChatLogFilters.CUSTOM,	   L"/chat" )
    	ChatSettings.Channels[ SystemData.ChatLogFilters.GESTURE ]	   = ChatChannel( L"Gesture",		SystemData.ChatLogFilters.GESTURE,			"Chat",	 true,		   true,				false,		ChannelColor(215, 215, 1) )
    	ChatSettings.Channels[ SystemData.ChatLogFilters.GM ]			= ChatChannel( L"GM",			   SystemData.ChatLogFilters.GM,				 "Chat",	 true,		   true,				true,			ChannelColor(232, 48, 88),	  SystemData.ChatLogFilters.GM,		   L"/gm" )
    (scroll to the right to see the channel commands)
     
    #5 petemage, Jan 19, 2017
    Last edited: Jan 19, 2017
  6. Llewen

    Llewen Grand Inquisitor
    Stratics Veteran Stratics Legend Campaign Supporter

    Joined:
    Mar 3, 2006
    Messages:
    4,789
    Likes Received:
    250
    Pinco found a work around, but I think it's a little complicated and might not work in a command line script. I'm going to take a look at his code again and see if I can figure out how to incorporate it into that line.
     
  7. Llewen

    Llewen Grand Inquisitor
    Stratics Veteran Stratics Legend Campaign Supporter

    Joined:
    Mar 3, 2006
    Messages:
    4,789
    Likes Received:
    250
    In Pinco's UI if you want to use a whisper, emote or yell in a command line script the syntax is as follows:

    Send chat to active chat window:
    Code:
    SendChat(nil, L"Hello World!")
    Say:
    Code:
    SendChat(nil, L"/say Hello World!")
    Emote:
    Code:
    SendChat(nil, L":Hello World!")
    Whisper:
    Code:
    SendChat(nil, L";Hello World!")
    Yell:
    Code:
    SendChat(nil, L"!Hello World!")
    This may also work in the default UI but I'm not going to reload the default UI to test it. Perhaps someone else can.
     
    #7 Llewen, Jan 19, 2017
    Last edited: Jan 26, 2017
  8. Llewen

    Llewen Grand Inquisitor
    Stratics Veteran Stratics Legend Campaign Supporter

    Joined:
    Mar 3, 2006
    Messages:
    4,789
    Likes Received:
    250
    I will edit my post, but there is one correction if you use the following:
    Code:
    SendChat(nil, L"Hello World!")
    It will send the message to whatever chat window you have open. If you want to "say" in game, you have to use the following:
    Code:
    SendChat(nil, L"/say Hello World!")