Change console prompt

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Change console prompt

Gudule Lapointe
Is there a way to modify the prompt on the server?
I run several servers, and on each of them, it shows
        Region (root) #
except for Robust, which shows R.O.B.U.S.T #

Is there a way to replace "Region" by a custom value, or a variable, that would permit me to see immediately on which server I am connected?


_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

justincc
On 20/10/11 16:51, Gudule Lapointe wrote:
> Is there a way to modify the prompt on the server?
> I run several servers, and on each of them, it shows
> Region (root) #
> except for Robust, which shows R.O.B.U.S.T #
>
> Is there a way to replace "Region" by a custom value, or a variable, that would permit me to see immediately on which server I am connected?

This is not currently possible.

--
Justin Clark-Casey (justincc)
http://justincc.org/blog
http://twitter.com/justincc
_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

paul emery
In reply to this post by Gudule Lapointe
"Show info" in the console?
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

Gudule Lapointe
Of course, if I type "show info" or "show regions", I know where I am. I would just want to see it immediately, to choose the right console quicker.

Le 27 oct. 2011 à 22:13, paul emery a écrit :

> "Show info" in the console?
>
> --
> View this message in context: http://opensim-users.2152040.n2.nabble.com/Change-console-prompt-tp6913449p6937896.html
> Sent from the opensim-users mailing list archive at Nabble.com.
> _______________________________________________
> Opensim-users mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/opensim-users

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

Gudule Lapointe
For example, I would be tempted to modify the line 833 in Region/Application/OpenSim.cs:

        m_console.DefaultPrompt = String.Format("Region ({0}) ", regionName);
by
        m_console.DefaultPrompt = String.Format("{0} ({1}) ", m_startupDirectory, regionName);

But
        1° startup directory  is relevant, but can be quite long
        2° I don't know the code structure at all, i don't know if m_startupDirectory is defined at this stage
        3° this would be a "for me only" hack, it would be better to define a new variable in .ini, like SimulatorName, which would default to the current "Region", but I don't know the process to do that


Le 27 oct. 2011 à 22:18, Gudule Lapointe a écrit :

> Of course, if I type "show info" or "show regions", I know where I am. I would just want to see it immediately, to choose the right console quicker.
>
> Le 27 oct. 2011 à 22:13, paul emery a écrit :
>
>> "Show info" in the console?
>>
>> --
>> View this message in context: http://opensim-users.2152040.n2.nabble.com/Change-console-prompt-tp6913449p6937896.html
>> Sent from the opensim-users mailing list archive at Nabble.com.
>> _______________________________________________
>> Opensim-users mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/opensim-users
>
> _______________________________________________
> Opensim-users mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/opensim-users
>

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

GarminKawaguichi
In reply to this post by Gudule Lapointe
>----- Original Message -----
>From: "Gudule Lapointe" <[hidden email]>
>Sent: Thursday, October 27, 2011 10:18 PM
>Subject: Re: [Opensim-users] Change console prompt
>Of course, if I type "show info" or "show regions", I know where I am. I
>would just want to see it immediately, to choose the right console quicker.

The best solution would be to use a "change region your_preferred-region" in
startup_commands.txt.
Unfortunately, OpenSim executes a "change region root" after the end of
startup_commands.txt.
(I also tried to insert a "command-script" inside the startup_commands.txt
but no difference.)

If it is possible to have a command file executed at the very end of OpenSim
init, that will be useful for all, but it's beyond me :))

GCI

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

GarminKawaguichi
OK May be it's not!
I tried that:
File OpenSim.cs around line 200

I commented 2 lines

            if (m_sceneManager.Scenes.Count == 1) // If there is only one
region, select it
                ChangeSelectedRegion("region",
                                     new string[] {"change", "region",
m_sceneManager.Scenes[0].RegionInfo.RegionName});
            //else
                //ChangeSelectedRegion("region", new string[] {"change",
"region", "root"});

and with a startup_commands.txt containing
change region your_favorite_region

I have obtained on the console:
Region (your_favorite_region) #
==========================
Remark : I'm not able to test the whole OpenSim consequence. When there is
not a change region in the startup_commands.txt, the console displays:
Region#

I suppose that the best solution is to move
            //Run Startup Commands
            if (String.IsNullOrEmpty(m_startupCommandsFile))
            {
                m_log.Info("[STARTUP]: No startup command script specified.
Moving on...");
            }
            else
            {
                RunCommandScript(m_startupCommandsFile);
            }
after
            // For now, start at the 'root' level by default
            if (m_sceneManager.Scenes.Count == 1) // If there is only one
region, select it
                ChangeSelectedRegion("region",
                                     new string[] {"change", "region",
m_sceneManager.Scenes[0].RegionInfo.RegionName});
            else
                ChangeSelectedRegion("region", new string[] {"change",
"region", "root"});


GCI

>----- Original Message -----
>From: "Garmin Kawaguichi" <[hidden email]>
>Sent: Friday, October 28, 2011 12:19 PM
>Subject: Re: [Opensim-users] Change console prompt


> >----- Original Message -----
>>From: "Gudule Lapointe" <[hidden email]>
>>Sent: Thursday, October 27, 2011 10:18 PM
>>Subject: Re: [Opensim-users] Change console prompt
>>Of course, if I type "show info" or "show regions", I know where I am. I
>>would just want to see it immediately, to choose the right console
>>quicker.
>
...   ...
> If it is possible to have a command file executed at the very end of
> OpenSim
> init, that will be useful for all, but it's beyond me :))
>
> GCI

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

Gudule Lapointe
Thats interesting, but it serves another purpose (change automatically region at startup).

To (really) customize the default prompt, could somebody help me in the process to add a new variable in .ini file or in the .exe command-line parameters?
I don't know where (and how) they need to be defined in code / retrieved from ini.

Once they are, I can adjust the default prompt in line 833 as told previously with that variable, the same way as I do now with binary path value.

In my previous posts, I said "simulator name" as example, but thinking about it, the "prompt name" or "custom prompt" would probably be more relevant.


Le 28 oct. 2011 à 13:34, Garmin Kawaguichi a écrit :

> OK May be it's not!
> I tried that:
> File OpenSim.cs around line 200
>
> I commented 2 lines
>
>           if (m_sceneManager.Scenes.Count == 1) // If there is only one
> region, select it
>               ChangeSelectedRegion("region",
>                                    new string[] {"change", "region",
> m_sceneManager.Scenes[0].RegionInfo.RegionName});
>           //else
>               //ChangeSelectedRegion("region", new string[] {"change",
> "region", "root"});
>
> and with a startup_commands.txt containing
> change region your_favorite_region
>
> I have obtained on the console:
> Region (your_favorite_region) #
> ==========================
> Remark : I'm not able to test the whole OpenSim consequence. When there is
> not a change region in the startup_commands.txt, the console displays:
> Region#
>
> I suppose that the best solution is to move
>           //Run Startup Commands
>           if (String.IsNullOrEmpty(m_startupCommandsFile))
>           {
>               m_log.Info("[STARTUP]: No startup command script specified.
> Moving on...");
>           }
>           else
>           {
>               RunCommandScript(m_startupCommandsFile);
>           }
> after
>           // For now, start at the 'root' level by default
>           if (m_sceneManager.Scenes.Count == 1) // If there is only one
> region, select it
>               ChangeSelectedRegion("region",
>                                    new string[] {"change", "region",
> m_sceneManager.Scenes[0].RegionInfo.RegionName});
>           else
>               ChangeSelectedRegion("region", new string[] {"change",
> "region", "root"});
>
>
> GCI
>
>> ----- Original Message ----- From: "Garmin Kawaguichi" <[hidden email]>
>> Sent: Friday, October 28, 2011 12:19 PM
>> Subject: Re: [Opensim-users] Change console prompt
>
>
>> >----- Original Message -----
>>> From: "Gudule Lapointe" <[hidden email]>
>>> Sent: Thursday, October 27, 2011 10:18 PM
>>> Subject: Re: [Opensim-users] Change console prompt
>>> Of course, if I type "show info" or "show regions", I know where I am. I
>>> would just want to see it immediately, to choose the right console
>>> quicker.
>>
> ...   ...
>> If it is possible to have a command file executed at the very end of
>> OpenSim
>> init, that will be useful for all, but it's beyond me :))
>>
>> GCI
>
> _______________________________________________
> Opensim-users mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/opensim-users

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

GarminKawaguichi

>----- Original Message -----
>From: "Gudule Lapointe" <[hidden email]>
>Sent: Friday, October 28, 2011 2:31 PM
>Subject: Re: [Opensim-users] Change console prompt
>to add a new variable in .ini file or in the .exe command-line parameters?
>I don't know where (and how) they need to be defined in code / retrieved
>from ini.
>Once they are, I can adjust the default prompt in line 833 as told
>previously with that variable, the same way as I do now with binary path
>value.
>In my previous posts, I said "simulator name" as example, but thinking
>about it, the "prompt name" or "custom prompt" would probably be more
>relevant.

Try that :
1) in OpenSim.ini under [Startup] add a line like
custom_prompt = "I'm the One"

2) in OpenSim.cs before line 833
string m_custom_prompt =
configSource.Configs["Startup"].GetString("custom_prompt", String.Empty);

3) use the string m_custom_prompt at your convenience

With NO WARRANTY :)))

GCI

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

Gudule Lapointe
In
        string m_custom_prompt = configSource.Configs["Startup"].GetString("custom_prompt", String.Empty);
does "String.Empty" defines the value to use if custom_prompt is not set?

In this case, I guess we should use "Region" (the current value) instead?


Le 28 oct. 2011 à 15:09, Garmin Kawaguichi a écrit :

>
>> ----- Original Message ----- From: "Gudule Lapointe" <[hidden email]>
>> Sent: Friday, October 28, 2011 2:31 PM
>> Subject: Re: [Opensim-users] Change console prompt
>> to add a new variable in .ini file or in the .exe command-line parameters?
>> I don't know where (and how) they need to be defined in code / retrieved
>> from ini.
>> Once they are, I can adjust the default prompt in line 833 as told
>> previously with that variable, the same way as I do now with binary path
>> value.
>> In my previous posts, I said "simulator name" as example, but thinking
>> about it, the "prompt name" or "custom prompt" would probably be more
>> relevant.
>
> Try that :
> 1) in OpenSim.ini under [Startup] add a line like
> custom_prompt = "I'm the One"
>
> 2) in OpenSim.cs before line 833
> string m_custom_prompt = configSource.Configs["Startup"].GetString("custom_prompt", String.Empty);
>
> 3) use the string m_custom_prompt at your convenience
>
> With NO WARRANTY :)))
>
> GCI
> _______________________________________________
> Opensim-users mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/opensim-users

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

GarminKawaguichi
>----- Original Message -----
>From: "Gudule Lapointe" <[hidden email]>
>Sent: Friday, October 28, 2011 4:32 PM
>Subject: Re: [Opensim-users] Change console prompt
>In
>string m_custom_prompt =
>configSource.Configs["Startup"].GetString("custom_prompt", String.Empty);
>does "String.Empty" defines the value to use if custom_prompt is not set?
>In this case, I guess we should use "Region" (the current value) instead?

Yes, it seems to be the "default value"

There is an example of string used as default in OpenSim.cs line 569
and an example without default value in LoadImageURLModule.cs lines 109-110

GCI
_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

Gudule Lapointe
OK, it didn't work the way you said (things "not defined in this context") and after tweaking a bit, it kinda worked, but didn't fetch the values with configSource.Configs

But I think I get it now. Here is what I have done:
        added  
                protected string m_custom_prompt;
        in public class OpenSim
        and
                m_custom_prompt = startupConfig.GetString("custom_prompt", "Region");
        after startupConfig (under "if(startupConfig != NULL)
        and then
                m_console.DefaultPrompt = String.Format("{0} ({1}) ", m_custom_prompt, regionName);
        at the original place

Now, I can set up the custom_prompt value in OpenSim.ini or GridCommon.ini, and if it is not set, it defaults to the current "Region" prompt.

In short, I patched OpenSim/Region/Application/OpenSim.cs this way:
58a59
> protected string m_custom_prompt;
110a112
> m_custom_prompt = startupConfig.GetString("custom_prompt", "Region");
831d832
<
834c835
<             m_console.DefaultPrompt = String.Format("Region ({0}) ", regionName);
---
>    m_console.DefaultPrompt = String.Format("{0} ({1}) ", m_custom_prompt, regionName);




Le 28 oct. 2011 à 16:49, Garmin Kawaguichi a écrit :

>> ----- Original Message ----- From: "Gudule Lapointe" <[hidden email]>
>> Sent: Friday, October 28, 2011 4:32 PM
>> Subject: Re: [Opensim-users] Change console prompt
>> In
>> string m_custom_prompt = configSource.Configs["Startup"].GetString("custom_prompt", String.Empty);
>> does "String.Empty" defines the value to use if custom_prompt is not set?
>> In this case, I guess we should use "Region" (the current value) instead?
>
> Yes, it seems to be the "default value"
>
> There is an example of string used as default in OpenSim.cs line 569
> and an example without default value in LoadImageURLModule.cs lines 109-110
>
> GCI
> _______________________________________________
> Opensim-users mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/opensim-users

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

Gudule Lapointe

I submitted a patch 2 weeks ago for this mod, but I didn't get any reaction. Am I the only one running several simulators? ;-)
       
        http://opensimulator.org/mantis/view.php?id=5760



Le 28 oct. 2011 à 18:11, Gudule Lapointe a écrit :

> OK, it didn't work the way you said (things "not defined in this context") and after tweaking a bit, it kinda worked, but didn't fetch the values with configSource.Configs
>
> But I think I get it now. Here is what I have done:
> added  
> protected string m_custom_prompt;
> in public class OpenSim
> and
> m_custom_prompt = startupConfig.GetString("custom_prompt", "Region");
> after startupConfig (under "if(startupConfig != NULL)
> and then
> m_console.DefaultPrompt = String.Format("{0} ({1}) ", m_custom_prompt, regionName);
> at the original place
>
> Now, I can set up the custom_prompt value in OpenSim.ini or GridCommon.ini, and if it is not set, it defaults to the current "Region" prompt.
>
> In short, I patched OpenSim/Region/Application/OpenSim.cs this way:
> 58a59
>> protected string m_custom_prompt;
> 110a112
>> m_custom_prompt = startupConfig.GetString("custom_prompt", "Region");
> 831d832
> <
> 834c835
> <             m_console.DefaultPrompt = String.Format("Region ({0}) ", regionName);
> ---
>>    m_console.DefaultPrompt = String.Format("{0} ({1}) ", m_custom_prompt, regionName);
>
>
>
>
> Le 28 oct. 2011 à 16:49, Garmin Kawaguichi a écrit :
>
>>> ----- Original Message ----- From: "Gudule Lapointe" <[hidden email]>
>>> Sent: Friday, October 28, 2011 4:32 PM
>>> Subject: Re: [Opensim-users] Change console prompt
>>> In
>>> string m_custom_prompt = configSource.Configs["Startup"].GetString("custom_prompt", String.Empty);
>>> does "String.Empty" defines the value to use if custom_prompt is not set?
>>> In this case, I guess we should use "Region" (the current value) instead?
>>
>> Yes, it seems to be the "default value"
>>
>> There is an example of string used as default in OpenSim.cs line 569
>> and an example without default value in LoadImageURLModule.cs lines 109-110
>>
>> GCI
>> _______________________________________________
>> Opensim-users mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/opensim-users
>
> _______________________________________________
> Opensim-users mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/opensim-users
>

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Change console prompt

justincc
Hi Gudule.  I intended to look at this patch last Friday but got swamped by other things.  I hope to take a look
tomorrow (Friday).

Justin

On 10/11/11 01:38, Gudule Lapointe wrote:

>
> I submitted a patch 2 weeks ago for this mod, but I didn't get any reaction. Am I the only one running several simulators? ;-)
>
> http://opensimulator.org/mantis/view.php?id=5760
>
>
>
> Le 28 oct. 2011 à 18:11, Gudule Lapointe a écrit :
>
>> OK, it didn't work the way you said (things "not defined in this context") and after tweaking a bit, it kinda worked, but didn't fetch the values with configSource.Configs
>>
>> But I think I get it now. Here is what I have done:
>> added
>> protected string m_custom_prompt;
>> in public class OpenSim
>> and
>> m_custom_prompt = startupConfig.GetString("custom_prompt", "Region");
>> after startupConfig (under "if(startupConfig != NULL)
>> and then
>> m_console.DefaultPrompt = String.Format("{0} ({1}) ", m_custom_prompt, regionName);
>> at the original place
>>
>> Now, I can set up the custom_prompt value in OpenSim.ini or GridCommon.ini, and if it is not set, it defaults to the current "Region" prompt.
>>
>> In short, I patched OpenSim/Region/Application/OpenSim.cs this way:
>> 58a59
>>> protected string m_custom_prompt;
>> 110a112
>>> m_custom_prompt = startupConfig.GetString("custom_prompt", "Region");
>> 831d832
>> <
>> 834c835
>> <              m_console.DefaultPrompt = String.Format("Region ({0}) ", regionName);
>> ---
>>> m_console.DefaultPrompt = String.Format("{0} ({1}) ", m_custom_prompt, regionName);
>>
>>
>>
>>
>> Le 28 oct. 2011 à 16:49, Garmin Kawaguichi a écrit :
>>
>>>> ----- Original Message ----- From: "Gudule Lapointe"<[hidden email]>
>>>> Sent: Friday, October 28, 2011 4:32 PM
>>>> Subject: Re: [Opensim-users] Change console prompt
>>>> In
>>>> string m_custom_prompt = configSource.Configs["Startup"].GetString("custom_prompt", String.Empty);
>>>> does "String.Empty" defines the value to use if custom_prompt is not set?
>>>> In this case, I guess we should use "Region" (the current value) instead?
>>>
>>> Yes, it seems to be the "default value"
>>>
>>> There is an example of string used as default in OpenSim.cs line 569
>>> and an example without default value in LoadImageURLModule.cs lines 109-110
>>>
>>> GCI
>>> _______________________________________________
>>> Opensim-users mailing list
>>> [hidden email]
>>> https://lists.berlios.de/mailman/listinfo/opensim-users
>>
>> _______________________________________________
>> Opensim-users mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/opensim-users
>>
>
> _______________________________________________
> Opensim-users mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/opensim-users
>


--
Justin Clark-Casey (justincc)
http://justincc.org/blog
http://twitter.com/justincc
_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users