Aug. 19, 2018

Hello der,  Guest
Trader Name:
Password:
 | Home | Forum List | Active Threads | Search:
Page: of 1   
Script Feedback > Is any interested in a subroutine to randomly sele  
<< Thread >>
Subscribed:  
Maniac

Joined: Apr 2005

posted: 02/10/2008 at 10:52 PM Post #1

Title says most of what I want....

Is there any interest in having a randomly selected refurb port?
I say this as if someone knows your using ALPHA_CENTAURI and waits for you to furb here they can possibly #SD# you while your running turbosst.  My solution is to randomly select from the known Class 0's which port you are gonna refurb at.
I know a determined player can still #SD# ya if they have the patience while you're running Turbo but this might just be what causes the same player to say F*** it I'm not waiting till they furb here, I have better things to do.

I am willing to make the subroutine available to anyone that wants it provided they don't bitch about how they got killed while someone with more patience decided that they could take out a casher.

I am a "shade tree" programmer... my stuff works but is not documented so a newbie could understand it, error checks are for newbies.... if I can make a script that save 5-10 lines of code and a corresponding amount of milliseconds sending a string to the server without being 100% sure that it is the correct string, I'm gonna send the string and not bother with making sure it is not ID10T proof. 

I may be in the minority here but the problem I have had with my scripting is exactly that.  I can't ID10T proof much of anything, I know what the chances of an error could be and I choose to take the risk that it won't get me #SD#'d, and if it does I look at the minimum amount of work that has to go into making the script safe.  Call me lazy but there was a reason that C was so much faster than BASIC in the early days of programming.  C did not waste CPU cycles checking that you did not over run the bounds of your array, or string or whatever.... You the programmer was given enough rope to shoot yourself in the foot.  I am an old timer that was "trained" in programming back when Dos 3.1 was considered l33t and if you had 4M of memory you had a beauty of a machine.

I work nights so my ICQ time is gonna be inconvenient for most but I will try to answer any questions.

Damn I really don't want to do this but my ICQ is 269182730.  Now you've done it made me forever vulnerable to each and every worm/virus/spam bot out there.

Thanks for listening to an old man who wants people to "get off my lawn"
LoneStar


Joined: Jul 2006

posted: 02/11/2008 at 10:44 AM Post #2

I think  Furb routine that checks to see if the Furb Port(s) have been blown up before attempting to Dock would save a few more lives ;)

The Joker's Always Smiling in Every Hand That's De
ElderProphet
TWX Development Team

Joined: Mar 2005

posted: 02/16/2008 at 06:35 PM Post #3

Post it, you old cuss, they know the risks :P

I'm curious though, how exactly can you shoot yourself in the foot with a rope?

+EP+

edited by: ElderProphet on 02/16/2008 at 06:36 PM

Haggle Blog-> http://jroller.com/page/ElderProphet
Maniac

Joined: Apr 2005

posted: 02/17/2008 at 04:45 PM Post #4

###### Setup Furb Port ########
  gosub :RandomFurbPort
  gosub :GetRandom
##############################

put the above commands between the comments right after the
if ($Method = 0)
    setVar $Method E
  end

and put the following at the end of the file
BEFORE the command/line "include include/warp"


:RandomFurbPort
if ($Refurb=0) or ($Refurb3=0)
setvar $Refurb0 1
setvar $Refurb3 STARDOCK
SaveVar $Refurb0
SaveVar $Refurb3
#ClientMessage "NOT saved " & $Refurb0 & " " & $Refurb3
end

if ($Refurb1=0) and (ALPHACENTAURI <> 0)
    setvar $Refurb1 ALPHACENTAURI
    savevar $Refurb1
    #ClientMessage "NOT saved" &" " & $Refurb1
  end
if ($Refurb2= 0) and (RYLOS <> 0)
  Setvar $Refurb2 RYLOS
  SaveVar $Refurb2
    #ClientMessage "NOT saved" &" " & $Refurb2
end

:GetRandom
#if($Class[0] <> 0 and $Class[3] <> 0) or $Class[1] <> 0 and $Class[2] <> 0)
#goto :getrand
#else
setvar $Class[0] $Refurb0
setvar $Class[1] $Refurb1
setvar $Class[2] $Refurb2
setvar $Class[3] $Refurb3
#end
:getrand
getRnd $rnd 0 4
setvar $RefurbPort $Class[$rnd]
if ($RefurbPort = 0)
  setvar $RefurbPort 1
end
#ClientMessage $RefurbPort
return

Like I said my error checking is lacking but what I think this does is check if you have seen the 4 refurb ports and will randomly select one of the ones you have visited. 
If you haven't visited one then you should not go there. 

Elder if you could IM me when we have some time to talk please do.... I am having troubles with SetEventTrigger I can't seem to get it to work the way I think it should.
LoneStar


Joined: Jul 2006

posted: 02/18/2008 at 07:09 AM Post #5

#=================================================
:RandomFurbPort
####  changed ($Refurb=0)  to  ($Refurb0=0)
if ($Refurb0=0) or ($Refurb3=0)
setvar $Refurb0 1
setvar $Refurb3 STARDOCK
SaveVar $Refurb0
SaveVar $Refurb3
end
if ($Refurb1=0) and (ALPHACENTAURI <> 0)
setvar $Refurb1 ALPHACENTAURI
savevar $Refurb1
end
if ($Refurb2=0) and (RYLOS <> 0)
Setvar $Refurb2 RYLOS
SaveVar $Refurb2
end
:GetRandom
setvar $Class[0] $Refurb0
setvar $Class[1] $Refurb1
setvar $Class[2] $Refurb2
setvar $Class[3] $Refurb3
#end
:getrand
####  there's no array element '4' so must be 0 to 3 since your
####  array is zero-based
getRnd $rnd 0 3
setvar $RefurbPort $Class[$rnd]
if ($RefurbPort = 0)
setvar $RefurbPort 1
end
return
#=================================================
made a couple corrections for ya.  I would suggest that you make this routine one Subroutine, and have it generate the list of known Class0 ports every time it's called..  if the user stumbles upon an unkown Class0 it then can be added into the random-pool.

I noticed that you use SaveVar, but not LoadVar...



edited by: LoneStar on 02/18/2008 at 07:13 AM

The Joker's Always Smiling in Every Hand That's De
phx


Joined: Mar 2005

posted: 06/25/2009 at 08:45 PM Post #6

I realize this is a year old thread but I haven't been around in a long time and just read it. heh .I just wondered why ya need so much complicated code with array's and crap to do a simple thing?

:getClass0
getrnd $class0 1 4
if ($class0 = 1)
setvar $class0 1
elseif ($class0 = 2)
setvar $class0 stardock
elseif ($class0 = 3) and (rylos <> "")
setvar $class0 rylos
elseif ($class0 = 3) and (rylos = "")
goto :getClass0
elseif ($class0 = 4) and (alphacentauri <> "")
setvar $class0 alphacentauri
elseif ($class0 = 4) and (alphacentauri = "")
goto :getClass0
end
return

edited by: phx on 06/25/2009 at 08:47 PM
Script Feedback >  Is any interested in a subroutine to randomly sele
<< Thread >>
Subscribed:  
 | Home | Forum List | Active Threads | Search:
Page: of 1   

"why hello der matey! have a sit and buy me an ale, eh?" -- The Grimy Old Trader

The Grimy Trader is best viewed at 1024x768 resolution -- this page was generated in: 0.344 seconds.