Author |
Message |
Micro
Ambassador
Joined: Wed Apr 20, 2011 1:19 pm Posts: 2556 Location: Oklahoma City, OK 73170 US
|
 TWX Proxy - Asignment Operators
ok, since no one requested anything, I worked on one of my own requests: TWX doesn't have an assignment operator, well is has: ... but wouldn't it be nice if you could use ":=" instead? ok, I still want to put a ; at the end of that, but isn't that a lot easier to read? and wouldn't it be nice if you could use "*=", "/=", "+=", "-=", "++", and "--" operators like this: Code: $dogs := 11
While $birds < 5 $birds++ $mice += 2 * $birds $dogs -= 2
echo "Your cats ate " $birds " birds and " $mice " mice, and chased " $dogs " dogs*" end
$dogs := 5 $cats := 1
while $dogs > 0 $feline := $cats * 100 $feline /= $cats + $dogs
echo "You Have " $dogs " Dogs and " $cats " Cats, which is " $feline "% feline*"
$Dogs-- $cats *= 2 end
Well, i just finished writing this feature, and here is the output of the above script: Code: Your cats ate 1 birds and 2 mice, and chased 9 dogs Your cats ate 2 birds and 6 mice, and chased 7 dogs Your cats ate 3 birds and 12 mice, and chased 5 dogs Your cats ate 4 birds and 20 mice, and chased 3 dogs Your cats ate 5 birds and 30 mice, and chased 1 dogs You Have 5 Dogs and 1 Cats, which is 16% feline You Have 4 Dogs and 2 Cats, which is 33% feline You Have 3 Dogs and 4 Cats, which is 57% feline You Have 2 Dogs and 8 Cats, which is 80% feline You Have 1 Dogs and 16 Cats, which is 94% feline
I think I managed to get all 7 new mathematical operators in there, and used a few of the old operators that most people forget were added in TWX 2.0. It is just a bit of compiler fakery, as it is still using setvar, add, multiple, etc... internally... but I think it is so much easier to read when using assignment operators instead of functions. don't you?
_________________ Regards, Micro Website: http://www.microblaster.net TWGS2.20b/TW3.34: telnet://twgs.microblaster.net:2002
ICQ is Dead Jim! Join us on Discord: https://discord.gg/zvEbArscMN
|
Mon Dec 30, 2019 2:21 pm |
|
 |
Hammer_2
Lieutenant J.G.
Joined: Mon Dec 01, 2014 5:39 pm Posts: 440
|
 Re: TWX Proxy - Asignment Operators
Very nice Micro, I think I eluded to wanting something like this months (years?) ago.
I may get back into the game at some point and will surely appreciate your efforts.
|
Thu Jan 09, 2020 6:49 am |
|
 |
Cruncher
Ambassador
Joined: Fri Feb 23, 2001 3:00 am Posts: 4011 Location: USA
|
 Re: TWX Proxy - Asignment Operators
Missing Modulus %
But, I don't know if the % symbol is recognizable for TWXProxy and have been thinking of when it may be applicable to a script.
Just something I ponder.
_________________
BOTE 1998 Champs: Team Fament HHT 2015 Champs: Cloud09 Big Game 2016 Champs: Draft team HHT 2018 Champs: Rock Stars Big Game 2019 Champs: Draft Team
Classic Style Games Here: telnet://crunchers-twgs.com:2002 Web page from 1990's: https://web.archive.org/web/20170103155645/http://tradewars.fament.com/Cruncher/tradewar.htm Blog with current server info: http://cruncherstw.blogspot.com Discord: https://discord.gg/4dja5Z8 E-mail: Cruncherstw@gmail.com FaceBook: http://www.facebook.com/CrunchersTW
|
Thu Jan 09, 2020 8:23 am |
|
 |
Micro
Ambassador
Joined: Wed Apr 20, 2011 1:19 pm Posts: 2556 Location: Oklahoma City, OK 73170 US
|
 Re: TWX Proxy - Asignment Operators
It is not the only operator missing:  Modulus is the remainder of a division operation. 10 / 4 = 2.5 10 % 4 = 5 Sounds like something an accountant would use.  I might add it as it is the only "Arithmetic" operator missing. Maybe it would come in handy in a haggling routine?
_________________ Regards, Micro Website: http://www.microblaster.net TWGS2.20b/TW3.34: telnet://twgs.microblaster.net:2002
ICQ is Dead Jim! Join us on Discord: https://discord.gg/zvEbArscMN
|
Thu Jan 09, 2020 12:21 pm |
|
 |
Cruncher
Ambassador
Joined: Fri Feb 23, 2001 3:00 am Posts: 4011 Location: USA
|
 Re: TWX Proxy - Asignment Operators
Micro wrote: It is not the only operator missing: Modulus is the remainder of a division operation. 10 / 4 = 2.5 10 % 4 = 5 Sounds like something an accountant would use.  I might add it as it is the only "Arithmetic" operator missing. Maybe it would come in handy in a haggling routine? No, I actually learned about that when I went back to learn programming. Maybe EP could use it for his haggle?
_________________
BOTE 1998 Champs: Team Fament HHT 2015 Champs: Cloud09 Big Game 2016 Champs: Draft team HHT 2018 Champs: Rock Stars Big Game 2019 Champs: Draft Team
Classic Style Games Here: telnet://crunchers-twgs.com:2002 Web page from 1990's: https://web.archive.org/web/20170103155645/http://tradewars.fament.com/Cruncher/tradewar.htm Blog with current server info: http://cruncherstw.blogspot.com Discord: https://discord.gg/4dja5Z8 E-mail: Cruncherstw@gmail.com FaceBook: http://www.facebook.com/CrunchersTW
|
Thu Jan 09, 2020 6:07 pm |
|
 |
Micro
Ambassador
Joined: Wed Apr 20, 2011 1:19 pm Posts: 2556 Location: Oklahoma City, OK 73170 US
|
 Re: TWX Proxy - Asignment Operators
Cruncher wrote: Maybe EP could use it for his haggle? I know he uses floating point math in EP haggle, so I am not sure.
_________________ Regards, Micro Website: http://www.microblaster.net TWGS2.20b/TW3.34: telnet://twgs.microblaster.net:2002
ICQ is Dead Jim! Join us on Discord: https://discord.gg/zvEbArscMN
|
Thu Jan 09, 2020 7:07 pm |
|
 |
Hammer_2
Lieutenant J.G.
Joined: Mon Dec 01, 2014 5:39 pm Posts: 440
|
 Re: TWX Proxy - Asignment Operators
Micro wrote: Cruncher wrote: Maybe EP could use it for his haggle? I know he uses floating point math in EP haggle, so I am not sure. If this is some tricky way to expose how his haggling routine actually works.. then well played!
|
Thu Jan 09, 2020 7:19 pm |
|
 |
Micro
Ambassador
Joined: Wed Apr 20, 2011 1:19 pm Posts: 2556 Location: Oklahoma City, OK 73170 US
|
 Re: TWX Proxy - Asignment Operators
Hammer_2 wrote: If this is some tricky way to expose how his haggling routine actually works.. then well played! No I haven't looked at the code.
_________________ Regards, Micro Website: http://www.microblaster.net TWGS2.20b/TW3.34: telnet://twgs.microblaster.net:2002
ICQ is Dead Jim! Join us on Discord: https://discord.gg/zvEbArscMN
|
Thu Jan 09, 2020 8:41 pm |
|
 |
Cruncher
Ambassador
Joined: Fri Feb 23, 2001 3:00 am Posts: 4011 Location: USA
|
 Re: TWX Proxy - Asignment Operators
Micro wrote: Hammer_2 wrote: If this is some tricky way to expose how his haggling routine actually works.. then well played! No I haven't looked at the code. Well... it floats the wrong way sometimes, maybe he does need Modulus 
_________________
BOTE 1998 Champs: Team Fament HHT 2015 Champs: Cloud09 Big Game 2016 Champs: Draft team HHT 2018 Champs: Rock Stars Big Game 2019 Champs: Draft Team
Classic Style Games Here: telnet://crunchers-twgs.com:2002 Web page from 1990's: https://web.archive.org/web/20170103155645/http://tradewars.fament.com/Cruncher/tradewar.htm Blog with current server info: http://cruncherstw.blogspot.com Discord: https://discord.gg/4dja5Z8 E-mail: Cruncherstw@gmail.com FaceBook: http://www.facebook.com/CrunchersTW
|
Thu Jan 09, 2020 11:17 pm |
|
 |
Shadow
Lieutenant
Joined: Tue Dec 17, 2002 3:00 am Posts: 516 Location: Virginia
|
 Re: TWX Proxy - Asignment Operators
Hammer_2 wrote: Micro wrote: Cruncher wrote: Maybe EP could use it for his haggle? I know he uses floating point math in EP haggle, so I am not sure. If this is some tricky way to expose how his haggling routine actually works.. then well played! Pretty much everyone knows how it works now. The source code is out there.
_________________ TOURNAMENT WINNER: ICE 2017 - ICE 2019 - SUMMER SPLASH 2019 - XMAS TOURNEY 2019
|
Fri Jan 10, 2020 11:24 am |
|
 |
ElderProphet
Commander
Joined: Tue Oct 07, 2003 2:00 am Posts: 1124 Location: Augusta, GA
|
 Re: TWX Proxy - Asignment Operators
Nice work Micro!
+EP+
_________________ Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.
|
Mon Jan 13, 2020 7:55 pm |
|
 |
Micro
Ambassador
Joined: Wed Apr 20, 2011 1:19 pm Posts: 2556 Location: Oklahoma City, OK 73170 US
|
 Re: TWX Proxy - Asignment Operators
ElderProphet wrote: Nice work Micro!
+EP+ Thanks, That means a lot coming from you!
_________________ Regards, Micro Website: http://www.microblaster.net TWGS2.20b/TW3.34: telnet://twgs.microblaster.net:2002
ICQ is Dead Jim! Join us on Discord: https://discord.gg/zvEbArscMN
|
Tue Jan 14, 2020 12:15 pm |
|
 |
Micro
Ambassador
Joined: Wed Apr 20, 2011 1:19 pm Posts: 2556 Location: Oklahoma City, OK 73170 US
|
 Re: TWX Proxy - Asignment Operators
Cruncher wrote: Missing Modulus %. I added the modulus command and operator, and I already found a use for it when writing the new performance timer commands: Code: StartTimer $Timer1
# Do something that may take a while
StopTimer $Timer1
$Seconds := $Timer1 / 1000 $MiliSec := $Timer1 % 1000
Echo "You command took " $Seconds " seconds and " $MiliSec " ms to complete."
In this example "$Timer1 % 1000" returns the number of ms elpased.
_________________ Regards, Micro Website: http://www.microblaster.net TWGS2.20b/TW3.34: telnet://twgs.microblaster.net:2002
ICQ is Dead Jim! Join us on Discord: https://discord.gg/zvEbArscMN
|
Wed Jul 01, 2020 11:04 am |
|
 |
Cruncher
Ambassador
Joined: Fri Feb 23, 2001 3:00 am Posts: 4011 Location: USA
|
 Re: TWX Proxy - Asignment Operators
Micro wrote: Cruncher wrote: Missing Modulus %. I added the modulus command and operator, and I already found a use for it when writing the new performance timer commands: Code: StartTimer $Timer1
# Do something that may take a while
StopTimer $Timer1
$Seconds := $Timer1 / 1000 $MiliSec := $Timer1 % 1000
Echo "You command took " $Seconds " seconds and " $MiliSec " ms to complete."
In this example "$Timer1 % 1000" returns the number of ms elpased. Nice!
_________________
BOTE 1998 Champs: Team Fament HHT 2015 Champs: Cloud09 Big Game 2016 Champs: Draft team HHT 2018 Champs: Rock Stars Big Game 2019 Champs: Draft Team
Classic Style Games Here: telnet://crunchers-twgs.com:2002 Web page from 1990's: https://web.archive.org/web/20170103155645/http://tradewars.fament.com/Cruncher/tradewar.htm Blog with current server info: http://cruncherstw.blogspot.com Discord: https://discord.gg/4dja5Z8 E-mail: Cruncherstw@gmail.com FaceBook: http://www.facebook.com/CrunchersTW
|
Wed Jul 01, 2020 11:40 am |
|
 |
Adept
Chief Warrant Officer
Joined: Sat Feb 27, 2016 1:01 am Posts: 189 Location: Molon Labe
|
 Re: TWX Proxy - Asignment Operators
I don't see a current TWXP thread that is general purpose, so posting here.
I am reading that the new switchbot command kills all active scripts in its function. This conflicts with the intention of the botKit script I had been working on.
Would it be possible to instead have the swithbot command not terminate/exempt any scripts set to run within the Auto Run tab of TWX?
botKit is intended to serve as a all around failsafe script that is initiated automatically during TWX startup.
Also, noting that botKit is designed to both reboot and/or swap out a user's bot.
_________________ “The object of life is not to be on the side of the majority, but to escape finding one’s self in the ranks of the insane.” — Marcus Aurelius
TWX Proxy Reference Online
|
Thu Jul 15, 2021 10:09 pm |
|
 |
|