Jump to content

Carbon Philter

Resident
  • Posts

    212
  • Joined

  • Last visited

Everything posted by Carbon Philter

  1. Thanks Ron - cracked it instantly. Why can't I see these things?? Much appreciated.
  2. Hi all. Need some more help,please. I'm setting up controls for a boat and can't seem to trigger actions associated with the forward/back control correctly. In the main script - modded from Cubey Terra's submarine script - I have the bit which activates the movement by incremental speed steps working ok and the boat moves as I want. I have a second script which takes a link message to provide data for an on-screen 'dashboard' reporting engine, speed, depth, etc, and to test I added in an OwnerSay to see if it was functioning correctly. Although the sender script is only sending the trigger once I would appear to be getting the recieving script triggering twice - once on key press and once on key release instead of just firing once for the key being pressed so I'm getting double rports although as I said, the motor moves the boat as intended. Is there something I'm missing in the controls event to stop the duplication or is it something set up wrong in the receiving script? Thanks for any advice/suggestions. The main script portion is as follows: if ((change & CONTROL_FWD) || (change & CONTROL_BACK)) { if (held & CONTROL_FWD) { if (throttle < THROTTLE_MAX) { throttle++; llOwnerSay ((string)throttle); } } else if (held & CONTROL_BACK) { if (throttle > THROTTLE_MIN) { throttle--; llOwnerSay ((string)throttle); } } llMessageLinked(LINK_SET,throttle*10,"throttle",""); // pass throttle setting to child prims } and the receiving script is this: // script for Dashboard float TIMER_INT = 0.25; integer throttle; integer number; string engine_telegraph; default { state_entry() { llSetText("",ZERO_VECTOR,1); llSoundPreload("telegraph"); } on_rez(integer num) { llResetScript(); } link_message(integer sender_number, integer number, string message, key id) { if (message == "throttle") { throttle = number; llOwnerSay ((string)throttle); llPlaySound("telegraph", 1); } if (throttle == 0) { engine_telegraph = "Stop"; llOwnerSay ("Stop sent"); llPlaySound("telegraph", 1); } if ( throttle == 10) { engine_telegraph = "Dead Slow Ahead"; llOwnerSay ("Dead Slow Ahead sent"); llPlaySound("telegraph", 1); } else if ( throttle == 20) { engine_telegraph = "Slow Ahead"; llOwnerSay ("Slow Ahead sent"); llPlaySound("telegraph", 1); } else if ( throttle == 30) { engine_telegraph = "Half Ahead"; llOwnerSay ("Half Ahead sent"); llPlaySound("telegraph", 1); } else if ( throttle == 40) { engine_telegraph = "Full Ahead"; llOwnerSay ("Full Ahead sent"); llPlaySound("telegraph", 1); } else if ( number == -10) { engine_telegraph = "Dead Slow Astern"; llOwnerSay ("Dead Slow Astern"); llPlaySound("telegraph", 1); } else if ( number == -20) { engine_telegraph = "Slow Astern"; llOwnerSay ("Slow Astern sent"); llPlaySound("telegraph", 1); } else if ( number == -30) { engine_telegraph = "Half Astern"; llOwnerSay ("Half Astern sent"); llPlaySound("telegraph", 1); } else if ( number == -40) { engine_telegraph = "Full Astern"; llOwnerSay ("Full Astern sent"); llPlaySound("telegraph", 1); } else if (message == "unseated") { llSleep(0.7); llSetTimerEvent(0); llSetText("",ZERO_VECTOR,0); throttle = 0; } else if (message == "seated") { llSetTimerEvent(TIMER_INT); } } timer() { vector pos = llGetPos(); float waterlevel = llWater(<0.0,0.0,0.0>); float seabed = llGround(<0.0,0.0,0.0>); float fdepth = (waterlevel - seabed)*100; integer i10depth = (integer)fdepth; float depthF = (float)i10depth/100; integer speed = (integer)llRound((llVecMag(llGetVel())) * 1.9438444); llSetText("Engine: "+ engine_telegraph +"\nSpeed = "+(string)speed+" knots \nSeabed at "+ (string)llGround(<0.0,0.0,0.0>) + "m \nWater level: " + (string)llWater(<0.0,0.0,0.0>) + "m \nDepth = "+(string)depthF+"m \nKeel clearance: " + (string)((llWater(<0.0,0.0,0.0>)-1.87399) - llGround(<0.0,0.0,0.0>))+ "m \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ",<1,1,1>,1); } } 
  3. By George, you've got it!! Many thanks Georg - that does the trick. Now I have to read it through repeatedly until I understand how it works and why I couldn't work it out. Logic - where's the sense in it? Carbon
  4. Thnaks for response, guys. I'll have to do some more thinking..... Qie, on first look I reckoned yours was the straighforward solution but unfortunately it doesn't perform as expected. What I was hoping is that once making the selection of either distance or number value, the main dialog would reappear to allow access to the other submenu. I added your suggested code and the script works as before - dialog closes after first value is selected - but with addition that clicking 'Back' gives me the report that Back was clicked and dialog still simply closes. Phil, I think ( ) I understand your concept but it looks a tad more complex on first pass so will have to go concentrate to try to absorb the principles as you describe your approach. Carbon
  5. Back for more help please, everyone. I'm messing with a dialog and lists and have been trying to minimise the shedload of if/else if statements needed to cover all the eventualities in the lists. I've got the script reacting as required in test mode by reporting what dialog button is clicked under either selected submenu but I cannot for the life of me work out how to recall the main dialog to make a second selection on the other submenu without having to reclick on the prim.. I reckon it has to be something to do with recalling the script back to the main dialog menu or resetting it somehow. I tried using llResetScript at the end but that somehow just cancels out the OwnerSay report of the clicked button and I then tried recalling the main dialog at the end but that too seems to just be ignored. Is it possible to recall the main dialog or do I have to revert to using all the if statements or, worse still, accept having to click the prim two times to get to each submenu selection? Thanks in anticipation. Script follows: list Main = ["Number", "Distance", "Close"]; //main menu buttons list Ldist = ["7", "8", "Back", "4", "5", "6", "1", "2", "3"]; list Lno = ["G", "H", "Back", "D", "E", "F", "A", "B", "C"]; string vnumber; string vdistance; integer menu; //variable to keep track of which menu is chosen default {state_entry() //when script starts { llListen(10,"", llGetOwner(), ""); } touch_start(integer x) //when touched { //make menu variable equal 0 menu = 0; //show main menu, called Main llDialog(llDetectedKey(0), "Click on button to change number or distance", Main, 10); } listen(integer channel, string name, key id, string message) { if (menu == 0) //if the object is touched { if (message == "Number") //number is chosen { menu = 1; //make menu variable equal 1 llDialog(id, "Choose the number", Lno, 10); } else if (message == "Distance") //distanceis chosen { menu = 2; //make menu variable equal 2 llDialog(id, "Choose the distance from rezzer", Ldist, 10); } else if (message == "Close") { } } else if (menu == 1) //if menu equals 1, number is chosen { vnumber = message; llOwnerSay(vnumber + " has been clicked"); } else if (menu == 2) //if menu equals 2, distance is chosen { vdistance = message; llOwnerSay(message + " has been clicked"); } // llResetScript(); } }
  6. Many thanks again, Qie. Your explanation greatly helps me in moving forward in the scripting minefield. Sometimes think I should stick to something simple, like brain surgery.
  7. Many thanks all. It's working - after a fashion.......... The dialog does change the number of birds but it waits until the end of the previous cycle before taking effect. Not sure where exactly to put the on-rez resetscript command to ensure the owner change after transfer - still haven't quite got my head round determining the correct order for separate functions or how to sequence them (if that makes sense). Anyhow, I'll continue with my learning by trial and a lot of error. Two more queries.......... Qie, can you please briefly explain the zero-value thing. If I declare a variable such as Birdno in State_entry, does that always enter as zero unless I assign a value as part of the declaration? If I want to turn the rezzer invisible once it's been placed where required, I am thinking of making it an off/on option as part of the dialog after selecting the number of birds. Does that sound sensible or would anyone have any alternative suggestions/recommendations? Thanks again, people.
  8. OK, update.......... Got synatx error as I just commented above so deleted that definition and just put the llGetOwner() directly into the llListen line. Script now compiles and I get no further error reports but the Birdno variable is constantly being reported as 0 rather than the value I select in the dialog. Is there something being missed or out of sequence?
  9. Thx Cerise. Tried that amendment and now get Syntax error on that line when I add the parentheses.
  10. Hi all. Still on the learning curve and need more assistance. I'm trying to create a bird rezzer to generate a specified number of temp birds. I've got it functioning with a set number using a timer but wanted to add a touch triggered dialog to provide the option of choosing a particular number of birds at any one time. I added in what I thought was correct and now keep getting a fail error reporting 'Bounds Check Error'. Can you good people explain where I've gone off the rails, please. Thanks in anticipation Carbon Script follows: integer randchan; integer DIACHANNEL; list Numberlist = ["1", "2", "3", "4", "5", "6"]; float Birdno; key owner = llGetOwner; birdrez() { llRezObject("Humbirdsculpt12Atemp", llGetPos() + <0, 0, 0>, ZERO_VECTOR, ZERO_ROTATION, randchan); } default { state_entry() { DIACHANNEL = (integer)llFrand(-50000.0); llListen(DIACHANNEL, "", owner, ""); randchan = (integer)llFrand(-50000.0); llSay(randchan, (string)llGetKey()); birdrez(); llSetTimerEvent(Birdno); llOwnerSay ("Birdno is " + (string)Birdno); } touch_start(integer total_number) { llDialog(llDetectedKey(0), "How many birds?", Numberlist, DIACHANNEL); } listen(integer channel, string name, key id, string message) { if (message == "1") Birdno == 60; else if (message == "2") Birdno == 30; else if (message == "3") Birdno == 20; else if (message == "4") Birdno == 15; else if (message == "5") Birdno == 12; else if (message == "6") Birdno == 10; } timer() { birdrez(); } } 
  11. In UK and working fine. Drops out after a while saying connection too slow but still on Phoenix with main av. Looks good if a bit limited in options. No matter - it's still in test phase.
×
×
  • Create New...