Difference between revisions of "User talk:Daemonika Nightfire"

From Second Life Wiki
Jump to navigation Jump to search
m
m (replaced the old <lsl></lsl> with <source lang="lsl2"></source>)
 
(9 intermediate revisions by 5 users not shown)
Line 28: Line 28:


::::Ok, folks. I didn't know the user pages are off limits, I'm sorry. No offence intended, neither express nor implied. However I do disagree with the readability of scripts. Variable names should make clear what the values stored are used for and if there is a constant '''for the same value that makes sense''', it should be used. Anyhow, I won't edit the userpages again. -- [[User:Kireji Haiku|Kireji Haiku]] 10:04, 2 November 2012 (PDT)
::::Ok, folks. I didn't know the user pages are off limits, I'm sorry. No offence intended, neither express nor implied. However I do disagree with the readability of scripts. Variable names should make clear what the values stored are used for and if there is a constant '''for the same value that makes sense''', it should be used. Anyhow, I won't edit the userpages again. -- [[User:Kireji Haiku|Kireji Haiku]] 10:04, 2 November 2012 (PDT)
:::::Kireji may promise not to do it again, but they did not roll back their changes to my pages, nor let me know they were going to, so I did my own rollbacks. What a pain in the (censored). [[User:Toady Nakamura|Toady Nakamura]] 10:18, 4 November 2012 (PST)
:: There's another excellent reason for rolling back the script Kireji created which hasn't been mentioned:- Kireji's script won't even compile !!!  There are TWO errors ...
:: 1) undefined variable "Script" in the user function
:: and 2) 5 lines further down he tries to change state from within the user function, which is not valid. Big LOL [[User:Omei Qunhua|Omei Qunhua]] 09:35, 20 December 2012 (PST)
== Your script snippets can be shortened to: ==
{| class="sortable" width="100%" {{Prettytable}}
|- {{Hl2}}
! '''your script snippets'''
! '''can be shortened to:'''
|-
||<source lang="lsl2">
    touch_start(integer total_number)
    {
        if(llDetectedKey(0) == owner)
        {
            llSay(0, "Du bist der Besitzer.");
        }
        else if(llDetectedKey(0) != owner)
        {
            llSay(0,"Du bist nicht der Besitzer.");
        }
    }
</source>
||<source lang="lsl2">
    touch_start(integer num_detected)
    {
        key touchingAvatar = llDetectedKey(0);
        string message = "You're not the owner.";
        if (touchingAvatar == owner)
            message = "You're the owner.";
        llSay(PUBLIC_CHANNEL, message);
    }
</source>
|-
||<source lang="lsl2">
    touch_start(integer total_number)
    {
        if(llSameGroup(llDetectedKey(0)) == TRUE)
        {
            llSay(0, "You're wearing the right group tag.");
        }
        else if(llSameGroup(llDetectedKey(0)) == FALSE)
        {
            llSay(0,"You're not wearing the right group tag.");
        }
    }
</source>
||<source lang="lsl2">
    touch_start(integer num_detected)
    {
        string message = "You're not wearing the same group tag as this prim.";
        if (llSameGroup(llDetectedKey(0)))
            message = "You're wearing the same group tag as this prim.";
        llSay(PUBLIC_CHANNEL, message);
    }
</source>
|-
||<source lang="lsl2">
if (~llListFindList(VIP, llCSV2List(llDetectedKey(0)))) ...;
</source>
||<source lang="lsl2">
if (~llListFindList(VIP, [llDetectedKey(0)])) ...;
</source>
|}
-- [[User:Kireji Haiku|Kireji Haiku]] 13:49, 11 November 2012 (PST)
:Proper handling of touch_* should include a loop through all of num_detected. More often than not, num_detected will not be more than 1, but if it can be greater than 1 (it can), the script should be prepared to deal with it. Simple:
<source lang="lsl2">
touch_start(integer nd) {
while (nd) {
foo(--nd);
}
}
</source>
:To save memory consider something like the following. Not always appropriate, but handy:
<source lang="lsl2">
touch_start(integer nd) {
list not = ["not ", ""];
while (nd) {
llSay(0, "You're " + llList2String(not, llSameGroup(llDetectedKey(--nd))) + "wearing the same group tag as this prim.");
}
}
</source>
[[User:Fred_Gandt|'''<span style="font-family:arial;color:#055;font-size:16px;">f<i style="color:#0dd;font-size:10px;">red</i>g<i style="color:#0dd;font-size:10px;">andt</i></span>''']] 17:29, 11 November 2012 (PST)
Thank you both for the suggestions. One thing, the 'else if' in the touch are only for reverse proof for beginners, but i like your ways too. I think i find a good way to add them so that we all can live with it. :) But be sure, never without the clamps '{' '}' (i hate that). Furthermore i already think about an english page when i finish this. -- [[User:Daemonika Nightfire]] 05:18, 12 November 2012 (GMT)
:@ Kireji, i have think about your alternativ methods and find them interesting vor messages, but useless when i need to differentiate users with different funktions. -- [[User:Daemonika Nightfire]] 06:16, 12 November 2012 (GMT)
::Sorry Daemonika; I just have to get this out of my head and onto the screen. Feel free to ignore me :-)
<source lang="lsl2">
list g_c_ts_msg = ["not ", "", "You're ", "wearing the same group tag as this prim."]; // Nothing here ever changes so make it a global "constant".
default {
touch_start(integer nd) {
while (nd) {
// Avoid creating variables within loops
llSay(0, llList2String(g_c_ts_msg, 2) + llList2String(g_c_ts_msg, llSameGroup(llDetectedKey(--nd))) + llList2String(g_c_ts_msg, 3));
}
}
}
</source>
::g_c_ts_msg == global constant touch-start message.
::Something useful [[User:Void Singer|Void Singer]] does, is labelling variables with an indication of what scope they're created in.&nbsp;[[User:Fred_Gandt|'''<span style="font-family:arial;color:#055;font-size:16px;">f<i style="color:#0dd;font-size:10px;">red</i>g<i style="color:#0dd;font-size:10px;">andt</i></span>''']] 11:20, 12 November 2012 (PST)

Latest revision as of 14:57, 3 January 2020

Wikipage rollback

Hi, I'm not sure why you rolled back User:Daemonika_Nightfire/Scripts/Anti_copy_trans. I didn't change any functionality but mainly changed state and variable names to something more descriptive and added a comment here and there. -- Kireji Haiku 13:56, 1 November 2012 (PDT)

Hello, first sorry for my bad english. I rolled back, because that what you do with my script is not what i want and not my style. Your version was not that what is writen on top of the Script "by Daemonika Nightfire". If you want other version make a own page. Additionally i never want the on_rez event at first in a script. -- User:Daemonika Nightfire
Ok, that's fine. The reason I put on_rez in front of state_entry is because of Event_Order. -- Kireji Haiku 14:20, 1 November 2012 (PDT)
You know thats LSL an event based script language is? Because that it's not necessary where is an event placed in a script and the Event order Page is not god and not written by Linden Lab. I always sort the events by priority. That means when an event is not often be trigegred or just contains low priority funktions i move it down. In my scripts are ever the state_entry the first and on_rez the last. -- User:Daemonika Nightfire
I too had my scripts altered by Kireji, and am not even slightly happy about it.
Not good wiki etiquette!! Not at all.
fredgandt 00:15, 2 November 2012 (PDT)
Sometimes i get requests about my scripts for help, but i cant support when i have to learn my own script first.
And variables like this "foundOwnerKeyInListOfCreatorOrResellerKeys" are not more readable, no that's <censored> and needs more memory.
I am not happy about this. -- User:Daemonika Nightfire 14:50, 2 November 2012 (GMT)
I totally agree. That's one hellish var name! I purposefully add comments to many of my scripts to help others understand them, and Kireji decided to eliminate quite a lot. And like you say; I don't want to have to learn how my scripts work if I am asked about them.
At least one script he changed deals with PERMISSION_DEBIT and I am responsible for it functioning correctly (as I wrote it). I can't allow it to be published on my page without my being sure of it's functionality. Even if a script I wrote is crap, it's my crap!!
Regardless of the reasons we may not like what Kireji did, he simply shouldn't do it. Wiki user pages are off limits without express permission. On Wikipedia (the daddy wiki), not even admin will change user pages without discussion first (unless there's a breach in ToS).
 fredgandt 08:39, 2 November 2012 (PDT)
Ok, folks. I didn't know the user pages are off limits, I'm sorry. No offence intended, neither express nor implied. However I do disagree with the readability of scripts. Variable names should make clear what the values stored are used for and if there is a constant for the same value that makes sense, it should be used. Anyhow, I won't edit the userpages again. -- Kireji Haiku 10:04, 2 November 2012 (PDT)
Kireji may promise not to do it again, but they did not roll back their changes to my pages, nor let me know they were going to, so I did my own rollbacks. What a pain in the (censored). Toady Nakamura 10:18, 4 November 2012 (PST)
There's another excellent reason for rolling back the script Kireji created which hasn't been mentioned:- Kireji's script won't even compile !!! There are TWO errors ...
1) undefined variable "Script" in the user function
and 2) 5 lines further down he tries to change state from within the user function, which is not valid. Big LOL Omei Qunhua 09:35, 20 December 2012 (PST)

Your script snippets can be shortened to:

your script snippets can be shortened to:
    touch_start(integer total_number)
    {
        if(llDetectedKey(0) == owner)
        {
            llSay(0, "Du bist der Besitzer.");
        }
        else if(llDetectedKey(0) != owner)
        {
            llSay(0,"Du bist nicht der Besitzer.");
        }
    }
    touch_start(integer num_detected)
    {
        key touchingAvatar = llDetectedKey(0);

        string message = "You're not the owner.";

        if (touchingAvatar == owner)
            message = "You're the owner.";

        llSay(PUBLIC_CHANNEL, message);
    }
    touch_start(integer total_number)
    {
        if(llSameGroup(llDetectedKey(0)) == TRUE)
        {
            llSay(0, "You're wearing the right group tag.");
        }
        else if(llSameGroup(llDetectedKey(0)) == FALSE)
        {
            llSay(0,"You're not wearing the right group tag.");
        }
    }
    touch_start(integer num_detected)
    {
        string message = "You're not wearing the same group tag as this prim.";

        if (llSameGroup(llDetectedKey(0)))
            message = "You're wearing the same group tag as this prim.";

        llSay(PUBLIC_CHANNEL, message);
    }
if (~llListFindList(VIP, llCSV2List(llDetectedKey(0)))) ...;
if (~llListFindList(VIP, [llDetectedKey(0)])) ...;

-- Kireji Haiku 13:49, 11 November 2012 (PST)

Proper handling of touch_* should include a loop through all of num_detected. More often than not, num_detected will not be more than 1, but if it can be greater than 1 (it can), the script should be prepared to deal with it. Simple:
touch_start(integer nd) {
	while (nd) {
		foo(--nd);
	}
}
To save memory consider something like the following. Not always appropriate, but handy:
touch_start(integer nd) {
	list not = ["not ", ""];
	while (nd) {
		llSay(0, "You're " + llList2String(not, llSameGroup(llDetectedKey(--nd))) + "wearing the same group tag as this prim.");
	}
}

fredgandt 17:29, 11 November 2012 (PST)

Thank you both for the suggestions. One thing, the 'else if' in the touch are only for reverse proof for beginners, but i like your ways too. I think i find a good way to add them so that we all can live with it. :) But be sure, never without the clamps '{' '}' (i hate that). Furthermore i already think about an english page when i finish this. -- User:Daemonika Nightfire 05:18, 12 November 2012 (GMT)

@ Kireji, i have think about your alternativ methods and find them interesting vor messages, but useless when i need to differentiate users with different funktions. -- User:Daemonika Nightfire 06:16, 12 November 2012 (GMT)
Sorry Daemonika; I just have to get this out of my head and onto the screen. Feel free to ignore me :-)
list g_c_ts_msg = ["not ", "", "You're ", "wearing the same group tag as this prim."]; // Nothing here ever changes so make it a global "constant".
default {
	touch_start(integer nd) {
		while (nd) {
			// Avoid creating variables within loops
			llSay(0, llList2String(g_c_ts_msg, 2) + llList2String(g_c_ts_msg, llSameGroup(llDetectedKey(--nd))) + llList2String(g_c_ts_msg, 3));
		}
	}
}
g_c_ts_msg == global constant touch-start message.
Something useful Void Singer does, is labelling variables with an indication of what scope they're created in. fredgandt 11:20, 12 November 2012 (PST)