Jump to content
Sign in to follow this  
Kennethh Yamdev

another quest of questions :) Page turner.... litterally

Recommended Posts

I am making a hud. It requires you to click on a page number. Once page number "turned" there are 5 clickables(touch_start) on that page that will function on that page.

I am having a problem with all the pages working. I can get page 1 and 2 to "turn" there fine but once i click page 3 it dont do anything. Is there a wait time for each llSetScriptState? (There are 5 pages tottal)

The example below is for "page 1"

Perhaps there is a easier way to go about this. Suggestions or tips would be great.

 

 

default
{
state_entry()
{
llListen(0,"","","");
}
listen ( integer ch, string nm, key id, string msg)
{
if(msg == "KioPage1")
{
llSay(0,"Page 1 Open :: STOP ALL OTHER magics");
llSetScriptState("Page2",FALSE);
llSetScriptState("Page3",FALSE);
llSetScriptState("Page4",FALSE);
llSetScriptState("Page5",FALSE);
}
if(msg == "KioPage2")
{
llSetScriptState("Page2",TRUE);
}
if(msg == "KioPag3")
{
llSetScriptState("Page3",TRUE);
}
if(msg == "KioPage4")
{
llSetScriptState("Page4",TRUE);
}
if(msg == "KioPage5")
{
llSetScriptState("Page5",TRUE);
}
}

touch_start(integer total_number)
{
llSay(0,"Page1 Magic1");
}
}

Share this post


Link to post
Share on other sites

Without knowing what the Page1, Page2, and so on, scripts do, it's a bit difficult to comment.

However, on general principles, I'm certainly it's going to be considerably easier to combine everything in one script.

Also, I don't understand what's going on.   You say your HUD requires you to click on a page number, but you've got a listener that responds only to messages in the format "KioPage..." and a touch event that says"Page1 Magic1," which the listen event wouldn't understand even if it could hear it (scripts can't hear message sent by themselves or any other script in the same prim).   So whatever's turning pages 1 and 2, I don't think it's anything that the script you reproduce is doing.

Also, it's really bad practice, for all sorts of reasons, to have scripts listening on channel 0, the public chat channel, unless there's a very good reason.   And there's not one here.

If you can be more specific (and show us what one of the other scripts looks like), I might be able to help, but I can't make anything of this.

 

 

Share this post


Link to post
Share on other sites

ttes.png 

Here is a picture of my hud i am doing. Please know it is a very late rough draft.

So on the right side is the page numbers. Each one you click on and it would "turn the page" and the white bars going across the "page" would be clickable as well. (They would do something.)

As for all my commands being on channel zero. That was me just doing it quick so I didnt have to assign them to a channel and figuer out if it was working or not. I plan to change it to a negitive channel later :)

And Profaitchikenz Haiku, that actuall seemed to fix my problem quite a lot..... lol Each of my page scripts had a missing E in the word. WOOPS! 

 

-----

The numbers on the side have each one script that simply when clicked llSay to a channel to "ChangeKioPage". So then each white bar has 5 scripts in them each labled Page1, Page2 etc. - In each of those all the scripts are about the same.... 

default
{
state_entry()
{
llListen(0,"","","");
}
listen ( integer ch, string nm, key id, string msg)
{
if(msg == "KioPage5")
{
llSay(0,"Page 5 Open :: STOP ALL OTHER magics");
llSetScriptState("Page1",FALSE);
llSetScriptState("Page2",FALSE);
llSetScriptState("Page3",FALSE);
llSetScriptState("Page4",FALSE);
}
if(msg == "KioPage1")
{
llSetScriptState("Page1",TRUE);
}
if(msg == "KioPage2")
{
llSetScriptState("Page2",TRUE);
}
if(msg == "KioPage3")
{
llSetScriptState("Page3",TRUE);
}
if(msg == "KioPage4")
{
llSetScriptState("Page4",TRUE);
}
}

touch_start(integer total_number)
{
llSay(0,"page5 magic1");
}
}

The only difference in each one is -- if(msg =="PAGE") { llSetScriptState("PAGE", TRUE);} -- is for each different page. Im not sure if that makes sense. 
Im not a super good scripter as you can see. But I am greatful for any help that is given.

Share this post


Link to post
Share on other sites

That's a very awkward way to do things, turning multiple scripts on and off.  All you need is one script.  Activate different behaviors when you touch different areas on your HUD.

Share this post


Link to post
Share on other sites

No.  You'd only need linked messages if you had multiple scripts in several linked prims.  There's no need to use multiple prims OR multiple scripts.  Use one single prim, put your texture on it, and use llDetectedTouchUV to determine which part of the prim was touched.

default{    touch_start(integer num)    {        vector Where = llDetectedTouchUV(0);        if (Where.y > 0.8)        {            //Do Type I stuff        }        else if ((Where.y > 0.6) && (Where.y < 0.8))        {            // Do Type II stuff        }        else if ((Where.y > 0.4) && (Where.y < 0.6))        {            // Do Type III stuff        }        else if ((Where.y > 0.2) && (Where.y < 0.4))        {            // Do Type IV stuff        }        else        {            //Do Type V stuff        }    }}

 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...