|
DancesWithRobots Soyer
Registered User
Join date: 7 Apr 2006
Posts: 701
|
07-29-2008 08:37
My problem with scripting is, syntax. Watching out for all the little mistakes like forgetting about that double "=" and the ";" at the end of the line.
My other problem, is watching out for all the parameters that something like rotation, or particles, or primitive parameters need. Same thing I guess.
Frankly, it's hard to catch the mistakes when you hardly know enough to ask the question.
*mumble* years ago I had a program Called "GameMaker" from Activision that ran on a very popular home computer of the day. (Trying not to date myself TOO much.) It had a bunch of example games based on popular game consoles of the time, and quite a few other sound and graphic demos that you could study and learn from.
What was interesting about it, was, that you did most of the coding from a commands and functions that came from a drop down list accessed via a joystick. Once you chose a command, a line containing the code would appear in your programming area, along with some text fields or menus to fill in.
My point is, let's say I picked something like llSetPrimitiveParams, it would appear in the work area, along with a bunch of drop down menus to pick the type of primitive, and then maybe some blank spots where you could fill in the parameters, or perhaps pick them from a list, or use a slider thingy. (Hmm. . .not too different from the way prims are manipulated, come to think of it.) On something like prims, or particles, maybe you could even display a shape.
Whenever you do something that needs to be ended, the followup command (whatever it is) could appear a couple lines down, with a blank in between the parts so that an appropriate command or statement or whatever could be inserted, and then ITS fill in boxes would be ready to populate with appropriate parameters or variables.
Yes, I've seen Scratch4LSL, and that's the sort of thing I'm talking about, but Scratch scripts put in all sorts of stuff that it can do, whether it's being used or not.
Like I said, I've seen this sort of thing done before. And I've seen progress made in this direction with LSL. But I don't need anyone to ask me questions about what it is I want to do--I just need an easy way to put whatever the hell it is belongs in between the second and third commas, without having to open up a browser window and figure out how to look it up, and remember to put the semicolon in place.
_____________________
"Two lives I have. One life I live. One life I dream. In dreams I remember the better in me."
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
07-29-2008 16:57
From: Osgeld Barmy but yes ive always felt the scripting needed to be simpler, i started this opinion in simpler times tho when lsl was expected to have many mini scripts to acheive the desired function ........................... dunno maybe this is a good excuse for me to try out a new scripting language and make my own script maker
There is no way to convey just how simple LSL is compared to some of the other languages, some with a few thousand functions and variables. I am saying this because I never coded until LSL and am just now making a serious foray into other languages. Autoit is a fairly simple, yet powerful language and yet the following script took me a month to get working like I want, many more gray hairs now  Actually it would have been impossible if I wouldn't have at least learned the basics with LSL. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Plot Wizard dir\PW.ico #AutoIt3Wrapper_Outfile=Plot Wizard\Plot Wizard.exe #AutoIt3Wrapper_UseAnsi=y #AutoIt3Wrapper_Run_Au3check=n #AutoIt3Wrapper_Tidy_Stop_OnError=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <ListviewConstants.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $autosave = "C:\Program Files\Plot Wizard\Autosave\*.pdf" Global $irfandir = "C:\Program Files\IrfanView" Global $irfanexe = "i_view32.exe " Global $pdffactorykey = "HKEY_CURRENT_USER\Software\FinePrint Software\pdfFactory3\FinePrinters\pdfFactory Pro" Global $pdfxchange = "C:\Program Files\Tracker Software\PDF-XChange Viewer\pdf-viewer\PDFXCview.exe" Global $pdfthumb = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf" Global $printer = " /print=pdfFactory Pro" Global $selectmultiple = "Hold down Ctrl or Shift to choose multiple files." Global $_8x11, $_11x17, $_24x36, $array, $approved, $convertbutton, $editbutton, $ext Global $fielduse, $filecount, $fileitem, $fileoption, $footer, $footeron, $forapproval Global $incr, $license, $none, $papername, $papersize, $percent, $printbutton Global $printerarray[1], $progressbar, $revfielduse, $rotbutton Global $rotdirection, $rotleft, $rotright, $showdlg, $sortorder ;SETUP IniWrite("C:\Program Files\IrfanView\i_view32.ini", "Batch", "AdvResize", 1) IniWrite("C:\Program Files\IrfanView\i_view32.ini", "Print", "Option", 2) IniWrite("C:\Program Files\IrfanView\i_view32.ini", "Print", "Centered", 1) IniWrite("C:\Program Files\IrfanView\i_view32.ini", "Print", "Printer", "pdfFactory Pro") IniWrite("C:\Program Files\IrfanView\i_view32.ini", "Print", "Orient", 2) IniWrite("C:\Program Files\IrfanView\i_view32.ini", "Print", "Size", "ARCH D") IniWrite("C:\Program Files\IrfanView\i_view32.ini", "Batch", "AdvResizeW", 36) IniWrite("C:\Program Files\IrfanView\i_view32.ini", "Batch", "AdvResizeH", 24) IniWrite("C:\Program Files\IrfanView\i_view32.ini", "Batch", "AdvResizeL", 36) IniWrite("C:\Program Files\IrfanView\i_view32.ini", "Batch", "AdvResample", 0) IniWrite("C:\Program Files\IrfanView\i_view32.ini", "ImPDF", "EncodingActive", 1) RegWrite("HKEY_CURRENT_USER\Software\FinePrint Software\pdfFactory3", "AutoSaveDir", "REG_EXPAND_SZ", "C:\Program Files\Plot Wizard\AutoSave") RegWrite($pdffactorykey, "SkipPrintDialog", "REG_DWORD", 0) RegWrite($pdffactorykey, "collate", "REG_DWORD", 1) RegWrite($pdffactorykey, "Copies", "REG_DWORD", 1) RegWrite($pdffactorykey & "\PrinterDriverData", "PdfAction", "REG_DWORD", 0) RegWrite($pdffactorykey & "\PrinterDriverData", "Orientation", "REG_DWORD", 2) RegWrite($pdffactorykey & "\PrinterDriverData", "MarginTop", "REG_DWORD", 100) RegWrite($pdffactorykey & "\PrinterDriverData", "MarginBottom", "REG_DWORD", 100) RegWrite($pdffactorykey & "\PrinterDriverData", "MarginLeft", "REG_DWORD", 100) RegWrite($pdffactorykey & "\PrinterDriverData", "MarginRight", "REG_DWORD", 100) RegWrite("HKEY_CURRENT_USER\Software\Tracker Software\PDFViewer\Annots\Defaults\TypeWriter\TextFormat", "FontSize", "REG_BINARY", "0000000000002440") ;END SETUP ;MAIN GUI $maingui = GUICreate("Jesse's Plot Wizard", 396, 388, 318, 180) $folder = "" $info = GUICtrlCreateMenu("HELP/INFO") $help = GUICtrlCreateMenuItem("Help", $info) $about = GUICtrlCreateMenuItem("About", $info) $license = GUICtrlCreateMenuItem("License", $info) GUISetState(@SW_SHOW) Dim $maingui_AccelTable[4][2] = [["^!+{F1}", $fileitem],["^c", $convertbutton],["^d", $editbutton],["^p", $printbutton]] GUISetAccelerators($maingui_AccelTable) ;BUTTON EDIT $editbutton = GUICtrlCreateButton("CONVERT ADD DATES ADD FOOTER", 246, 114, 140, 94, $BS_MULTILINE) GUICtrlSetFont(-1, 14, 400, 0, "Lucida Sans") GUICtrlSetTip(-1, "Add dates or footer to selected drawings") ;GUI FOOTER GUICtrlCreateGroup("Dwg Status Footer", 6, 106, 230, 108) $forapproval = GUICtrlCreateRadio("For Approval", 18, 123, 80, 17) $approved = GUICtrlCreateRadio("Approved", 18, 143, 80, 17) $fielduse = GUICtrlCreateRadio("Field Use", 18, 163, 80, 17) $revfielduse = GUICtrlCreateRadio("Revised Field Use", 106, 163, 112, 17) $revapproved = GUICtrlCreateRadio("Revised Approved", 106, 143, 112, 17) $revforapproval = GUICtrlCreateRadio("Revised For Approval", 106, 123, 120, 17) $none = GUICtrlCreateRadio("None", 90, 179, 64, 25) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) ;GUI PLOT SIZE GUICtrlCreateGroup("Select Plot Size", 24, 224, 129, 89) GUICtrlSetFont(-1, 8, 400, 0, "Microsoft Sans Serif") $_8x11 = GUICtrlCreateRadio("8 1/2 X 11", 32, 240, 81, 17) $_11x17 = GUICtrlCreateRadio("11 X 17", 32, 264, 81, 17) $_24x36 = GUICtrlCreateRadio("24 X 36", 32, 288, 81, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlCreateGroup("", -99, -99, 1, 1) ;BUTTON PRINT $printbutton = GUICtrlCreateButton("PRINT", 214, 241, 172, 54) GUICtrlSetFont(-1, 14, 400, 0, "Lucida Sans") GUICtrlSetTip(-1, "Print selected drawings") ;GUI PROGRESS BAR $progressbar = GUICtrlCreateProgress(78, 330, 300, 20) $progtext = GUICtrlCreateLabel("Progress:", 15, 330, 44, 20) ;GUI ROTATE DWGS GUICtrlCreateGroup("", 96, 8, 193, 81) $rotleft = GUICtrlCreateRadio("Left", 224, 25, 50, 25) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Sans") $rotright = GUICtrlCreateRadio("Right", 224, 52, 57, 25) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Sans") $rotbutton = GUICtrlCreateButton("Rotate", 110, 23, 100, 54) GUICtrlSetFont(-1, 14, 400, 0, "Lucida Sans") GUICtrlSetTip(-1, "Rotate selected dwgs") GUICtrlCreateGroup("", -99, -99, 1, 1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MESSAGES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;GUI MESSAGES Local $folder While 1 $nMsg = GUIGetMsg() Switch $nMsg ;EDIT Case $editbutton _edit() ;EXIT Case $GUI_EVENT_CLOSE RegDelete($pdfthumb, "Application") RegWrite($pdfthumb, "Progid", "REG_SZ", "AcroExch.Document") Exit ;HELP Case $help _help() ;INFO Case $about _info() ;LICENSE Case $license _license() ;PRINT Case $printbutton _print() ;ROTATE Case $rotbutton _rotateprints() EndSwitch WEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RADIO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _radio() If BitAND(GUICtrlRead($forapproval), $GUI_CHECKED) Then $footer = "For Approval" EndIf If BitAND(GUICtrlRead($approved), $GUI_CHECKED) Then $footer = "Approved" EndIf If BitAND(GUICtrlRead($fielduse), $GUI_CHECKED) Then $footer = "Field Use" EndIf If BitAND(GUICtrlRead($revforapproval), $GUI_CHECKED) Then $footer = "Revised For Approval" EndIf If BitAND(GUICtrlRead($revapproved), $GUI_CHECKED) Then $footer = "Revised Approved" EndIf If BitAND(GUICtrlRead($revfielduse), $GUI_CHECKED) Then $footer = "Revised Field Use" EndIf If BitAND(GUICtrlRead($none), $GUI_CHECKED) Then $footeron = "0" Else $footeron = "1" EndIf If BitAND(GUICtrlRead($_8x11), $GUI_CHECKED) Then $papername = "Letter" $papersize = "1" RegDelete($pdffactorykey & "\PrinterDriverData", "PaperHeight") RegWrite($pdffactorykey & "\PrinterDriverData", "PaperWidth") EndIf If BitAND(GUICtrlRead($_11x17), $GUI_CHECKED) Then $papername = "Tabloid" $papersize = "3" RegDelete($pdffactorykey & "\PrinterDriverData", "PaperHeight") RegWrite($pdffactorykey & "\PrinterDriverData", "PaperWidth") EndIf If BitAND(GUICtrlRead($_24x36), $GUI_CHECKED) Then $papername = "ARCH D" $papersize = "280" RegWrite($pdffactorykey & "\PrinterDriverData", "PaperHeight", "REG_DWORD", 9144) RegWrite($pdffactorykey & "\PrinterDriverData", "PaperWidth", "REG_DWORD", 6096) EndIf EndFunc ;==>_radio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; BUTTON FUNCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;FUNC EDIT Func _edit() $fileoption = "TIF (*.TIF)|PDF (*.pdf)|Images (*.tif;*.jpg;*.pdf)" GUICtrlSetState($_24x36, $GUI_CHECKED) $showdlg = 2 $sortorder = 0 _selected_files() _sort() _radio() _regwrite() GUICtrlSetData($progressbar, 0) $incr = 1 While $incr <= $filecount $n = $percent * $incr GUICtrlSetData($progressbar, $n) If $filecount = 1 Then $filename = $array[1] Else $filename = $array[1] & "\" & $array[$incr + 1] EndIf $incr += 1 RunWait(@ComSpec & " /c " & $irfanexe & $filename & $printer, $irfandir, @SW_HIDE) WinWaitClose("cmd.exe") WEnd Sleep(2000) GUICtrlSetData($progressbar, 0) $pid = FileMove($autosave, $folder & "\", 1) WinWaitClose($pid) $incr = 1 While $incr <= $filecount If $filecount = 1 Then $filename = $array[1] Else $filename = $array[1] & "\" & $array[$incr + 1] EndIf If $ext <> ".pdf" Then $filename = StringTrimRight($filename, 3) & "pdf" EndIf $incr += 1 $pid = ShellExecute($filename, "", "", "open") WinWaitClose($pid, 200) Sleep(200) WEnd EndFunc ;==>_edit ;FUNC PRINT Func _print() GUICtrlSetState($none, $GUI_CHECKED) $fileoption = "PDF (*.pdf)|TIF (*.TIF)|Images (*.tif;*.jpg;*.pdf)" $showdlg = 1 $sortorder = 1 _selected_files() _sort() _radio() _regwrite() GUICtrlSetData($progressbar, 0) $incr = 1 While $incr <= $filecount $n = $percent * $incr GUICtrlSetData($progressbar, $n) If $filecount = 1 Then $filename = $array[1] Else $filename = $array[1] & "\" & $array[$incr + 1] EndIf $incr += 1 RunWait(@ComSpec & " /c " & $irfanexe & $filename & $printer, $irfandir, @SW_HIDE) WEnd GUICtrlSetData($progressbar, 0) EndFunc ;==>_print ;FUNC ROTATE Func _rotateprints() $fileoption = "TIF (*.TIF)|PDF (*.pdf)|Images (*.tif;*.jpg;*.pdf)" GUICtrlSetState($_24x36, $GUI_CHECKED) $sortorder = 1 _selected_files() _sort() IniWrite("C:\Program Files\IrfanView\i_view32.ini", "Batch", "AdvResize", 0) If BitAND(GUICtrlRead($rotleft), $GUI_CHECKED) Then $rotdirection = " /rotate_l /convert=" Else $rotdirection = " /rotate_r /convert=" EndIf GUICtrlSetData($progressbar, 0) $incr = 1 While $incr <= $filecount $n = $percent * $incr GUICtrlSetData($progressbar, $n) If $filecount = 1 Then $filename = $array[1] Else $filename = $array[1] & "\" & $array[$incr + 1] EndIf $incr += 1 RunWait(@ComSpec & " /c " & $irfanexe & $filename & $rotdirection & $filename, $irfandir, @SW_HIDE) WEnd MsgBox(0, "", "Finished rotating dwgs") GUICtrlSetData($progressbar, 0) EndFunc ;==>_rotateprints ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SUPPORTING FUNCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;FUNC FILES Func _selected_files() If $folder = "" Then $folder = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" EndIf $file = FileOpenDialog($selectmultiple, $folder, $fileoption, 1 + 4) $array = StringSplit($file, "|") $filecount = $array[0] $folder = $array[1] If $filecount = 1 Then $len = StringLen($folder) $trim = $len - StringInStr($folder, "\", 0, -1, $len) $folder = StringTrimRight($folder, $trim) $filename = $array[1] $ext = StringTrimLeft($filename, StringLen($filename) - 3) $percent = 100 Else $filecount -= 1 $filename = $array[2] $ext = StringTrimLeft($filename, StringLen($filename) - 3) $percent = 100 / $filecount EndIf RegWrite($pdfthumb, "Application", "REG_SZ", "PDFXCview.exe") RegWrite($pdfthumb, "Progid", "REG_SZ", "PDF-XChangeViewer.1") EndFunc ;==>_selected_files ;FUNC HELP Func _help() MsgBox(0, "HELP", "ROTATE: Select LEFT or RIGHT and then push ROTATE button to open file dialog and choose files to rotate" & @CRLF & @CRLF & "CONVERT: If you need to add a footer, dates or convert jpg or TIF files to pdf files then pick footer (or select none) and click the CONVERT button to open the file dialoge to choose prints. The program will add the footer and open the drawings in PDF Xchange for editing. When you are finished editing the drawings, exit out of PDF Xchange and hit enter to save each file." & @CRLF & @CRLF & "PRINT: Choose size and then hit print button. After PDF Factory has finished loading all of the drawings, change the order if needed (plotter prints in reverse) and then click the PDF Factory PRINT button and choose the printer to send it to. Adjust the print size if needed." & @CRLF & @CRLF & "TIP: You can choose multiple files in the file open dialog by using ctrl click or shift click" & @CRLF & @CRLF & "TIP: Depending on the button pushed, the file open dialog will show only either pdf or TIF files. You can expand that choice to show either TIF, pdf or TIF & pdf & jpg files" & @CRLF & @CRLF & "TIP: Plot Wizard will only print pdf, TIF or jpg drawing files!" & @CRLF & @CRLF & "IF ALL ELSE FAILS GO ASK JESSE!:)") EndFunc ;==>_help ;FUNC INFO Func _info() MsgBox(0, "About", "Copyright (C) 2008 Jesse Whitehead" & @CRLF & "This program is distributed under the terms of the GNU General Public License" & @CRLF & "Click the license option to view the terms and conditions" & @CRLF & "Source code is included in the install directory") EndFunc ;==>_info ;FUNC LICENSE Func _license() ShellExecute("C:\Program Files\Plot Wizard\gpl.txt") EndFunc ;==>_license ;FUNC SORT Func _sort() If $filecount > 1 Then _ArraySort($array, $sortorder, 2) EndIf EndFunc ;==>_sort ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; READ/WRITE OPERATIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;FUNC REGWRITE Func _regwrite() RegWrite($pdffactorykey, "StationeryName", "REG_SZ", $footer) RegWrite($pdffactorykey, "UseStationery", "REG_DWORD", $footeron) RegWrite($pdffactorykey & "\PrinterDriverData", "ShowDlg", "REG_DWORD", $showdlg) RegWrite($pdffactorykey & "\PrinterDriverData", "Papername", "REG_SZ", $papername) RegWrite($pdffactorykey & "\PrinterDriverData", "Papersize", "REG_DWORD", $papersize) EndFunc ;==>_regwrite Back to the OP. Hang in there, as stated, I was a script/code virgin until SL. If I can learn then anyone can. This one took a bit of work but now I find I even do off the cuff little bat files to simplify tasks all of the time now. There are no limits to the possibilites once you start you first "Hello World" script.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
07-29-2008 18:22
i would have not said that if i only knew lsl  but even getting down to the core language, it mimics many popular languages, the father of that style i assume is C, but was that really needed for a general user base? ie if i wanted to add 2 numbers in LSL (not taking in account states, cause i totoally understand why they are there) it would involve many cryptic symbols that to joe noob seem quite confusing integer total; // right away we have to hard define a variable are we 100% sure we need a integer? maybe a float?, but what if i need to print it, instant extra layer of confusion
total = 2 + 2;
llOwnerSay((string) total); // drat now i have to typecast it, keep up with more ()'s
vs a simpler language, lets say lua total = 0 total = 2 + 2 print(total)
ah, now theres no {} or ; to keep up with, and who cares what total is as a variable, we dont need to it could be a string a float a integer ect ect ect now im not saying lua is the best language in the world, i find it rather clunky, but it does serve as an example of a simpler scripting language, most find easier to pick up, hince why its used in systems like WOW and i dont really find LSL difficult now, but in 2005 as a scripting virgin myself, just being able to add in some simple functionality became a real hassle, mainly keeping up with the formatting syntax, if i had no real interest in scripting, i would have not even bothered i dont suggest replacing lsl with a block type system, but for anyone who wants to add some functionality to their creations, and not learn how to make a full blown OS in lsl i think it would be (is) a great (but limited) addition, just as being able to take a square texture and slap it on your av is a great, but limited way to make a shirt, without learning photoshop uv mapping or templates
|
|
DancesWithRobots Soyer
Registered User
Join date: 7 Apr 2006
Posts: 701
|
07-30-2008 06:52
For Yumi: Yep, that was it. David Crane's Game Maker, which I ran on a Commodore 64. I remember going to a local department store to buy a copy and was told by a clerk, who apparently didn't hear me "The video game industry is dead now." There was an NES in the showcase behind him, complete with ROB.
I remember when I looked at it, (DC's GM) having an "aha!" moment--This is BASIC made easy. I used it, because it's a perfect example of what I'm talking about.
I HAVE managed to do a little scripting. I can take relatively simple scripts and change the timing or the start event. I've painfully worked my way through well commented particle scripts to get a particular shape I needed. But some of those wiki and portal pages leave me asking more questions than I started with.
I probably don't even need exactly what I'm talking about. But there are a few people out there who take one look at lsl and. . .well, ok--Some people won't even try building. I guess you can't make some things simple enough for everyone.
Oh, and in my original post, I mentioned that I HAVE seen S4LSL. (I've been playing with the original Scratch with my niece.) Problem is that when I duplicated the default script in just a few blocks, I got something that DID work--But it added a LOT of stuff that had nothing to do with what I was doing. But it IS a step in the right direction.
I'm going to try some of the solutions you folks mentioned, tho, my eyes aren't what they used to be and sometimes peering into those little editing windows (not lsl's fault, I know) makes them itch.
Anyway, thanks for all of your answers, and for treating my post as a valid one and not making me feel too stupid.
_____________________
"Two lives I have. One life I live. One life I dream. In dreams I remember the better in me."
|