Sign in to follow this  
Followers 0

Beta code snippets

1 post in this topic

Posted

Here is some snips of code I started working on for fishing.... this is just for reference.... I can't explain it :P It MIGHT be useful though...

ONE VERSION

rand=random number from 1 to 100

runningTotal=0

select case tiletype

case freshNormal

fish(0)="15|FRESHNORM_Large_Mouth_Bass"

fish(1)="16|FRESHNORM_Carp"

fish(2)="17|FRESHNORM_Small_Mouth_Bass"

case freshShallow

fish(0)="18|FRESHSHAL_Perch"

fish(1)="19|FRESHSHAL_Black_Bass"

fish(2)="17|FRESHSHAL_Small_Mouth_Bass"

fish(3)="20|FRESHSHAL_Crappie"

case riverSlow

fish(0)="21|RIVERSLOW_Catfish"

fish(1)="22|RIVERSLOW_Sandbass"

fish(2)="23|RIVERSLOW_Piranha"

case riverFast

fish(0)="24|RIVERFAST_Salmon"

fish(1)="25|RIVERFAST_Trout"

case seaNormal

fish(0)="26|SEANORMAL_Red_Snapper"

fish(1)="27|SEANORMAL_Tuna"

fish(2)="28|SEANORMAL_Swordfish"

fish(3)="29|SEANORMAL_Eel"

fish(4)="30|SEANORMAL_Shark"

WHILE thisFishName="" AND fishIndex<=uBound(fish)

if rand<=(fish(fishIndex)+runningTotal) then

thisFishName=mid(fish(fishIndex),3)

thisFishID=left(fish(fishIndex),2)

end if

fishIndex=fishIndex+1

WEND

select case tiletype

case freshNormal

fish(0)="15|FRESHNORM_Large_Mouth_Bass"

fish(1)="16|FRESHNORM_Carp"

fish(2)="17|FRESHNORM_Small_Mouth_Bass"

case freshShallow

fish(0)="18|FRESHSHAL_Perch"

fish(1)="19|FRESHSHAL_Black_Bass"

fish(2)="17|FRESHSHAL_Small_Mouth_Bass"

fish(3)="20|FRESHSHAL_Crappie"

case riverSlow

fish(0)="21|RIVERSLOW_Catfish"

fish(1)="22|RIVERSLOW_Sandbass"

fish(2)="23|RIVERSLOW_Piranha"

case riverFast

fish(0)="24|RIVERFAST_Salmon"

fish(1)="25|RIVERFAST_Trout"

case seaNormal

fish(0)="26|SEANORMAL_Red_Snapper"

fish(1)="27|SEANORMAL_Tuna"

fish(2)="28|SEANORMAL_Swordfish"

fish(3)="29|SEANORMAL_Eel"

fish(4)="30|SEANORMAL_Shark"

WHILE thisFishName="" AND fishIndex<=uBound(fish)

if rand<=(fish(fishIndex)+runningTotal) then

thisFishName=mid(fish(fishIndex),3)

thisFishID=left(fish(fishIndex),2)

end if

fishIndex=fishIndex+1

WEND

ANOTHER VERSION:

randNum=int(100*rnd)+1

runningTotal=0

fishIndex=0

tiletype="freshNormal"

dim fish(4) 'highest value possible

select case tiletype

case "freshNormal"

fish(0)="15|FRESHNORM_Large_Mouth_Bass"

fish(1)="16|FRESHNORM_Carp"

fish(2)="17|FRESHNORM_Small_Mouth_Bass"

case "freshShallow"

fish(0)="18|FRESHSHAL_Perch"

fish(1)="19|FRESHSHAL_Black_Bass"

fish(2)="17|FRESHSHAL_Small_Mouth_Bass"

fish(3)="20|FRESHSHAL_Crappie"

case "riverSlow"

fish(0)="21|RIVERSLOW_Catfish"

fish(1)="22|RIVERSLOW_Sandbass"

fish(2)="23|RIVERSLOW_Piranha"

case "riverFast"

fish(0)="24|RIVERFAST_Salmon"

fish(1)="25|RIVERFAST_Trout"

case "seaNormal"

fish(0)="26|SEANORMAL_Red_Snapper"

fish(1)="27|SEANORMAL_Tuna"

fish(2)="28|SEANORMAL_Swordfish"

fish(3)="29|SEANORMAL_Eel"

fish(4)="30|SEANORMAL_Shark"

End Select

WHILE (thisFishName="" AND fishIndex<=uBound(fish))

'call playermsg(index,"hi:" & GetVar("FISHtypes.ini","DEFAULT",mid(fish(fishIndex),4)),15)

'thisFish=cint(GetVar("FISHtypes.ini","DEFAULT",mid(fish(fishIndex),4)))

'thisfish=33

if randNum<=(thisFish+runningTotal) then

thisFishName=mid(fish(fishIndex),4)

thisFishID=left(fish(fishIndex),3)

end if

runningTotal=runningTotal+cint(thisFish)

fishIndex=fishIndex+1

WEND

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.