www.ClassicTW.com
https://mail.black-squirrel.com/

Random Corp Generation
https://mail.black-squirrel.com/viewtopic.php?f=15&t=18410
Page 1 of 1

Author:  Promethius [ Fri Jan 12, 2007 12:33 am ]
Post subject: 

The script is meant to be ran from within the game and currently echos to the user's local screen. This can be changed to echo to fed com if desired by removing the # as noted. Anyone that wants to make changes/improvements to this script, please feel free to do so. Two test outputs will follow the code.

Code:
# Random corp assignments

send "clvq"
waitfor "--- ---------------------"
setVar $i 0

:loopTrader
  setTextLineTrigger getTrader :getTrader "   "
  setTextTrigger compDone :compDone "Computer command"
  pause

:getTrader
  killtrigger compDone
  add $i 1
  cuttext currentline $trader[$i] 30 30
  goto :loopTrader

:compDone
  killtrigger getTrader
  echo ANSI_11 "*How many players do you want on a corp?"
  getConsoleInput $numPlayers

  if ($numPlayers = 0) or ($numPlayers > $i)
      echo ANSI_12 "* Sorry the number of players entered for a corp is not allowed*"
      echo ANSI_12 "* Press ~ to continue*"
      setTextOutTrigger cont :compDone "~"
      pause
  end

setVar $corps $i
divide $corps $numPlayers

setVar $icnt 1
# ------------------- Remove comment # from next line to output to fed com
#   send "`*"
while ($icnt <= $i)
   getRnd $corpNumber 1 $corps
   :recheck
   if ($corpAssign[$corpNumber] = $numPlayers)
       add $corpNumber 1
       if ($corpNumber > $corps)
              if ($pass = 1)
                 goto oneAssignments
              end
              setvar $corpNumber 1
              setVar $pass 1
       end
       goto :recheck
   end
   setVar $pass 0
   add $corpAssign[$corpNumber] 1
   echo "*" $trader[$icnt] " Assigned to corp:  " $corpNumber
   # to output to fed remove the # from the next line
  # send  $trader[$icnt] " Assigned to corp:  " $corpNumber "*"

   add $icnt 1
end

oneAssignments
# remove comment from next line to close fed com if output to there
# send "*"


(Format is messed up here)

ex 1:
Ppp         &nb sp;         &nb sp;        Assigned to corp: 4
DarkHelmet        &n bsp;         &n bsp;  Assigned to corp: 2
quotes                             Assigned to corp: 4
Fork         &n bsp;         &n bsp;       Assigned to corp: 1
Wolfen                             Assigned to corp: 2
fujidude        &nbs p;         &nbs p;   Assigned to corp: 4
-= Geek Assasin =-         &nbs p;   Assigned to corp: 5
Kane         &n bsp;         &n bsp;       Assigned to corp: 5
Titan         & nbsp;         & nbsp;      Assigned to corp: 5
Red Knight          &nbs p;         &nbs p;  Assigned to corp: 3
legosoldier        & nbsp;         & nbsp; Assigned to corp: 2
wtf         &nb sp;         &nb sp;        Assigned to corp: 1
123         &nb sp;         &nb sp;        Assigned to corp: 3
456         &nb sp;         &nb sp;        Assigned to corp: 1
dupe         &n bsp;         &n bsp;       Assigned to corp: 3

-------------

ex2

Ppp         &nb sp;         &nb sp;        Assigned to corp: 1
DarkHelmet        &n bsp;         &n bsp;  Assigned to corp: 5
quotes                             Assigned to corp: 4
Fork         &n bsp;         &n bsp;       Assigned to corp: 5
Wolfen                             Assigned to corp: 3
fujidude        &nbs p;         &nbs p;   Assigned to corp: 3
-= Geek Assasin =-         &nbs p;   Assigned to corp: 1
Kane         &n bsp;         &n bsp;       Assigned to corp: 2
Titan         & nbsp;         & nbsp;      Assigned to corp: 4
Red Knight          &nbs p;         &nbs p;  Assigned to corp: 2
legosoldier        & nbsp;         & nbsp; Assigned to corp: 5
wtf         &nb sp;         &nb sp;        Assigned to corp: 1
123         &nb sp;         &nb sp;        Assigned to corp: 3
456         &nb sp;         &nb sp;        Assigned to corp: 2
dupe         &n bsp;         &n bsp;       Assigned to corp: 4

Author:  PhoieX [ Sun Feb 11, 2007 3:11 am ]
Post subject: 

LOL never thought I would use this script, but I am. Thanks so much man, nice nice

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/