| www.ClassicTW.com https://mail.black-squirrel.com/ |
|
| First time scripter question https://mail.black-squirrel.com/viewtopic.php?f=15&t=12995 |
Page 1 of 1 |
| Author: | Evernex [ Sun Feb 08, 2004 6:29 am ] |
| Post subject: | |
I am just trying out scripting for the first time, and I'm comparing to other scripts to try and construct it. This particular one is very simple; I'm only doing a basic colonizing script, but the catch is that I am trying to make it check for 0-low number of colonists on Terra. I'll post the script here, because it is simple, any help would be greatly appreciated. I'm not sure where else to post a message like this, except here, sorry if this is too basic. So the problem is that it doesn't work; I'm trying to scan for the quantity of colonists wanted in the 'i' information, and all it does is express to the planet to colonize, lands and then sits there and does nothing... I don't get it, however, I am new at this. If there is a better place to post such topics please tell me. Thanks. # check if we can run it from here cutText CURRENTLINE $location 1 12 if ($location <> "Command [TL=") clientMessage "This script must be run from the command prompt" halt end # Set trigger to stop script if disconnected setEventTrigger 0 :End "Connection lost" # Get needed info :GetMoveFrom getinput $planet "Enter planet sector" 0 getinput $planet1 "Enter planet ID to colonize" 0 getinput $quantity "Enter quantity to move" 0 getinput $resource "What resource number (1=Ore, 2=Organics, 3=Equip)" 0 # Start the colonizing :move send "1*e" send "lt" $quantity "*" # Now let's check to see if the number of colonists are the quantity or not send "i" setTextLineTrigger 1 :getscanner "Total Holds :" :getScanner getWord CURRENTLINE $colonist 9 if ($colonist < $quantity) goto :notenough else goto :finish # Finish it up :finish send $planet "*e" "lsn" $resource $quantity "*q" goto :move # This way it keeps checking for colonists :notenough send $planet "*e" setDelayTrigger delay :wait 60000 goto :move Thanks again. |
|
| Author: | Vid Kid [ Sun Feb 08, 2004 8:50 am ] |
| Post subject: | |
quote:Originally posted by Evernex I am just trying out scripting for the first time, and I'm comparing to other scripts to try and construct it. This particular one is very simple; I'm only doing a basic colonizing script, but the catch is that I am trying to make it check for 0-low number of colonists on Terra. I'll post the script here, because it is simple, any help would be greatly appreciated. I'm not sure where else to post a message like this, except here, sorry if this is too basic. So the problem is that it doesn't work; I'm trying to scan for the quantity of colonists wanted in the 'i' information, and all it does is express to the planet to colonize, lands and then sits there and does nothing... I don't get it, however, I am new at this. If there is a better place to post such topics please tell me. Thanks. Thanks again. This is a TWX type question and should be posted @ http://www.twxproxy.com/support.php but for the most part , you may want a look at more files , I don't want to make this a long post. So email/icq me and I'll get you rolling. Vid's World on Guam http://geocities.com/videotees/twars.html telnet://vidsworld.no-ip.org:2002 http://vidkid.coastgames.com/index.php <--- Register & Request Games http://geocities.com/videotees/hintstips.html <-- Vid's Hints and Tips icq 14340614 - Vid Kid |
|
| Author: | Wildstar [ Sun Feb 08, 2004 9:42 pm ] |
| Post subject: | |
I can help ya out,Add me to your icq and I will see what I can do to help. |
|
| Author: | Evernex [ Mon Feb 09, 2004 12:13 am ] |
| Post subject: | |
Thanks for the reroute Vid Kid, it is a TWX script which I didn't specify in the original message (though I guess it was obvious).I also appreciate the offers of help, and am currently trying to add both of you to my ICQ account, thanks. My ICQ number is: 301934560 |
|
| Author: | ElderProphet [ Mon Feb 09, 2004 11:59 pm ] |
| Post subject: | |
This is a fine forum for this sort of post. And I'm glad to see that there are plenty of players willing to help. First, let me encourage you to keep trying, as this is the best way to improve your skills. Let me briefly cover the problems with this script. There are a few reasons I might choose not to write this kind of script, but I'm just gonna focus on the problems that will keep this script from working. I'm assuming the paths to and from terra are clear, since you did. The first problem is that you ask for a total number of colonists to move, $quantity. This is the same number that you try and pick up from terra on line 22. And since a quantity like 3000 will not fit into your ship, TWGS will read 3000 as 30. Also, textLineTrigger 1 is wrong. First, you have to pause after the triggers are set. The quoted part should be (Note the extra spaces) "Total Holds :". However, this CURRENTLINE shouldn't have 9 words. For this script you should jettison sometime before :move,then set the textlinetrigger, and capture word 4 as $colonists, E.g.: setTextTrigger 1 :getscanned "Total Holds :" pause :getscanned getWord CURRENTLINE $colonists 4 Other basic problems: Your if/else statement beginning on line 29 should have an end statement on line 33. Also, your :finish section has a few problems, which is the reason it just sits on the planet. Here is the corrected version. :finish send "l" $planet1 "*snl" $resource "*q" goto :move So, to summarize... Jettison, then you need to send "I" first to get the $colonists variable, then at Terra, just send "lt**" to take as many as you can. Then move to the planet sector and drop colonist. This is where you can check how many you are actually carrying or dropping off, as well as keep track of how many you've moved. Ah, what the heck, I'll post it... :finish send "l" $planet1 "*snl" $resource "*q" setTextLineTrigger colosdropped :trackcolos "Colonists do you want to leave" pause :trackcolos getWord CURRENTLINE $colosmoved 11 stripText $colosmoved "([" stripText $colosmoved "]" add $totalmoved $colosmoved if ($totalmoved >= $quantity) echo "*Finished. Halting..." halt end # Note that this delay trigger is alot different than yours... :move vs :wait, and the pause if ($colosmoved < $colonists) setDelayTrigger delay :move 60000 pause end goto :move Good luck with it, and feel free to post any follow ups. +EP+ |
|
| Author: | ElderProphet [ Tue Feb 10, 2004 12:13 am ] |
| Post subject: | |
Er... I guess those extra spaces don't make it to the post after all. Ah well, I'm sure you had that Total Holds quote right to start with. +EP+ |
|
| Author: | Wildstar [ Tue Feb 10, 2004 11:48 am ] |
| Post subject: | |
Good post EP,I was going to send him along the same way also.I wish I had all the help that the new guys are getting when I started.I got lucky,Xide and Alexio took pity on this fool and helped me get started.I owe those guys big. Good luck with the scripting |
|
| Author: | ElderProphet [ Wed Feb 11, 2004 12:27 am ] |
| Post subject: | |
Heh, I just noticed that the very first line of "corrected" code is wrong... should be setTextLineTrigger. Ah well, that is what debugging is for. Having said all of this, the TWX Proxy site is still a better place for TWX specific help. Thanks for the props Wildstar. +EP+ |
|
| Author: | Evernex [ Tue Feb 17, 2004 9:20 pm ] |
| Post subject: | |
Hey thanks a lot EB, that did help out a lot. Wildstar has been helping me a bit more as well, so thanks goe out to him. Appreciate it. [:)] |
|
| Page 1 of 1 | All times are UTC - 5 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|