|
Post by Rod on Mar 8, 2021 10:43:02 GMT
I don't think there is a hidden file. There is the .ini file that remembers your choices for the IDE but that is not really hidden it's just protected.
|
|
|
Post by Enzo on Mar 8, 2021 11:01:32 GMT
Hmm why does it call a bmp file that no longer exists in code or harddrive?
|
|
|
Post by Rod on Mar 8, 2021 17:03:19 GMT
If you can find the error.log we can get a little closer to the problem. I don't think there are any hidden files involved just a bug in the code.
|
|
|
Post by Enzo on Mar 8, 2021 18:05:32 GMT
Hmm, I will repost with error file, ive used CTRL-F and could not find the file called out in code.
|
|
|
Post by Enzo on Apr 8, 2021 1:26:33 GMT
Current build: www.file.io/download/3u6Tw0AjeMGBHaving trouble with itempickup() function, crashes on player.x, player.y = 1 trying to equal 0, unlimited loop currently.
|
|
|
Post by Enzo on Apr 29, 2021 0:14:52 GMT
Massive update, 500+ 'top tier' swords/wands/staffs added to sprite library, some coding functions written, yet to actually add anything to code. Will be the next project after I handle some things
|
|
|
Post by Enzo on May 11, 2021 14:10:13 GMT
Do you think a rotate map and sprite for rotating the view point will lag gameplay? I know a step -1 can be used for up to down rotation but what about left and right?
Basically all map info is on array 500 x 500 1x1= top left
Obviously once the rotation is done a rotate 90 or 180 is needed for display sprites this can be turned on with a switch variable, also at this point a buffer XY array if anything is "off", not even sure if it wouldn't line up properly already, I will need to relabel each array in loop, then reload gameplay and apply loop structure to other related arrays, mapitems( ect.
right 1x1 500,1 1x2 500,2
left 1x1 500,500 1x2 ect.
So basically step -1 loop from 501 and count a variable to indicate original
|
|
|
Post by Rod on May 12, 2021 14:35:14 GMT
Not sure I understand just yet. If you take my recent tile mapping example the map did not rotate at all. The sprite rotated and moved in any direction but the map always pointed North. I would think that only position and direction are exchanged. All of the mapping will be handled on the client, so only a few position,decision,outcome details are exchanged and each client then maps or reacts to those changes. So if you are in a room and another person enters that room the client is told but it is up to the client to show and display the newcomer imagery, it would not pass over the internet.
|
|
|
Post by Enzo on May 12, 2021 17:26:00 GMT
To add "Depth" to game; a map rotate for allowing map to NOT always face North, so npcs, characters, sprites need to be updated after map array is loaded say facing East,
I am going to load a smaller map 10x15 and try to rotate it when the time comes with preloading arrays, map(10,15), mapWest(10,15), mapSouth(10,15), mapobjectXfacingwest(10,15), ect.
Other then adding toggles to different directions with if then or select cases to call up correct rotation.
|
|
|
Post by Enzo on May 22, 2021 10:57:51 GMT
Adding update soon, item pickup works, console msg system, which are the basics for item finding quests, working on melee combat and adding npcs and animations, currently can load 2 clients worth of on 60MB of ram, still hoping for at least 30 users a dungeon on 4GB machine with file server, I wonder if I put a buffer in for sprite loads to only keep sprites in memory using and unload the rest, sure it will add some lag when loading maybe 20ms, but to prevent a sprite DLL already in use error I can create a directory for each client, and hopefully get more then 30 clients ? Around 50 as long as buffer doesn't max out on all clients for overflow
|
|
atomose
Member in Training
Posts: 32
|
Post by atomose on May 22, 2021 20:04:42 GMT
hi,
can you re-upload your file ? i cant download it from the link :S
|
|
|
Post by Enzo on May 24, 2021 3:27:22 GMT
'Luck is a constant variable controlled meter feature in the game that actual button skill is required for before the rest. refering to combat, Skill level is achieved with 'Accuracy on a gain metered scale you can lose you skill level at any time.
'r]pg game base by Enzo | A|ways Missing
'study the code to learn how to play\
'dev global playerfile$, downloadfile$, PID, myPID, x, y, player.x, player.y, yes, debug, startup, frames, PIDid, command$, commandtype$, inputcommand$, playercount,_ playerpos$, ms, luck, buffer, null, map.x, map.y, screen.x, screen.y, TILESIZE, OFFSET, loopx, time, fps, base10, debugnull,_ set, playeraccuracy, skill, luck, health, currentplayercount, frames, timerstatement, timestatement, time1, time2,_ loopcount, id, clickms, npc.n, spi, obj, tile.list$, i, L, map.width, map.height, SCREENWIDTH, SCREENHEIGHT, GAMEWIDTH, GAMEHIEGHT 'spi=id of directional player graphic
global TileX, TileY, TileXY$,_ Bankspace, currentbankcount, inventory, selected,_ mana, magicklevel, specialbar, specialtimer, attacktime, defendtimer,_ lastselected$,selecteditem$, selected$, action$,_ attack, defend, attacktimer, defendtimer, defend1, defend2, attacktime1, attacktime2,_ combines, combinations, shipid global mapX, mapY, totalitems, objcount, div, clientcount, ram, itemid ram = 750 clientcount = 10 'number of max clients mapX=ram:mapY=ram:totalitems=10:objcount=10:div=2:lag=100:clientcount=1:base10=10 '5 sprites of 10 images each '/dev map.width = 500 map.height = 500 player.x =6 player.y= 5 global sailing, boat sailing = 2 boat = 1
dim sea(ram,ram)
dim npc.x(ram) dim npc.y(ram) dim old.npc.x(ram) dim old.npc.y(ram) dim map$(mapX,mapY)
dim obj.sprite.name$(1000) dim obj.bmp.name$(1000)
dim weapon(100,2) '1- special amount type 2-weapontiming weapon(1,1)=1 'regular timing per diem; special weapon(1,2)=250 'quarter of second, 1/4th
weapon(2,1)=7 'warlord mask [endgame] weapon(2,2)=575 'slow max hit weapon, bonus; instant
dim weapontimes(20) weapontimes(6)=10'magic weapontimes(1)=15 'dagger weapontimes(2)=20 'longsword weapontimes(3)=25'sword weapontimes(4)=30'2h weapontimes(5)=40'2h
dim mapactivate(ram,ram) dim msgs$(7199)'game msgs=quests dim questrandom$(1000,1)
dim obj.x(ram) dim obj.y(ram) obj.n = ram
'building tree rocks 'obj.x(3)=21 'obj.y(3)=12 'obj.bmp.name$(3)= "object2.bmp" 'obj.sprite.name$(3)= "object2"
dim logx(100) 'set log for now = 1 to 100 logx(now) = 1 next now
dim attacktime(5) 'attack rythm medium, short, long, mid, very short, medium, short, long, mid, ect. attacktime(1)=15 attacktime(2)=-10 attacktime(3)=20 attacktime(4)=10 attacktime(5)=-20
dim mapobjectX(mapX, obj.n) dim mapobjectY(mapY, obj.n)
dim item(ram,ram) dim item(totalitems,3) '1 =unsed/id 2=type 3=unsed/unique id for trading dim itemdisplay(totalitems, 2) dim item.x(ram) dim item.y(ram) dim npchealth(750,750)
dim inventory(8) dim bank(10)
dim specialattack(7)
dim playerfiles$(clientcount, 4) '1=health, 3=hit, 2=npc 4=character[one]id graphic combo code/id *attire amulets swords ; ect.
waitload = 1 shipid = 1 'developer info // myPID = 1 ms = 30 'for timerloop (1000/ms) frames = 10 'desired fps; actual fps may very use 'display() = fps()' function to find fps
'\\ basic debug/building data delete on alpha combinations = 10 'item combines, to new itemid here=item(itemid,2) npcname$ = "player.bmp"' add to keys after playeraccuracy = 10' 1 - 10 low-high skill = .9 ' .5 - .9 high level, .10 - .40 low level luck = .9 '.01-.99 seconds = 3 'desired debug run amount in seconds of 10 frames a second
health = 100
player(1,2) = health player(2,2) = health'input from file on server-client 'function for loading health from playerfiles
null = 0 'set 00000000 byte null = null 'renull
'id = 2 'set max hit calculated by point system divided '\\ end developer info
'set = skill * 7 'unsed
'// /dev
'debug tile.list$ = " dirt water grass rock sand "
buffer = 10 'ms buffer to bad loop yes = 1 '1 operator for debug startup = 1
goto [skipDebug]
[INFO] 'working on basically loading final bmps, server login startup,, animations, useless debug data; for geeks and the actual filesystem format for the server itself [DATA] 'add player bmps weapon gfx, ect., login, server data exchange, animations, debug timing variable file,save on exit
[debugdata] ' debug(debug$) at bottom of code, select case debug$ confirm "debug = 1 (yes)?";answer$ if answer$ = "yes" then debugnull = 1 end if
if debugnull < null then NOMAINWIN end if '// / debug [skipDebug]
NOMAINWIN'
TILESIZE = 64 : SCREENWIDTH = 11 : SCREENHEIGHT = 8 : OFFSET = TILESIZE GAMEWIDTH = SCREENWIDTH*TILESIZE-TILESIZE*2+64 GAMEHEIGHT = SCREENHEIGHT*TILESIZE-TILESIZE*2 WindowWidth = GAMEWIDTH : WindowHeight = GAMEHEIGHT+80 : BackgroundColor$ = "BLACK"
UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2) graphicbox #main.gbx, 0, 0,GAMEWIDTH , GAMEHEIGHT textbox #main.textbox, 14, 400, 352, 25 open "Sailing beta 2.2" for window_nf as #main
print #main.textbox, "!disable" print #main.textbox, "0%" #main.gbx "down; fill BLACK; flush" #main "trapclose [quit.main]" '#main.gbx "When characterInput" #main.gbx "Getbmp empty.bmp 1 1 ";TILESIZE;" ";TILESIZE*2
[ADDTILES]'setup data edit to add .bmp's tile.list$ = "dirt water grass rock sand" For i = 1 To 5 loadbmp left$(word$(tile.list$,i),1);".bmp", DefaultDir$+"\tiles\";word$(tile.list$,i);".bmp" #main.gbx "drawbmp ";left$(word$(tile.list$,i),1);".bmp 1 ";TILESIZE+1;" ; ";_ "Getbmp ";left$(word$(tile.list$,i),1);".bmp 1 1 ";TILESIZE;" ";TILESIZE*2 Next
#main.gbx "down; fill black"
playwave DefaultDir$+"\intro\preintro.wav", async
OPEN DefaultDir$+"\DATA\mapdata1.txt" For input AS #mapfile
While not(eof(#mapfile)) line input #mapfile, itemdata$ ' nn=nn+1 'print #main.textbox, nn id$=trim$(itemdata$) if left$(id$,1)<>"'" and id$<>"" Then Select case case instr(id$,"width") map.width = val( trim$(word$(id$,2,"="))) case instr(id$,"height") map.height = val( trim$(word$(id$,2,"=")))-250 case instr(id$,"playerX") player.x = val( trim$(word$(id$,2,"="))) case instr(id$,"playerY") player.y = val( trim$(word$(id$,2,"="))) case instr(id$,"others") npc.n = val( trim$(word$(id$,2,"="))) IF npc.n>0 Then DIM npc.x(npc.n),npc.y(npc.n) DIM old.npc.x(npc.n),old.npc.y(npc.n) For L = 1 To npc.n line input #mapfile, id$ npc.sprite.name$(L) = WORD$(id$,1,";") npc.bmp.name$(L) = WORD$(id$,2,";") npc.x(L) = val(TRIM$(WORD$(id$,3,";"))) npc.y(L) = val(TRIM$(WORD$(id$,4,";"))) old.npc.x(L) = npc.x(L): old.npc.y(L) = npc.y(L) 'PRINT npc.bmp.name$ Next L End if close #mapfile 'goto [r]
' DIM map$(map.width,map.height) ' ' print map.width, map.height ' For y = 1 To map.height ' ' For x = 1 To map.width ' ' print x, id$ ' map$(x,y) = TRIM$(word$(id$,x,",")) ' " " ' 'PRINT map$(x,y) ' Next ' line input #mapfile, id$ ' if instr(id$,"END") Then exit FOR ' Next ' close #mapfile ' notice "" goto [r] end select End if Wend close #mapfile [r] print #main.textbox, "1%" open DefaultDir$+"\DATA\mapxy.txt" for input as #file map$=input$(#file,lof(#file)) for x = 1 to 503 for y = 1 to 731
var = var + 1
s$ = mid$(map$, var, 1) ' b$ = select$(s$) if s$ <> " " then xx=xx+1 if xx = 501 then xx = 0 var = var + 2 yy = yy + 1 end if else 'notice "" yy = yy + 1 end if
map$(xx,yy) = s$ next y print #main.textbox, "Loading PREFETCH:";int(var/4000);"%"
next x
close #file
timer 50, [preintro] wait [preintro] timer 0 loadbmp "gif1.bmp", DefaultDir$+"\intro\gif1.bmp" #main.gbx "drawbmp gif1.bmp 50 50"
timer 300*waitload, [5] wait
[5] timer 0 loadbmp "gif2.bmp", DefaultDir$+"\intro\gif2.bmp" #main.gbx "drawbmp gif2.bmp 50 50"
timer 600*waitload, [intro] wait [intro] timer 0 'play midi timer 400*waitload, [loadscreen0ff] wait [loadscreen0ff] timer 0
print #main.textbox, "98%" loadbmp "data2.bmp", DefaultDir$+"\intro\data2.bmp" #main.gbx "drawbmp data2.bmp 50 50"
timer 105*loadwait, [puesdotimer0s]
wait
[puesdotimer0s] timer 0 [loadscreen0s]
loadbmp "gif4.bmp", DefaultDir$+"\intro\gif4.bmp" #main.gbx "drawbmp gif4.bmp 50 50"
timer 205*waitload, [puesdotimer0a]
wait
[puesdotimer0a] timer 0 playwave ""
'print #main.gbx, "spritexy gfx 0 0"
[loadscreen00000]
loadbmp "gif6.bmp",DefaultDir$+"\intro\gif6.bmp" #main.gbx "drawbmp gif6.bmp 50 50"
#main.gbx "down; fill black" timer 200*waitload, [puesdotimera]
wait
[puesdotimera] timer 0 playwave DefaultDir$+"\intro\intro.wav", async [loadscreen0]
#main.gbx "cls"
timer 200*waitload, [puesdotimer0]
wait
[puesdotimer0] timer 0 loadbmp "start004.bmp",DefaultDir$+"\intro\start004.bmp" #main.gbx "drawbmp start004.bmp 124 40"
timer 205*waitload, [puesdotimer]
wait
[puesdotimer] timer 0 #main.gbx "down; fill black"
loadbmp "start003.bmp", DefaultDir$+"\intro\start003.bmp" #main.gbx "drawbmp start003.bmp 0 0"
timer 700*waitload, [puesdotimer2]
wait
'more gfx
[puesdotimer2] timer 0 [puesdotimer3]
print #main.textbox, "99%" loadbmp "start002.bmp",DefaultDir$+"\intro\start002.bmp" #main.gbx "drawbmp start002.bmp 0 0"
[PLAYERBMPLIST]
loadbmp "player1.bmp", DefaultDir$+"\char\player1.bmp" loadbmp "player2.bmp", DefaultDir$+"\char\player2.bmp" loadbmp "player3.bmp", DefaultDir$+"\char\player2.bmp" loadbmp "player4.bmp", DefaultDir$+"\char\player4.bmp" loadbmp "player5.bmp", DefaultDir$+"\char\player5.bmp" loadbmp "player6.bmp", DefaultDir$+"\char\player6.bmp" loadbmp "player7.bmp", DefaultDir$+"\char\player7.bmp" loadbmp "player8.bmp", DefaultDir$+"\char\player8.bmp"
[CONTROL] #main.gbx "setfocus;" ;_ "When characterInput [keys]; ";_ "fill black;" ;_ "DRAWSPRITES" room = 1
print #main.textbox, "70%" ' goto [6] [LOADMAP]
'#main.gbx, "spritexy
print #main.textbox, "99.9%" [MAPDATARAM] ' 10 * 7 DIM tile(SCREENWIDTH*SCREENHEIGHT,2) for h = 1 To SCREENHEIGHT for w = 1 To SCREENWIDTH obj=obj+1 #main.gbx "addsprite obj";obj;" empty.bmp d.bmp w.bmp g.bmp r.bmp s.bmp" tile(obj,1)=w tile(obj,2)=h next:next 'room= 1 print #main.textbox, "99.99%" [ADDPLAYERSPRITE] #main.gbx "addsprite player player1.bmp player2.bmp player3.bmp";_ " player4.bmp player5.bmp player6.bmp player7.bmp player8.bmp;";_ "spritexy player ";player.x*TILESIZE-TILESIZE-OFFSET;" ";player.y*TILESIZE-TILESIZE-OFFSET
[setupnpc] npc.n = 1 npc.bmp.name$(1) = "player9.bmp" npc.sprite.name$(1) = "king" npc.x(1)= 14 npc.y(1)= 14
' npc.bmp.name$(2) = ".bmp" ' npc.sprite.name$(2) = ""
' npc.bmp.name$(3) = ".bmp" ' npc.sprite.name$(3) = ""
[NPC]'npc.n controls output of loops to new entry if npc.n Then For L = 1 To npc.n loadbmp npc.bmp.name$(L), DefaultDir$+"\char\";npc.bmp.name$(L) #main.gbx "addsprite ";npc.sprite.name$(L);" ";npc.bmp.name$(L) '#main.gbx "spritexy ";npc.sprite.name$(L);" ";npc.x(L)*TILESIZE-TILESIZE-OFFSET;_ ' " ";npc.y(L)*TILESIZE-TILESIZE-OFFSET Next End if [addweapon] null=null '#main.gbx "addsprite wgfx wgx1.bmp wgfx.bmp wgfx3.bmp";_ ' " wgfx4.bmp wgfx5.bmp wgfx6.bmp wgfx7.bmp wgfx8.bmp ;";_ ' ' "spritexy wgfx ";player.x*TILESIZE-TILESIZE-OFFSET;" ";player.y*TILESIZE-TILESIZE-OFFSET ' [items]'inventory map item sprites load itemid=0 'itemid starts at 1000 for itemload = 1 to item.n itemid = itemid +1 item.bmp.name$(itemid)=str$(itemid);".bmp" item.sprite.name$(itemid)= str$(itemid) next itemload 'example 'item.bmp.name$(2)= "51.bmp" 'item.sprite.name$(2)= "51"
'manual placement item.x(1)=3 item.y(1) =3 item.x(2)=4 item.y(2) =4
dim inventoryid(10) dim quest$(750,750) item.n=0 'update variable if item.n Then For L = 1 To item.n loadbmp item.bmp.name$(L),DefaultDir$+"\items\";item.bmp.name$(L) #main.gbx "addsprite ";item.sprite.name$(L);" ";item.bmp.name$(L) '#main.gbx "spritexy ";item.sprite.name$(L);" ";item.x(L)*TILESIZE-TILESIZE-OFFSET;_ '" ";item.y(L)*TILESIZE-TILESIZE-OFFSET Next End if
playwave "" playwave DefaultDir$+"\intro\music.wav", async print #main.textbox, "100%"
[obj]'object loader
objid = 100 '100-999 objects universal gameid ref 'for loadobj = 1 to obj.n ' objid=objid+1 'obj.bmp.name$(itemid)="A";str$(itemid);".bmp" 'obj.sprite.name$(itemid)= str$(itemid) 'next loadobj
'example obj.bmp.name$(1)="alwaysalways.bmp" obj.sprite.name$(1)= "object1"
obj.bmp.name$(2)= "pirate.bmp" obj.sprite.name$(2)= "object2" obj.bmp.name$(3)= "piratel.bmp" obj.sprite.name$(3)= "object3" obj.bmp.name$(4)= "pirater.bmp" obj.sprite.name$(4)= "object4" obj.bmp.name$(5)= "pirated.bmp" obj.sprite.name$(5)= "object5" obj.bmp.name$(6)="outline.bmp" obj.sprite.name$(6)="object6"
obj.bmp.name$(7)="abc.bmp" obj.sprite.name$(7)="object7"
obj.bmp.name$(8)="healthbar12.bmp" obj.sprite.name$(8)="object8" obj.bmp.name$(9)="healthbar25.bmp" obj.sprite.name$(9)="object9" obj.bmp.name$(10)="healthbar50.bmp" obj.sprite.name$(10)="object10" obj.bmp.name$(11)="healthbar75.bmp" obj.sprite.name$(11)="object11" obj.bmp.name$(12)="healthbar100.bmp" obj.sprite.name$(12)="object12"
obj.bmp.name$(13)="special0.bmp" obj.sprite.name$(13)="object13" obj.bmp.name$(14)="special25.bmp" obj.sprite.name$(14)="object14" obj.bmp.name$(15)="special50.bmp" obj.sprite.name$(15)="object15" obj.bmp.name$(16)="special75.bmp" obj.sprite.name$(16)="object16" obj.bmp.name$(17)="special100.bmp" obj.sprite.name$(17)="object17"
obj.bmp.name$(18)="mickey.bmp" obj.sprite.name$(18)="object18" obj.bmp.name$(19)="lemon.bmp" obj.sprite.name$(19)="object19"
obj.bmp.name$(20)="pumpkin005.bmp" obj.sprite.name$(20)="object20"
'null ' obj.bmp.name$(0)=".bmp" ' obj.sprite.name$(0)="object"
'manual placement input
msgs$(1)="Excuse me, traveler. Please, help me out. Grab my book, it is just down to the right around south 14 east 13, Hero, I need you to go out there and disrupt their activities destroy thei... do whatever it takes to stop those wretched miscreants merchants. It'll be dangerous, but I'm willing to come along if you need me to. wish I could pay you far more than I can, but what I can pay isn't less than what's less either. Best of luck hero, arrrgh. (you realize the unnamed King is drunk and talking to you)"
obj.x(1)=13 obj.y(1) =14 quest$(13,14) ="1"
obj.x(20)=10 obj.y(20)= 10 quest$(10,10)="2"
'null 'obj.x()= 'obj.y()= 'quest$(,)=""
obj.x(2)=500 obj.y(2) =500
obj.x(3)=490 obj.y(3) =500
obj.x(4)=480 obj.y(4) =500
obj.x(5)=500 obj.y(5) =480
obj.x(6)=470 obj.y(6) =500
'gui obj.x(7)=2 obj.y(7) =4
'item pickup obj.x(19)=13 obj.y(19)=13
for n=8 to 18 obj.x(n)=100 obj.y(n) =100 next n
' mapobjectX( ' mapobjectY( mapobjectX(13,1)=1 mapobjectY(14,1)=1 '=object id mapobjectX(13,19)=19 mapobjectY(13,19)=19
obj.n=20 if obj.n Then For L = 1 To obj.n loadbmp obj.bmp.name$(L), DefaultDir$+"\items\";obj.bmp.name$(L) #main.gbx "addsprite ";obj.sprite.name$(L);" ";obj.bmp.name$(L) '#main.gbx "spritexy ";obj.sprite.name$(L);" ";obj.x(L)*TILESIZE-TILESIZE-OFFSET;_ '" ";obj.y(L)*TILESIZE-TILESIZE-OFFSET Next End if print #main.textbox, "100%" loadbmp "start001.bmp",DefaultDir$+"\intro\start001.bmp" #main.gbx "drawbmp start001.bmp 0 0"
timer 92*waitload, [puesdotimer4]
print #main.textbox, "DONE%"
wait
[puesdotimer4] timer 0
for i = 1 to 2 unloadbmp "gif";i;".bmp" next i
for i = 4 to 5 if i = 5 then i = 6 end if unloadbmp "gif";i;".bmp" next i for i = 1 to 4 unloadbmp "start00";i;".bmp" next i 'for i = 1 to 4
'next i unloadbmp "data2.bmp"
gosub [fillseafloor] print #main.textbox, "" print #main.textbox, "!enable"
[debug]
room = 1 timer 180*waitload, [reDo]
wait
'[debugdata] INFO ONLY NOT A BRANCH FOR REF '[timer] ' timer 100, [reDo] 'wait 'first pause here ' #main.gbx "When characterInput" 'debug=1000: debug=debug(debug) ' debug = 3:debug = debug(debug) 'drawing once every 237ms 'printf = fps(fps,time1,loopx)
'load data here from server 'time1 = time$("ms")
'debug 'timer 'time2 = time$("ms") 'timestatement = limiter(time2,time1,ms,buffer,timestatement) 'debug = 5:debug = debug(debug) 'debug = 4:debug = debug(debug) start = 1 [reDo] timer 0
[branch] [loop]
#main.gbx "When characterInput"
print #main.textbox, sailingmsg$ if activatebutton = 1 then 'notice "1" mapactivate = 1 activatebutton = 0
end if draw=health(health)
if mapactivate = 2 then 'Button for pressing through dialog with npcs sailingmsg$ = "" mapactivate = 0 end if
'renew=serverexchange(serverdata)' draw$ = inventorygui$(object$) draw = specialbargui(special) 'draw = animations() if sailingmsg$ = " Do you have ship in bottle?" then 'animation ' print #main.gbx, "drawbmp ship1 0 0" ' display=ship(player.x,player.y,shipid) 'else 'animation 'hide=ship(player.x,player.y,shipid) end if 'IF SAILING = 0 THEN
print #main.gbx, "spritexy object6 -60 -60" ' END IF if shimmer > 1 then print #main.gbx, "spritexy object6 -48 -44" shimmer = 0 shimmering = 1 + 1 end if
if shimmering = 5 then shimmer = 0 shimmering = 0 end if
' #main.gbx "spritexy object7 130 50" 'draw gui abc buttons
'draw = display() player.y = player.y + INT(screen.y) map.y = map.y + INT(screen.y) player.x = player.x + INT(screen.x) map.x = map.x + INT(screen.x) pos$ = str$(player.x)+str$(player.y) pos = val(pos$) if abs(screen.y)>=1 Then screen.y = 0 if abs(screen.x)>=1 Then screen.x = 0
if player.x = 3 or player.x = 4 then goto [loop] end if if player.y = 3 or player.y = 4 then goto [loop] end if
if mapactivate = 1 then for objl = 1 to obj.n if mapobjectX(player.x, objl) > 0 then if mapobjectY(player.y, objl) > 0 then itemid = 0 'pickup itemid itemid$=quest$(player.x,player.y) itemid = val(itemid$) itemid$ = "" retur = pickup(selected, playerposx,playerposy, itemid, selecteditem, deleteid, pos,objl) if itemid = 1 then display$ = msg$(itemid, itemid) itemid = 0 end if mapobjectX(player.x, objl) = 0 mapobjectY(player.y, objl) = 0 end if end if next objl mapactivate = 0 end if
parse$ = direction$(player.x,player.x,direction) stringdirection1 = val(word$(parse$,2)) stringdirection2 = val(word$(parse$,3))
for npclook = 1 to npc.n for npclook2 = 1 to npc.n if npc.x(npclook) = stringdirection1 and npc.y(npclook2) = stringdirection2 then attackactivate = 1 end if if npc.x(npclook2) = direction1 and npc.y(npclook) = direction2 then attackactivate = 1 end if next npclook2 next npclook
if attackactivate = 1 then attackactivate = 0 gosub [attacknotimer] end if
[attackreturn] 'if obj.x(l) = player.x obj.y(l) = player.y then 'obj.x(player.x) = 0: obj.y(player.y)=0 'notice "nullremoval" 'poss = 1 'selecteditem = obj.x(player.x) selecteditem = 1 'pickup = pickup(selecteditem,player.x, player.y, selecteditem, deleteid, poss)'
#main.gbx "DRAWSPRITES"
'if mapactivate(player.x,player.y) = 3 then 'type 3- quest notice 'print #main.textbox, "" 'end if 'if mapactivate(player.x,player.y) = 2 then 'cutscene 'print #main.textbox, msgs$(pos) 'display = miniclip()'skillid 'end if
[skip] timer 20, [reDo] ' 1 game tic = ms #main.gbx "When characterInput [keys]"
WAIT
[moveMap] 'credit to cundo ' print #main.textbox, "DEBUG XY:";pos$
if player.x = 3 or player.x = 4 then goto [loop] end if if player.y = 3 or player.y = 4 then goto [loop] end if draw = gui() For i =1 To obj SCAN w = tile(i,1) h = tile(i,2) if walk.val<1 Then #main.gbx "Spritexy obj";i;" ";_ w*TILESIZE-TILESIZE - (screen.x*TILESIZE) - OFFSET; " ";_ h*TILESIZE-TILESIZE - (screen.y*TILESIZE) - OFFSET End if If map.x+w<= map.width AND map.x+w>0 AND _ map.y+h <= map.height AND map.y+h>0 Then #main.gbx "SpriteImage obj";i;" "; trim$( map$(w+map.x,h+map.y));".bmp"
For L=1 to npc.n #main.gbx "spritexy ";npc.sprite.name$(L);" ";_ (npc.x(L)-map.x-screen.x)*TILESIZE-TILESIZE - OFFSET ;" ";_ (npc.y(L)-map.y-screen.y)*TILESIZE-TILESIZE - OFFSET NEXT L
For L=1 to obj.n 'if track(obj.n)=0 then 'obj.n = obj.n+1 'end if #main.gbx "spritexy ";obj.sprite.name$(L);" ";_ (obj.x(L)-map.x-screen.x)*TILESIZE-TILESIZE - OFFSET ;" ";_ (obj.y(L)-map.y-screen.y)*TILESIZE-TILESIZE - OFFSET NEXT L
For L=1 to item.n #main.gbx "spritexy ";item.sprite.name$(L);" ";_ (item.x(L)-map.x-screen.x)*TILESIZE-TILESIZE - OFFSET ;" ";_ (item.y(L)-map.y-screen.y)*TILESIZE-TILESIZE - OFFSET NEXT L Else ' set the tiles to an empty image #main.gbx "SpriteImage obj";i;" empty.bmp"
End if
Next
if map$(player.x,player.y) = "w" then SAILING = 1 goto [animationbase] else SAILING = 0 goto [cont] end if [animationbase]
directionsailing$ = word$(direction$,1)
steptoggle = steptoggle + 1 if steptoggle = 3 then steptoggle = 0 end if
if steptoggle = 2 then
select case directionsailing$
case "UP" 'print #main.gbx, "spriteimage object1 pirate.bmp" print #main.gbx, "spritexy object2 75 73"
case "RIGHT" '90de 'print #main.gbx, "spriteimage object4 pirater.bmp" print #main.gbx, "spritexy object4 124 60"
case "DOWN" '180 'print #main.gbx, "spriteimage object2 pirated.bmp" print #main.gbx, "spritexy object5 106 124"
case "LEFT" '270 'print #main.gbx, "spriteimage object3 piratel.bmp" print #main.gbx, "spritexy object3 150 63"';int(sea$(player.x,player.y)/10) end select
else
select case directionsailing$
case "UP" 'print #main.gbx, "spriteimage object1 pirate.bmp" print #main.gbx, "spritexy object2 70 70"
case "RIGHT" '90de 'print #main.gbx, "spriteimage object4 pirater.bmp" print #main.gbx, "spritexy object4 120 60"
case "DOWN" '180 'print #main.gbx, "spriteimage object2 pirated.bmp" print #main.gbx, "spritexy object5 100 120"
case "LEFT" '270 'print #main.gbx, "spriteimage object3 piratel.bmp" print #main.gbx, "spritexy object3 150 60" end select
end if
[cont]
goto [loop]
[attackloop] 'meter attack to 250ms and weapontiming beginers = 47 if attacktoggle=1 then attacktime2 = time$("ms") attacktoggle = 0 else attacktime1 = time$("ms") attacktimer = attackime1 attacktoggle = 1 end if
if attacktimer-attacktime2 < index(weapon)-50+beginers and attacktimer-attacktime2 > index(weapon)-50+beginers then 'charges special every hit brute = attacktimer - attacktime2 -index(weapon) brute$= str$(brute) brute = val(brute$) end if
callfunction = attack(attacktime, attacktimer, attacktime1, attacktime2, luck)'timer toggle if callfunction = 1 then gosub [attack] callfunction = 0 end if print #main.textbox, hit renew=serverexchange(serverdata)
goto [branch]
[attack] 'need to register luck and skill Timer 0
[attacknotimer] #main.gbx "When characterInput" if specialactivate = 1 then specialactivate=0 specialvariable = brute selections = luck * 1.33 end if if selections < .5 then weapon = 1 end if if selections < .5 and selections > 1 then weapon = 2 end if if selections < 1 then 'luck from .75 up to 2.0+ adds natual max hit possible to weapon to either 5 weapon = 3 end if if weaponchoice > 3 then weapon = 5 end if if weaponchoice > 7 then weapon = 7 'warlord mask end if
select case weapon case 1 'basic input here, 'specialvariable = brute case 2 'rate = 1 specialindex = 25 '+25 max hit constant case 3 rate = 2 specialindex = 15 '+30 max hit possible case 5 rate = 2 specialindex= 20 '+40 max hit possible case 7 'end game item rate = 999 specialindex = 999 end select
rate = 1 'natural additive 'key timing to correct time will give higher hit, same variable for special attack probabilityvariable = ((((brute-40+beginers) + playeraccuracy + luck * base10)+.1)*((.1*specialvariable)-1))+(rate*specialindex)-2'rnd with positive additive of player trained skill, -2 possiblity to add health, evens function
specialvariable = 0 specialindex = 0 variable = probabilityvariable if variable > (base10/2)*1.3 then 'adds bonus if exptionale accurate, directly from the RND for realisitic play hitbonus = 10 + variable '10 point buffer for allowing not to powerful end if ' if variable < 5 then 'see if 50/50 with accuracy added(max up to 1 to 13-29 "i think") gives hit or not ' print "miss" ' end if
debug=101:debug=debug(debug) hit = variable + hitbonus 'basically grabs postive handi capped "55+" RND adds bonus if accuracy is expectionale accurate over 100, to the handicap with a max of unknown, this gives base 55+/45- type RND sets, allowing for a positive gameplay without "sluggish" hits then times this number by your decimcal (skill level * 7) and divides by 3, this part is hard to explain how it linearized RND to be RND still, it just is because the seed is RND, now out of 100 this is not random, there is a positive value frequency to this code as stated before
'add a little 'luck' here players will gain small amount of luck thru out game and its added to a hidden hit value that could "stack" or add up after every hit if hit < 1 then hit = 5*luck*luck end if debug = 8:debug=debug(debug)
functio = weaponattackgfx(weapontiming,weaponofchoice)'gfx for weapon rotate 45 90 degree
'need parse for multi user current npcs only directionofattack = val("66"+direction$) x$=right$(left$(str$(directionofattack),4),2):y$=right$(str$(directionofattack),2) '1-9map non working xnpc = val(x$) : ynpc = val(y$) if npc.x(xnpc ) > 0 and npc.y(ynpc) > 0 then npchealth(npc.x,npc.y)= npchealth(npc.x,npc.y)-hit end if
'return ai attack
return
[defend] 'space bar defendtime = time$("ms") defendvar = defend(defendtimer, defendtime1, defendtime2, luck) if defendtime < defendvar and defendtime > defendvar then blocknexthit = 1 defendvar = 0 defendtime = 0 end if goto [branch]
[keys] 'credit to cundo Timer 0 k$ = Inkey$ keyValue = asc(right$(k$, 1)) walk.val = .5'adds stepped input if noticestep = 1 then notice keyValue end if #main.gbx "When characterInput" 'B
'[right] 'if direction =
'[left] '[down] '[up] select case keyValue case 46' / , attackactivate = 1
case 101 'number 5 for input keyvalue if stepping = 0 then noticestep = 1 stepping = 1 else noticestep = 0 end if
case _VK_DOWN direction = -1 if sailing <> 1 then
if player.y + 1 < map.height Then new.pos$ = map$(player.x,player.y+1) If new.pos$<>"r" and new.pos$ <>"ww" Then 'ww noclip activated screen.y = screen.y + walk.val Else screen.y=0 End if spi = abs(not(spi)) #main.gbx "spriteImage player player";1+spi;".bmp" 'pidid End if end if case _VK_UP direction = 1 if player.y - 1 >0 Then new.pos$ = map$(player.x,player.y-1) If new.pos$<>"r" and new.pos$ <>"ww" Then screen.y = screen.y - walk.val Else screen.y=0 End if spi = abs(not(spi)) is$ = sailing$(new.pos$,direction,player.x,player.y) #main.gbx "spriteImage player player";3+spi;".bmp" 'pidid if sailing = 4 then'4- is$ = sailing$(new.pos$,direction,player.x,player.y) end if End if case _VK_LEFT direction = 5 if player.x - 1 > 0 Then new.pos$ = map$(player.x-1,player.y) If new.pos$<>"r" and new.pos$ <>"ww" Then screen.x = screen.x - walk.val Else screen.x = 0 End if spi = abs(not(spi)) is$ = sailing$(new.pos$,direction,player.x,player.y) #main.gbx "spriteImage player player";5+spi;".bmp" 'pidid if sailing = 4 then 'sailing 4 is new ship id is$ = sailing$(new.pos$,direction,player.x,player.y)'shipid end if End if case _VK_RIGHT direction = -5 if player.x +1 < map.width Then new.pos$ = map$(player.x+1,player.y) If new.pos$<>"r" and new.pos$ <>"ww" Then screen.x = screen.x + walk.val Else screen.x=0 End if spi = abs(not(spi))
is$ = sailing$(new.pos$,direction,player.x,player.y) #main.gbx "spriteImage player player";7+spi;".bmp" 'PIDid if sailing = 4 then '4- is$ = sailing$(new.pos$,direction,player.x,player.y) end if End if case _VK_INSERT mapactivate = 1
case _VK_ESCAPE '[escape] to quit or [trapclose] goto [quit.main]
case 47 'attack [f] [g] keys and space bar special = special - 25 health = health - 25 if health = 0 then health =100 special = 100 end if shimmer = 1 if shimmer = 1 then shimmer = 0 end if 'goto [attackloop] 'case chr$(10) 'L key for special ' special = weapon(weapon,1) ' specialactivate = 1 '
case _VK_CONTROL 'chat input CTRL instead of ENTER"
print #main.textbox, "!contents? textchat$"; print #main.textbox, "!disable" outputchat$ = textchat$ 'OUTPUTCHAT=VAL(CHATPARSE$(OUTPUTCHAT$)'TURN 1-27 ALPHABET INTO 0-27 NUMBERS 0 = " " (space) 28-30+ = . , ; ECT. print #main.textbox, "PRINT #M lol nato sending...." send = loadtext(outputchat) print #main.textbox, "" if debug = 1 then 'debug for adding tiles print #main.textbox, "~" check$ = commands$(outputchat$) else check$ = commands$(outputchat$) end if print #main.textbox, "!enable" 'admin commands restyled into funtionableility end select
'pickup item 'if item.x(player.x) > 0 and item.y(player.y) > 0 then 'if item.x(player.x) = item.y(player.y) then 'func= pickup(selected,player.x,player.y, selecteditem, deleteid, pos) ' end if 'end if
direction$ = direction$(player.x,player.y,direction)
goto [moveMap]
' if debug = 1 then
' end if [activate] 'for x y tile activation
'print #main.textbox, "DEBUG XY:";pos$ '2811 dirt path '715 map teleport 'data 6113 teleport to 6410 vs versa '6210 fishing spot 6209 3718 1211 334 324 344 '247 object '2515 2516 0425 fishing '2112 1719 building '2216 camp fire for cooking '1823-2523 fishing '5918, 5819, 5720 5821, 6217 fishing spot in view of each other
'---------SKILLS INFO TIMERS AND VARIABLES------------------------
[Woodcuting] if skill = 2 then for inventoryslotskill = 1 to 9 if inventory(inventoryslotskill)= woodcuting then woodcut = 1 end if
if woodcut = 1 then inventoryslotskill = 9 end if next inventoryslotskill
if woodcut = 1 then addexp = addxp( 2, 1) 'draw animation end if woodcut = 0 new= newitem(idforlog,itemid) end if [Fishing] if skill = 3 then for inventoryslotskill = 1 to 9 if inventory(inventoryslotskill)= fishingpole then isfishing = 1 end if
if isfishing = 1 then inventoryslotskill = 9 end if next inventoryslotskill
if isfishing = 1 then addexp = addxp( 3, 1) 'draw animation 'show cutscreen isfishing = 0 'single click for now end if
' new= newitem(idforrandomfish(1-X)) 'cutscene
[Mining] if skill = 4 then for inventoryslotskill = 1 to 9 if inventory(inventoryslotskill)= pickaxe then mining = 1 end if
if mining = 1 then inventoryslotskill = 9 end if next inventoryslotskill
if mining = 1 then addexp = addxp( 4, 2) 'draw animation mining = 0 end if
'new= newitem(idforrock) 'rnd for gems 'large rnd for bigger gems end if [Smelting] if skill = 5 then for inventoryslotskill =1 to 8 if inventory(inventoryslotskill)= ore then smelting = smelting + 1 end if next inventoryslotskill
'draw animation for slot = 1 to 8 if inventory(slot)=ore then addexp = addxp( 5, 1) 'deleteitem(inventory(slot)) 'new=newitem(idforbar) end if next slot
end if
end if [Firemaking] if skill = 8 then for inventoryslotskill = 1 to 8 if inventory(inventoryslotskill) = log then lightfire = 1 end if next inventoryslotskill if lightfire = 1 then for inv = 1 to 8 if inventory(inv) = log then 'deleteitem(invtory(inv)) addexp = addxp( 8, 1) map$(player.x,player.y)="f" 'should stay "burning" until log off fire = 1 end if next inv end if end if [Cooking] if skill = 11 then if map$(player.x,playe.y) = "f" then for inv = 1 to 8 for cookfish = 1 to amountoffish if inventory(inv) = rawfish(cookfish) then inventory(inv) = cookedfish(cookfish) addexp = addxp( 11, 1) end if next cookfish next inv end if end if [Herblaw] 'required items 'animation 'maybe xy mapping 'combine items 'new item
[Crafting] 'required items 'animation 'maybe xy mapping 'new item goto [nextpart] '-------------------------------------------------------------------------------END-SKILLS INFO TIMERS AND VARIABLES------------------------ [Luck] 'rnd toggle 1-2 toggle = toggle + 1 if toggle = 2 then luck = oldluck luck = luck + (luck * luck) / .125 toggle = 0 else luck = oldluck end if goto [branch]
[fillseafloor] for x =1 to 500 for y= 1 to 500 '1- fishing 2 - free 3 free 4 big fish 5 free 6 free 7 fish 8 free 9 run a ground 10 free floor = rnd(1)*10+1 sea(x,y) = floor next y next x
return
[redimm]'reset variables and arrays for new map loading note load file to new string in memory$ then load rest of code itemdata$="" id$="" map.width=0 map.height=0 redim npc.x(100) redim npc.y(100) redim old.npc.x(100) redim old.npc.y(100) redim map$(mapX,mapY) redim tile(1000,1000) 'natoreplacementylol
redim room$(1000,1000) redim room2$(1000,1000)
'dim mapitems(MAPX,MAPY) redim item(totalitems,3) '1 =unsed/id 2=type 3=unsed/unique id for trading redim mapitem(mapX,mapY) redim itemdisplay(totalitems, 2)
redim objdisplay(objcount, 2) redim objdisplay2(objectcount, 2)
redim inventory(8) redim bank(10)
redim specialattack(4)
redim playerfiles$(clientcount, 4)'1=health, 3=hit, 2=npc 4=graphic combo code/id *attire amulets swords ; ect.
player.x=0 player.y=0 playerpos$="" pos=0 pos$="00" if room = 1 then room = 2 gosub [LOADMAPTWO] end if
if room = 2 then room = 1 end if goto [branch]
'------------------------------------------------------------------------ '------------------------------------------------------------------------
[quit.main]'credit: cundo unloadbmp "empty.bmp" bmps = 9 ' for unload = 1 to bmps ' unloadbmp unload$+".bmp" ' next unload
'15 '16 obj1 obj2
'loading screen 'unloadbmp "gif.bmp" playwave "" for i = 1 To 5 'tiles unloadbmp left$(word$(tile.list$,i),1);".bmp" Next
for i = 1 TO 8 'player id unloadbmp "player";i;".bmp" next ' for i = 14 TO 16 'player id ' unloadbmp i;".bmp" ' next
if npc.n Then FOr L = 1 To npc.n unloadbmp npc.bmp.name$(L) NExt End if
if obj.n Then FOr L = 1 To obj.n unloadbmp obj.bmp.name$(L) NExt End if
if items.n Then FOr L = 1 To items.n unloadbmp items.bmp.name$(L) NExt End if
Close #main 'debug notice "Framework credit, justBasic proforums . com / Member: cundo" END
'------------------------------------------------------------------------ '------------------------------------------------------------------------ ' ' Functions '------------------------------------------------------------------------ function musica(museid) select case museid case 1 playwave "music1.wav" case 2 playwave "music2.wav" case 3 playwave "music3.wav" case 4 playwave "music4.wav" case else playwave "background.wav" end select
end function
function directionparse$(direction$) 'if left$(direction$,1) = "UP" then 'if right$(direction$, 2)=player.x+1 or right$(direction$,2)= player.x-1 then 'if right$(direction$,1) = player.y+1 or right$(direction$,1) = player.y-1 then
'end if 'end if end function
function direction$(player.x,player.y,direction) 'return direction XY pointing select case direction case -1 if map$(player.x,player.y+1) = "w" then sailingmsg$ = " Do you have ship in bottle?" else 'sailingmsg$="" end if direction$ = "DOWN ";str$(player.x);" ";str$(player.y+1)+sailingmsg$
case 1 if map$(player.x,player.y-1) = "w" then sailingmsg$ = " Do you have ship in bottle?" else 'sailingmsg$="" end if direction$ = "UP ";str$(player.x);" ";str$(player.y-1)+sailingmsg$
case 5 if map$(player.x-2,player.y) = "w" then sailingmsg$ = " Do you have ship in bottle?" else 'sailingmsg$="" end if direction$ = "LEFT ";str$(player.x-2);" ";str$(player.y)+sailingmsg$
case -5 if map$(player.x+2,player.y) = "w" then sailingmsg$ = " Do you have ship in bottle?" else 'sailingmsg$="" end if direction$="RIGHT ";str$(player.x+2);" ";str$(player.y)+sailingmsg$
end select
print #main.textbox, direction$ end function
Function addxp(skill,amount) select case skill case 1 skill(1,1) = skill(1,1) + amount case 2 skill(2,1) = skill(2,1) + amount case 3 skill(3,1) = skill(3,1) + amount case 4 skill(4,1) = skill(4,1) + amount case 5 skill(5,1) = skill(5,1) + amount case 8 skill(8,1) = skill(8,1) + amount case 9 skill(9,1) = skill(9,1) + amount case 10 skill(10,1) = skill(10,1) + amount case 11 skill(11,1) = skill(11,1) + amount case else Notice "Fatal Error:";skill END end select End Function
Function msg$(varr,log) 'notice function for messages for gameplay see array msg$() at top of code and [activate] if logx(log) > 0 then notice msgs$(varr) logx(log)=0 'null for non-infinite loop end if End Function
Function mousehandler()'finds mouse gui area 'unused 'Tile$ = MouseXY.Tilefinder$()
clickarea$ = word$(Tile$,1)
pos = val(word$(Tile$,2))
select case clickarea$
case "inventory" retur$ = inventory.handler$(selected, pos)
case "special" reset = click(lastselected, selected) prime = specialbar(specialbar)
case "four tiles" null = null case "itempickup" playerposx = player.x : playerposy = player.y reset = click(lastselected, selected) retur = pickup(selected, playerposx,playerposy, itemid, selecteditem, deleteid, pos,objl)
case "other" reset = click(lastselected, selected) end select
End Function
function click(lastselected,selected) 'resets selected when click on non clickable area of game/map if lastselected <> 0 then lastselected=0 selected=0 end if
if incombat = 1 then incombat = stopcombat() end if
'delay = pause(lag) debug = 9:debug=debug(debug)
end function
function pause(lag) ' startpausetime = time$("ms") 'for lagg = 1 to lag/div '' null = null 'add a bit of lag here ' next lagg ' pause = time$("ms")-startpausetime end function
Function item.handler(selecteditem, selecteditem, deleteid, pos, playerposx, playerposy) 'here we use a parsing parse parser parsing = inventory(selecteditem) parser = parse(parsing)' find item type id if parser = 2 then '2 = food 'DELETE ITEM, ADD HEALTH deleteid = 1 delete = deleteitem(selected, selecteditem, deleteid, pos, playerposx, playerposy,objl) deleteid = null end if if lastselected = 0 then lastselected = selecteditem selecteditem = 0 else if item(selecteditem,2) = item(lastselected,2) then 'if items second entry id matches nulled = deleteitem(selected, selecteditem, deleteid, pos, playerposx, playerposy,objl)' pos unsed nulled = deleteitem(selected, lastselected, deleteid, pos, playerposx, playerposy,objl)'pos unsed reset = click(lastselected, selected) 'reset click memory new=item(lastselected,2) retur = newitem(new,itemid) 'create new item from matched id end if end if End Function
Function parse(selecteditem) parse = item(selecteditem,2) 'find itemtypeid 0=null/regular item? 1= item 2=food 3= 4+ = new combined item id and .bmp End Function
function ship(player.x,player.y,shipid) 'set shipid everytime ' #main.gbx, "spritexy ship";shipid;" 50 50"
'if map$(player.x,player.y) = "w" then ' #main.gbx, "spritevisible ship";shipid;" on" 'else ' #main.gbx, "spritevisible ship";shipid;" off" 'end if end function
Function MouseXY.Tilefinder$() 'unused needs 64x64 mapping 'get mouse sx mouse y input prase through the 8 inventory post four tiles around player, special bar 'select case <> for each area 'return as three part string item position area string$
MouseX = MX : MouseY = MY
'item pickup if MX > (((SCREEN.WIDTH*64)/2)-32) and MX < (((SCREEN.WIDTH*64)/2)+32) then if MY > ((SCREEN.HEIGHT*64)/2)-32 and MY < ((SCREEN.HEIGHT*64)/2)+32 then pos = 1 END IF END IF
'four tiles - unused
'right hand side if MX > 400 and MX < ram then if MY >100 and MY < 200 then pos = 5 end if end if
if MX > 400 and MX < ram then if MY >300 and MY < 400 then pos = 6 end if end if
if MX > 400 and MX < ram then if MY >400 and MY < ram then pos = 7 end if end if
if MX > 400 and MX < ram then if MY >ram and MY < 600 then pos = 8 end if end if 'right handside/ 'bottom of screen
if MY > ram and MY < 600 then if MX > 100 and MX < 200 then pos = 9 end if end if
if MX > 400 and MX < ram then if MY > 200 and MY < 300 then pos = 10 end if end if
if MX > 400 and MX < ram then if MY > 300 and MY < 400 then pos = 11 end if end if
if MX > 400 and MX < ram then if MY >400 and MY < 500 then pos = 12 end if end if
'end bottom/
'four tiles
'special
if pos = 0 then pos = -1 end if
if pos > 0 and pos < 4 then clickarea$ = "four tiles" 'unused end if
if pos > 4 and pos < 13 then clickarea$ = "inventory" end if
if pos = 14 then clickarea$ = "special" end if
if pos = 15 then clickarea$ = "null" end if
if pos = 1 then clickarea$ = "itempickup" end if
if pos = -1 then clickarea$ = "other" end if
MouseXY.Tilefinder$ = clickarea$;" ";str$(pos)
End Function
Function inventory.handler$(selected, pos) 'returns item id of inventory item at position pos selecteditem = inventory(pos) if selecteditem = 0 then inventory.handler$="0" else inventory.handler$ = item.handler$(selecteditem) end if End Function
function sailing$(new.pos$,direction,player.x,player.y)
if new.pos$ = "w" then if direction <> -1 then boat = boat + 1 if boat > 2 then 'print #main.textbox, sea(player.x,player.y) 'displayship direction gfx ship[direction] end if end if end if end function
Function bank()
End Function
Function gui() 'draw sprite
End Function
Function pickup(selected, player.x, player.y, itemid, selecteditem, deleteid, pos, objl)' single item per square pickup if deleteid then null=null else deleteid = 3 end if func = deleteitem(selected, selecteditem, deleteid, pos, player.x, player.y,objl) 'delete item deleteid = null 'renew=serverexchange(serverdata) 'server exchange data notice "" newitem=objl func = newitem(newitem, itemid) 'create new item in inventory selecteditem=0 End function
Function deleteitem(selected, selecteditem, deleteid, pos, player.x, player.y,objl) ' TileX = left$(str$(pos,1)) ' TileY = right$(str$((pos,2))
for objl = 1 to obj.n if mapobjectX(player.x, objl) > 0 then if mapobjectY(player.y, objl) > 0 then #main.gbx, "spritexy ";obj.sprite.name$(objl);" 6400 6400" obj.x(objl)=100 obj.y(objl)=100 exitfor=1 end if if exitfor=1 then objl = obj.n end if end if mapobjectX(player.x,objl)=0 mapobjectY( player.y,objl) =0 next objl
'renew=serverexchange(serverdata)
' if deleteid = 1 then '1 = inventory ' if selected = inventory(pos) then 'debugged ' inventory(pos)=null ' end if ' end if
objl = 0 deleteid = 0 End Function
Function newitem(newitem, itemid)'multi-use selected variable also for new quest items and trade not included currently for inventorys = 1 to 8 if full = 8 then inventorys = 8 'null debug notice "Inventory full" exit for end if inventoryslot = inventoryslot+1 if inventory(inventoryslot) = 0 then 'check if slot is free if not null = null else it is a free slot inventory(inventoryslot) = newitem
inventoryid$(inventoryslot) =str$(itemid) inventorys = 8 else full = full + 1 null = null end if
'if inventory(8) > null then 'notice "item lost full" 'else 'notice "deebug" 'inputs selected data here for new item on next draw ' inventoryslot = 10' exit for ' end if 'make sure draw sprites command renews graphics
next inventorys inventoryslot = 0 newitem = 0 End Function
Function inventorygui$(object$)'draws all ten items via select case
'inventory(4)=1 'items$(4)="object1" 'inventory(5)=1 'items$(5)="object1" 'inventory(6)=1 'items$(6)="object1" 'inventory(7)=1 'items$(7)="object1" 'inventory(8)=1 'items$(8)="object1"
for inventorydraw = 1 to 10
select case inventorydraw
case 1 if inventory(1) > 0 then itemidstring = inventory(1) 'items$(1)="object1" object$ = obj.sprite.name$(itemidstring) ' print object$ print #main.gbx, "spritexy ";object$;" ";TILESIZE;" ";TILESIZE*4 'draw sprite str$(itemidstring) end if case 2 if inventory(2) > 0 then itemidstring = inventory(2)
object$ =obj.sprite.name$(itemidstring) print object$ print #main.gbx, "spritexy ";object$;" ";TILESIZE;" ";TILESIZE*5 'draw sprite str$(itemidstring) end if case 3 if inventory(3) > 0 then itemidstring = inventory(3)
object$ =obj.sprite.name$(itemidstring) print #main.gbx, "spritexy ";object$;" ";TILESIZE*2;" ";TILESIZE*5 'draw sprite str$(itemidstring) end if case 4 if inventory(4) > 0 then itemidstring = inventory(4)
object$ =obj.sprite.name$(itemidstring) print #main.gbx, "spritexy ";object$;" ";TILESIZE*3;" ";TILESIZE*5 'draw sprite str$(itemidstring) end if case 5 if inventory(5) > 0 then itemidstring = inventory(5)
object$ = obj.sprite.name$(itemidstring) print #main.gbx, "spritexy ";object$;" ";TILESIZE*4;" ";TILESIZE*5 'draw sprite str$(itemidstring) end if case 6 if inventory(6) > 0 then itemidstring = inventory(6)
object$ =obj.sprite.name$(itemidstring) print #main.gbx, "spritexy ";object$;" ";TILESIZE*5;" ";TILESIZE*5 'draw sprite str$(itemidstring) end if case 7 if inventory(7) > 0 then itemidstring = inventory(7)
object$ =obj.sprite.name$(itemidstring) print #main.gbx, "spritexy ";object$;" ";TILESIZE*7;" ";TILESIZE*5 'draw sprite str$(itemidstring) end if case 8 if inventory(8) > 0 then itemidstring = inventory(8)
object$ = obj.sprite.name$(itemidstring) print #main.gbx, "spritexy ";object$;" ";TILESIZE*7;" ";TILESIZE*4 'draw sprite str$(itemidstring) end if end select
next inventorydraw End Function
function health(health) select case health
if health < 12 then #main.gbx "spritexy object8 40 20" end if
if health > 24 and health < 49 then #main.gbx "spritexy object9 40 20" end if
if health > 49 and health < 70 then #main.gbx "spritexy object10 40 20" end if
if health > 71 and health < 80 then #main.gbx "spritexy object11 40 20" end if
if health > 80 then #main.gbx "spritexy object12 40 20" end if
end function
Function specialbargui(special) if special = 100 then
#main.gbx "spritexy object17 20 100" 'draw sprite special(1) end if if special = 75 then #main.gbx "spritexy object16 20 100"
'draw sprite special(2) end if ' if special = 66 then 'end if if special = 50 then #main.gbx "spritexy object15 20 100" end if ' if special = 33 then ' end if if special = 25 then #main.gbx "spritexy object14 20 100" end if if special = 0 then #main.gbx "spritexy object13 20 100" 'draw sprite(7) end if End Function
Function gamedatahandler() GameData$ = str$(vvar)'after retriving server data .db and loading to vvar
'set lenindex 'using 10 len string of a number var to indicate animaition bmp set for indexable = 1 to lenindex animationfinder$ =mid$(GameData$, 10, indexable)
if left$(animationfinder$, 2) = "10" then '10 indiates animation code 100100001-109959999 direction 01 animations 0000001 "-" is a invisble logical divider for reading purposes only not code animationgfx$(currentanimations)=right$(animationfinder$,8) end if if left$(datafinder$, 2) = "11" then 'username 8 char usernames$(indexable)=right$(datafinder$,8)'need to maintain GameData$ order with indexable end if
' if left$(datafinder$, 2) = "12" then '12- health Note: health luck skill are all client based non transferring data to server saved on local file; if you want, encypted ' health$(indexable)=right$(datafinder$,3) '7 open variable slots here ' end if
if left$(datafinder$, 2) = "13" then 'hit hit$(indexable)=right$(datafinder$,7) ' 1-4 direction xxyy 2-hit 1-40ish 'one avalible variable here end if
if left$(datafinder$, 2) = "14" then 'playerxy xxyy : 0099 playerxy$(indexable)=right$(datafinder$,4) 'option for second input of quick move being different before being read need to change current loop' end if
if left$(datafinder$, 2) = "17" then ' trade$(indexable)=right$(datafinder$,8)'trade item id 000-999 | direction 1-4 | tradeoffer item id 000-999 example 0012520 item 001 traded for item 520 with direction 2 of player view (to find other player in the data) end if
if left$(datafinder$, 2) = "18" then 'basic chat txt = txt + 1 txt$(txt)=time$("ms");" ";str$(indexable);" ";right$(datafinder$,8) end if
if left$(datafinder$, 2) = "19" then ''19 option gives an addition 8 charcters to message txt$ = txt$(txt) txt$(txt)=txt$;" ";right$(datafinder$,8) end if
if left$(datafinder$, 2) = "20" then ''20 option gives an addition 8 charcters to message 0000... ect is blank txt$ = txt$(txt) txt$(txt)=txt$;" ";right$(datafinder$,8) end if
if left$(datafinder$, 2) = "25" then ' txt$ = txt$(txt) txt$(txt)=txt$;" ";right$(datafinder$,8) end if
next indexable txt=0 End Function
'combat
Function stopcombat() stopcombat = null 'return 0 as if then not allowing combat next loop End Function
Function weaponattackgfx(weapontiming,weaponofchoice) weapontiming = weapontimes(weaponofchoice) timeweapon = time$("ms") 'display weaponbmp(weaponofchoice) middle of screenXY, while time$("ms") < timeweapon+weapontiming ' #main.gbx "spriteImage wgfx wgfx";spi;".bmp" wend 'display bmp2
End function
Function attack(attacktime, attacktimer, attacktime1, attacktime2, luck)'via button if attacktime1 > 0 then if a = 5 then a = 0 end if end if a = a + 1 attacktime = attacktime(a) - luck*luck '16-18 15-19 ' if attacktime+attacktimer<attacktime2+attacktime+luck then '* gotoattack = 1 attacktime = 0 : attacktimer = 0 : attacktime2 = 0 : attacktime1 = 0 ' end if attack = gotoattack End Function
Function defend(defendtimer, defendtime1, defendtime2, luck)'via space bar or key
if defendtime1 > 0 then if b = 5 then b = 0 end if end if b = b + 1
defendtime = attacktime(b) - luck*luck '16-18 15-19 using array for both if defendtime+defendtimer<defendtime2+defendtime+luck and defendtime+defendtimer>defendtime2+defendtime+luck then defend = (defendtime2-defendtime1)/2+luck' defendtime = 0 : defendtimer = 0 : defendtime2 = 0 : defendtime1 = 0 end if End Function
Function specialbar(special) 'mouse click if weaponspecial < special then 'see if there's enough special left special = special - weaponspecial 'subtract special end if incombat = stopcombat() ' require reclick? specialbar = special End Function
'luck
Function limiter(time2,time1,ms,buffer,timestatement) 'need for to be implemneted on a faster machine, possible a more lite weight os if time2-time1 < ms then timestatement = (time2-time1)-int(luck*3+1) limiter = timestatement end if End Function
'filesystem 'see bottom of code datafunction() data function
'animations
Function animations()
'display x y starts and stops 'step program thru loop 8 frames; (4) animation frames twice per theoretical slowed down second 1000ms / 8 'count 'aninum = count ' readnow= loadanimations() 'for ani = 0 to readnow ' print #w.g, "addsprite ";animation$;" "animation1$;" ";animation2$;" "animation3$ ' print #w.g, "cyclesprite ";animation$;" 1" ' print #w.g, "spritemovexy ";animation$;" 4 0" ' loadnanimations = aninum End Function
Function setup() 'credit to cundo #main.gbx "setfocus;" ;_ "When characterInput [keys]; ";_ "Getbmp back.bmp 1 1 10 10;" ;_ "Background back.bmp;" ;_ "DRAWSPRITES" End Function
Function globalint$(playerfile$,downloadfile$,offline$) playerfile$="player" downloadfile$=playerfile$+"A" 'attribute to files, will add "offline" to name if player is not online offline$="OFFLINE"' not used currently End Function
'splashscreen loading menu
Function splashscreen(percentage,TILESIZE, SCREENWIDTH, SCREENHEIGHT, OFFSET, GAMEWIDTH, GAMEHEIGHT,BackgroundColor$,UpperLeftY, UpperLeftX) select case percentage case 1 '11 bmps. 10 with percentages
'start first screen case 5 '5, ect. case 10
case 20
case 30
case 40
case 60
case 67
case 70
case 95
case 98
delay=pauses(lag) 'a bit of epic pause here, hopefully be used later in-game delay=pauses(lag) case 100
case else errornumber = 1 null = noticeerror(errornumber,percentage,null) end end select End Function
'pause function null Function pauses(lag) for paus = 1 to 4 'ready game window delay=pauses(lag) next paus End Function
'extras
Function fps(fps,time,loopx) 'print #main.gbx, "/text fps(";int(actualfps) End Function
'commands unsable right now Function commands$(inputcommand$) 'EXAMPLE: 'ctrl$+map/npc/oject 0X 0Y refID$' then [Enter] key ctrl$ = "S" 'COMMAND KEY INT. -> "S" char. if left$(outputchat$, 1) = ctrl$ then commands = commands + 1 'keep track of commands commandsarray$(commands) = word$(outputchat$,1) commandtype$ = commandsarray$(commands) xmap= val(word$(inputmap$, 2)) ymap= val(word$(inputmap$, 3)) mapcommandtile$ = word$(outputchat$, 4)
print ":COMMANDISSUED:SET>";left$(outputchat$, 4);" ";str$(xmap);" ";str$(ymap);"<"; word$(outputchat$,4) ;">tileRefID$: "
select case commandtype$ case "Smap" map$(xmap,ymap)=mapcommandtile$ 'actual input line command here case "Snpc" ' = val(mapcommandtile$) npc.x(null) =xmap 'update game data here npc.y(null) =ymap 'npc object commands case "Sobject"
case "Sitem"
case else notice "invalid entry" end select
commands$=commandtype$ 'for ref end if End Function 'debug Function debug(debug) if debugnull = 1 then select case debug
case 2 notice frames;" x ";seconds;" seconds / frames (Double Click) [ENTER]" notice "Continue [enter]" 'pause break case 3 print currentplayercount;" current player count" case 4 print (time2-time1);" ms game compiled frame in pause of no input, ";timestatement;" lag/wait until next frame of scaaning input, enter pauses here for verifying SCAN and Input [keys]" timerstatement = timerstatement' - buffer case 5 timerstatement = timerstatement + 1000 * seconds ' wait for debug next frame case 6 print "closing for now 0% upload not featured in code yet" case 7 print playerpos$ 'debug case 8 print hit case 9 print delay delay = 0 case 101 ' print time$("ms") - clickms case 1000 loopx = loopx + 1 clientloop = clientloop + 1
if clientloop = frames*seconds then 'frames = 10 FPS, refer fps() for actual fps clientloop = 0
debug = 2:debug = debug(debug)
timer 1000*seconds, [timer] wait
' text=loadtext() 'load text once per second end if end select debug = 0 'reset debug end if End Function
'fail to load error notice Function noticeerror(errornumber,percentage,null) notice "32x linux only; windows 64/32" select case errornumber case 1 notice "ERROR ";errornumber;" ";percentage;" loaded." case 2 notice "ERROR ";errornumber;" ";null;" loaded." case 3 notice "ERROR ";errornumber;" ";null;" loaded." case else notice "ERROR ";Err$;" ";null;"null number" end select end function
'download every users file of "XX YY" 'add more data here 'now$ = uploadtolan$(updateXY$,npcname$,healthnull,myg) ' currentplayercount$ = playercount$(playerfile$,count$,playercount) 'for PID = 1 to val(currentplayercount$) 'download every users file of "XX YY" 'add more data here ' cache$ = downloadplayerfile$(PID, currentplayercount) 'function downloads pid file and updates npc.x(pid) npc.y(pid) ' playerfiles$(PID) = cache$ 'next PID 'next playercount loop ' updateXY$ = playerpos$(player.x,player.y, screen.y, screen.x, map.x, map.y)
Function serverexchange(serverdata) 'BASIC MODAL LOGIC SET gather= datafunction() 'fileserverformat line1 line2 animtion1 username2 hit1 health2 direction1 trade2 chat 'nulled line '00000001-00002002 = animation1 usernamee " b b" '... - ... hit health '00315205-00402002 = tradeitem003 direction 1 for item 5205 '27010203 = "zaba" chat input 'chat is parsed two charcters at a time with a total of 4 characters serverexchange = gather End Function
Function datafunction() 'actual server End Function
Function serverexchangetrade(userID,player.x,player.y,direction) null = null End Function
Function trade() 'unfinished exchang = serverexchangetrade(userID,player.x,player.y,direction) 'deleteitem(selected) 'newitem()=exchange End Function
' ' A|ways Missing function select$(s$)
if left$(s$,1)="," then nextvarl = 1 end if if right$(s$,1)="," then nextvarr = 1 end if
if nextvar1 = 1 then nextvar1 = 0 select$ = right$(s$,1) s$="" end if
if nextvarr = 1 then nextvarr = 0 select$ = left$(s$,1) s$="" end if if s$<>"" then select$ = s$ end if end function
Here's the game, no MUD type functions added yet, I lost my verison of file server somewhere on linux mint and cannot find after searching a bunch of times, sigh, I'll have to rewrite from my base I posted, wasn't much but editing to kill file and reload data into new client data info as such.
|
|
|
Post by Enzo on May 24, 2021 3:37:06 GMT
Coder Beware: there are unused functions and lines of code, mostly omitted with a ' notifier, working on adding npc attack to player right now,
Also having trouble again with sprite masker, I seem to also have lost at a different time my masker that was working perfectly with keeping 0 value (black pixels) instead of overwriting them.
Seems I need to do the following,
-rewrite file server -implement into game for updating characters MUD style -npc combat -player vs player combat -game lore and quest story -placing, npcs and items on map -objects like buildings and trees, ect. -animations for magical attacks and else -sprite masker and mask all 1000 sprites, also rotate as needed for animations ( this one could take a while)
Further more I can update map with a config keycode to place islands randomly to allow for unlimited re-plays or MUD config or single player version.
|
|
|
Post by Enzo on May 24, 2021 7:23:16 GMT
What I have done, NPC attacking; with space bar, removal of npc, item pickup, msgs$(numforquestid), four directional locating +- 1 tile, 4 directional sailing, 500x500 map
You can Input Data with arrays Example of current build data:
'Luck is a constant variable controlled meter feature in the game that actual button skill is required for before the rest. refering to combat, Skill level is achieved with 'Accuracy on a gain metered scale you can lose you skill level at any time.
'r]pg game base by Enzo | A|ways Missing
'study the code to learn how to play\
'dev global playerfile$, downloadfile$, PID, myPID, x, y, player.x, player.y, yes, debug, startup, frames, PIDid, command$, commandtype$, inputcommand$, playercount,_ playerpos$, ms, luck, buffer, null, map.x, map.y, screen.x, screen.y, TILESIZE, OFFSET, loopx, time, fps, base10, debugnull,_ set, playeraccuracy, skill, luck, health, currentplayercount, frames, timerstatement, timestatement, time1, time2,_ loopcount, id, clickms, npc.n, spi, obj, tile.list$, i, L, map.width, map.height, SCREENWIDTH, SCREENHEIGHT, GAMEWIDTH, GAMEHIEGHT 'spi=id of directional player graphic
global TileX, TileY, TileXY$,_ Bankspace, currentbankcount, inventory, selected,_ mana, magicklevel, specialbar, specialtimer, attacktime, defendtimer,_ lastselected$,selecteditem$, selected$, action$,_ attack, defend, attacktimer, defendtimer, defend1, defend2, attacktime1, attacktime2,_ combines, combinations, shipid global mapX, mapY, totalitems, objcount, div, clientcount, ram, itemid ram = 750 clientcount = 10 'number of max clients mapX=ram:mapY=ram:totalitems=10:objcount=10:div=2:lag=100:clientcount=1:base10=10 '5 sprites of 10 images each '/dev map.width = 500 map.height = 500 player.x =6 player.y= 5 global sailing, boat sailing = 2 boat = 1
dim sea(ram,ram)
dim npc.x(ram) dim npc.y(ram) dim old.npc.x(ram) dim old.npc.y(ram) dim map$(mapX,mapY)
dim obj.sprite.name$(1000) dim obj.bmp.name$(1000)
dim npchealth(500,500) dim npc(500,500)
dim weapon(100,2) '1- special amount type 2-weapontiming weapon(1,1)=1 'regular timing per diem; special weapon(1,2)=250 'quarter of second, 1/4th
weapon(2,1)=7 'warlord mask [endgame] weapon(2,2)=575 'slow max hit weapon, bonus; instant
dim weapontimes(20) weapontimes(6)=10'magic weapontimes(1)=15 'dagger weapontimes(2)=20 'longsword weapontimes(3)=25'sword weapontimes(4)=30'2h weapontimes(5)=40'2h
dim mapactivate(ram,ram) dim msgs$(7199)'game msgs=quests dim questrandom$(1000,1)
dim obj.x(ram) dim obj.y(ram) obj.n = ram
'building tree rocks 'obj.x(3)=21 'obj.y(3)=12 'obj.bmp.name$(3)= "object2.bmp" 'obj.sprite.name$(3)= "object2"
dim logx(100) 'set log for now = 1 to 100 logx(now) = 1 next now
dim attacktime(5) 'attack rythm medium, short, long, mid, very short, medium, short, long, mid, ect. attacktime(1)=15 attacktime(2)=-10 attacktime(3)=20 attacktime(4)=10 attacktime(5)=-20
dim mapobjectX(mapX, obj.n) dim mapobjectY(mapY, obj.n)
dim item(ram,ram) dim item(totalitems,3) '1 =unsed/id 2=type 3=unsed/unique id for trading dim itemdisplay(totalitems, 2) dim item.x(ram) dim item.y(ram) dim npchealth(750,750)
dim inventory(8) dim bank(10)
dim specialattack(7)
dim playerfiles$(clientcount, 4) '1=health, 3=hit, 2=npc 4=character[one]id graphic combo code/id *attire amulets swords ; ect.
waitload = 1 shipid = 1 'developer info // myPID = 1 ms = 30 'for timerloop (1000/ms) frames = 10 'desired fps; actual fps may very use 'display() = fps()' function to find fps
'\\ basic debug/building data delete on alpha combinations = 10 'item combines, to new itemid here=item(itemid,2) npcname$ = "player.bmp"' add to keys after playeraccuracy = 10' 1 - 10 low-high skill = .9 ' .5 - .9 high level, .10 - .40 low level luck = .9 '.01-.99 seconds = 3 'desired debug run amount in seconds of 10 frames a second
health = 100
player(1,2) = health player(2,2) = health'input from file on server-client 'function for loading health from playerfiles
null = 0 'set 00000000 byte null = null 'renull
'id = 2 'set max hit calculated by point system divided '\\ end developer info
'set = skill * 7 'unsed
'// /dev
'debug tile.list$ = " dirt water grass rock sand "
buffer = 10 'ms buffer to bad loop yes = 1 '1 operator for debug startup = 1
goto [skipDebug]
[INFO] 'working on basically loading final bmps, server login startup,, animations, useless debug data; for geeks and the actual filesystem format for the server itself [DATA] 'add player bmps weapon gfx, ect., login, server data exchange, animations, debug timing variable file,save on exit
[debugdata] ' debug(debug$) at bottom of code, select case debug$ confirm "debug = 1 (yes)?";answer$ if answer$ = "yes" then debugnull = 1 end if
if debugnull < null then NOMAINWIN end if '// / debug [skipDebug]
NOMAINWIN'
TILESIZE = 64 : SCREENWIDTH = 11 : SCREENHEIGHT = 8 : OFFSET = TILESIZE GAMEWIDTH = SCREENWIDTH*TILESIZE-TILESIZE*2+64 GAMEHEIGHT = SCREENHEIGHT*TILESIZE-TILESIZE*2 WindowWidth = GAMEWIDTH : WindowHeight = GAMEHEIGHT+80 : BackgroundColor$ = "BLACK"
UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2) graphicbox #main.gbx, 0, 0,GAMEWIDTH , GAMEHEIGHT textbox #main.textbox, 14, 400, 352, 25 open "Sailing beta 2.2" for window_nf as #main
print #main.textbox, "!disable" print #main.textbox, "0%" #main.gbx "down; fill BLACK; flush" #main "trapclose [quit.main]" '#main.gbx "When characterInput" #main.gbx "Getbmp empty.bmp 1 1 ";TILESIZE;" ";TILESIZE*2
[ADDTILES]'setup data edit to add .bmp's tile.list$ = "dirt water grass rock sand" For i = 1 To 5 loadbmp left$(word$(tile.list$,i),1);".bmp", DefaultDir$+"\tiles\";word$(tile.list$,i);".bmp" #main.gbx "drawbmp ";left$(word$(tile.list$,i),1);".bmp 1 ";TILESIZE+1;" ; ";_ "Getbmp ";left$(word$(tile.list$,i),1);".bmp 1 1 ";TILESIZE;" ";TILESIZE*2 Next
#main.gbx "down; fill black"
playwave DefaultDir$+"\intro\preintro.wav", async
OPEN DefaultDir$+"\DATA\mapdata1.txt" For input AS #mapfile
While not(eof(#mapfile)) line input #mapfile, itemdata$ ' nn=nn+1 'print #main.textbox, nn id$=trim$(itemdata$) if left$(id$,1)<>"'" and id$<>"" Then Select case case instr(id$,"width") map.width = val( trim$(word$(id$,2,"="))) case instr(id$,"height") map.height = val( trim$(word$(id$,2,"=")))-250 case instr(id$,"playerX") player.x = val( trim$(word$(id$,2,"="))) case instr(id$,"playerY") player.y = val( trim$(word$(id$,2,"="))) case instr(id$,"others") npc.n = val( trim$(word$(id$,2,"="))) IF npc.n>0 Then DIM npc.x(npc.n),npc.y(npc.n) DIM old.npc.x(npc.n),old.npc.y(npc.n) For L = 1 To npc.n line input #mapfile, id$ npc.sprite.name$(L) = WORD$(id$,1,";") npc.bmp.name$(L) = WORD$(id$,2,";") npc.x(L) = val(TRIM$(WORD$(id$,3,";"))) npc.y(L) = val(TRIM$(WORD$(id$,4,";"))) old.npc.x(L) = npc.x(L): old.npc.y(L) = npc.y(L) 'PRINT npc.bmp.name$ Next L End if close #mapfile 'goto [r]
' DIM map$(map.width,map.height) ' ' print map.width, map.height ' For y = 1 To map.height ' ' For x = 1 To map.width ' ' print x, id$ ' map$(x,y) = TRIM$(word$(id$,x,",")) ' " " ' 'PRINT map$(x,y) ' Next ' line input #mapfile, id$ ' if instr(id$,"END") Then exit FOR ' Next ' close #mapfile ' notice "" goto [r] end select End if Wend close #mapfile [r] print #main.textbox, "1%" open DefaultDir$+"\DATA\mapxy.txt" for input as #file map$=input$(#file,lof(#file)) for x = 1 to 503 for y = 1 to 731
var = var + 1
s$ = mid$(map$, var, 1) ' b$ = select$(s$) if s$ <> " " then xx=xx+1 if xx = 501 then xx = 0 var = var + 2 yy = yy + 1 end if else 'notice "" yy = yy + 1 end if
map$(xx,yy) = s$ next y print #main.textbox, "Loading PREFETCH:";int(var/4000);"%"
next x
close #file
timer 50, [preintro] wait [preintro] timer 0 loadbmp "gif1.bmp", DefaultDir$+"\intro\gif1.bmp" #main.gbx "drawbmp gif1.bmp 50 50"
timer 300*waitload, [5] wait
[5] timer 0 loadbmp "gif2.bmp", DefaultDir$+"\intro\gif2.bmp" #main.gbx "drawbmp gif2.bmp 50 50"
timer 600*waitload, [intro] wait [intro] timer 0 'play midi timer 400*waitload, [loadscreen0ff] wait [loadscreen0ff] timer 0
print #main.textbox, "98%" loadbmp "data2.bmp", DefaultDir$+"\intro\data2.bmp" #main.gbx "drawbmp data2.bmp 50 50"
timer 105*loadwait, [puesdotimer0s]
wait
[puesdotimer0s] timer 0 [loadscreen0s]
loadbmp "gif4.bmp", DefaultDir$+"\intro\gif4.bmp" #main.gbx "drawbmp gif4.bmp 50 50"
timer 205*waitload, [puesdotimer0a]
wait
[puesdotimer0a] timer 0 playwave ""
'print #main.gbx, "spritexy gfx 0 0"
[loadscreen00000]
loadbmp "gif6.bmp",DefaultDir$+"\intro\gif6.bmp" #main.gbx "drawbmp gif6.bmp 50 50"
#main.gbx "down; fill black" timer 200*waitload, [puesdotimera]
wait
[puesdotimera] timer 0 playwave DefaultDir$+"\intro\intro.wav", async [loadscreen0]
#main.gbx "cls"
timer 200*waitload, [puesdotimer0]
wait
[puesdotimer0] timer 0 loadbmp "start004.bmp",DefaultDir$+"\intro\start004.bmp" #main.gbx "drawbmp start004.bmp 124 40"
timer 205*waitload, [puesdotimer]
wait
[puesdotimer] timer 0 #main.gbx "down; fill black"
loadbmp "start003.bmp", DefaultDir$+"\intro\start003.bmp" #main.gbx "drawbmp start003.bmp 0 0"
timer 700*waitload, [puesdotimer2]
wait
'more gfx
[puesdotimer2] timer 0 [puesdotimer3]
print #main.textbox, "99%" loadbmp "start002.bmp",DefaultDir$+"\intro\start002.bmp" #main.gbx "drawbmp start002.bmp 0 0"
[PLAYERBMPLIST]
loadbmp "player1.bmp", DefaultDir$+"\char\player1.bmp" loadbmp "player2.bmp", DefaultDir$+"\char\player2.bmp" loadbmp "player3.bmp", DefaultDir$+"\char\player2.bmp" loadbmp "player4.bmp", DefaultDir$+"\char\player4.bmp" loadbmp "player5.bmp", DefaultDir$+"\char\player5.bmp" loadbmp "player6.bmp", DefaultDir$+"\char\player6.bmp" loadbmp "player7.bmp", DefaultDir$+"\char\player7.bmp" loadbmp "player8.bmp", DefaultDir$+"\char\player8.bmp"
[CONTROL] #main.gbx "setfocus;" ;_ "When characterInput [keys]; ";_ "fill black;" ;_ "DRAWSPRITES" room = 1
print #main.textbox, "70%" ' goto [6] [LOADMAP]
'#main.gbx, "spritexy
print #main.textbox, "99.9%" [MAPDATARAM] ' 10 * 7 DIM tile(SCREENWIDTH*SCREENHEIGHT,2) for h = 1 To SCREENHEIGHT for w = 1 To SCREENWIDTH obj=obj+1 #main.gbx "addsprite obj";obj;" empty.bmp d.bmp w.bmp g.bmp r.bmp s.bmp" tile(obj,1)=w tile(obj,2)=h next:next 'room= 1 print #main.textbox, "99.99%" [ADDPLAYERSPRITE] #main.gbx "addsprite player player1.bmp player2.bmp player3.bmp";_ " player4.bmp player5.bmp player6.bmp player7.bmp player8.bmp;";_ "spritexy player ";player.x*TILESIZE-TILESIZE-OFFSET;" ";player.y*TILESIZE-TILESIZE-OFFSET
[addweapon] null=null '#main.gbx "addsprite wgfx wgx1.bmp wgfx.bmp wgfx3.bmp";_ ' " wgfx4.bmp wgfx5.bmp wgfx6.bmp wgfx7.bmp wgfx8.bmp ;";_ ' ' "spritexy wgfx ";player.x*TILESIZE-TILESIZE-OFFSET;" ";player.y*TILESIZE-TILESIZE-OFFSET ' [items]'inventory map item sprites load itemid=0 'itemid starts at 1000 for itemload = 1 to item.n itemid = itemid +1 item.bmp.name$(itemid)=str$(itemid);".bmp" item.sprite.name$(itemid)= str$(itemid) next itemload 'example 'item.bmp.name$(2)= "51.bmp" 'item.sprite.name$(2)= "51"
[setupnpc] npc.n = 1 npc.bmp.name$(1) = "player9.bmp" npc.sprite.name$(1) = "king" npc.x(1)= 14 npc.y(1)= 14
' npc.bmp.name$(2) = ".bmp" ' npc.sprite.name$(2) = ""
' npc.bmp.name$(3) = ".bmp" ' npc.sprite.name$(3) = ""
'manual placement item.x(1)=3 item.y(1) =3 item.x(2)=4 item.y(2) =4
[NPC]'npc.n controls output of loops to new entry if npc.n Then For L = 1 To npc.n loadbmp npc.bmp.name$(L), DefaultDir$+"\char\";npc.bmp.name$(L) #main.gbx "addsprite ";npc.sprite.name$(L);" ";npc.bmp.name$(L) '#main.gbx "spritexy ";npc.sprite.name$(L);" ";npc.x(L)*TILESIZE-TILESIZE-OFFSET;_ ' " ";npc.y(L)*TILESIZE-TILESIZE-OFFSET Next End if
dim inventoryid(10) dim quest$(750,750) item.n=0 'update variable if item.n Then For L = 1 To item.n loadbmp item.bmp.name$(L),DefaultDir$+"\items\";item.bmp.name$(L) #main.gbx "addsprite ";item.sprite.name$(L);" ";item.bmp.name$(L) '#main.gbx "spritexy ";item.sprite.name$(L);" ";item.x(L)*TILESIZE-TILESIZE-OFFSET;_ '" ";item.y(L)*TILESIZE-TILESIZE-OFFSET Next End if
playwave "" playwave DefaultDir$+"\intro\music.wav", async print #main.textbox, "100%"
[obj]'object loader
objid = 100 '100-999 objects universal gameid ref 'for loadobj = 1 to obj.n ' objid=objid+1 'obj.bmp.name$(itemid)="A";str$(itemid);".bmp" 'obj.sprite.name$(itemid)= str$(itemid) 'next loadobj
'example obj.bmp.name$(1)="alwaysalways.bmp" obj.sprite.name$(1)= "object1"
obj.bmp.name$(2)= "pirate.bmp" obj.sprite.name$(2)= "object2" obj.bmp.name$(3)= "piratel.bmp" obj.sprite.name$(3)= "object3" obj.bmp.name$(4)= "pirater.bmp" obj.sprite.name$(4)= "object4" obj.bmp.name$(5)= "pirated.bmp" obj.sprite.name$(5)= "object5" obj.bmp.name$(6)="outline.bmp" obj.sprite.name$(6)="object6"
obj.bmp.name$(7)="abc.bmp" obj.sprite.name$(7)="object7"
obj.bmp.name$(8)="healthbar12.bmp" obj.sprite.name$(8)="object8" obj.bmp.name$(9)="healthbar25.bmp" obj.sprite.name$(9)="object9" obj.bmp.name$(10)="healthbar50.bmp" obj.sprite.name$(10)="object10" obj.bmp.name$(11)="healthbar75.bmp" obj.sprite.name$(11)="object11" obj.bmp.name$(12)="healthbar100.bmp" obj.sprite.name$(12)="object12"
obj.bmp.name$(13)="special0.bmp" obj.sprite.name$(13)="object13" obj.bmp.name$(14)="special25.bmp" obj.sprite.name$(14)="object14" obj.bmp.name$(15)="special50.bmp" obj.sprite.name$(15)="object15" obj.bmp.name$(16)="special75.bmp" obj.sprite.name$(16)="object16" obj.bmp.name$(17)="special100.bmp" obj.sprite.name$(17)="object17"
obj.bmp.name$(18)="mickey.bmp" obj.sprite.name$(18)="object18" obj.bmp.name$(19)="lemon.bmp" obj.sprite.name$(19)="object19"
obj.bmp.name$(20)="pumpkin005.bmp" obj.sprite.name$(20)="object20"
'null ' obj.bmp.name$(0)=".bmp" ' obj.sprite.name$(0)="object"
'manual placement input
msgs$(1)="Excuse me, traveler. Please, help me out. Grab my book, it is just down to the right around south 14 east 13, Hero, I need you to go out there and disrupt their activities destroy thei... do whatever it takes to stop those wretched miscreants merchants. It'll be dangerous, but I'm willing to come along if you need me to. wish I could pay you far more than I can, but what I can pay isn't less than what's less either. Best of luck hero, arrrgh. (you realize the unnamed King is drunk and talking to you)" obj.x(1)=13 obj.y(1) =14 quest$(13,14) ="1"
obj.x(20)=10 obj.y(20)= 10 quest$(10,10)="2"
'null 'obj.x()= 'obj.y()= 'quest$(,)=""
obj.x(2)=500 obj.y(2) =500
obj.x(3)=490 obj.y(3) =500
obj.x(4)=480 obj.y(4) =500
obj.x(5)=500 obj.y(5) =480
obj.x(6)=470 obj.y(6) =500
'gui obj.x(7)=2 obj.y(7) =4
'item pickup obj.x(19)=13 obj.y(19)=13
for n=8 to 18 obj.x(n)=100 obj.y(n) =100 next n
' mapobjectX( ' mapobjectY( mapobjectX(13,1)=1 mapobjectY(14,1)=1 '=object id mapobjectX(13,19)=19 mapobjectY(13,19)=19
obj.n=20 if obj.n Then For L = 1 To obj.n loadbmp obj.bmp.name$(L), DefaultDir$+"\items\";obj.bmp.name$(L) #main.gbx "addsprite ";obj.sprite.name$(L);" ";obj.bmp.name$(L) '#main.gbx "spritexy ";obj.sprite.name$(L);" ";obj.x(L)*TILESIZE-TILESIZE-OFFSET;_ '" ";obj.y(L)*TILESIZE-TILESIZE-OFFSET Next End if print #main.textbox, "100%" loadbmp "start001.bmp",DefaultDir$+"\intro\start001.bmp" #main.gbx "drawbmp start001.bmp 0 0"
timer 92*waitload, [puesdotimer4]
print #main.textbox, "DONE%"
wait
[puesdotimer4] timer 0
for i = 1 to 2 unloadbmp "gif";i;".bmp" next i
for i = 4 to 5 if i = 5 then i = 6 end if unloadbmp "gif";i;".bmp" next i for i = 1 to 4 unloadbmp "start00";i;".bmp" next i 'for i = 1 to 4
'next i unloadbmp "data2.bmp"
gosub [fillseafloor] print #main.textbox, "" print #main.textbox, "!enable"
[debug]
room = 1 timer 180*waitload, [reDo]
wait
'[debugdata] INFO ONLY NOT A BRANCH FOR REF '[timer] ' timer 100, [reDo] 'wait 'first pause here ' #main.gbx "When characterInput" 'debug=1000: debug=debug(debug) ' debug = 3:debug = debug(debug) 'drawing once every 237ms 'printf = fps(fps,time1,loopx)
'load data here from server 'time1 = time$("ms")
'debug 'timer 'time2 = time$("ms") 'timestatement = limiter(time2,time1,ms,buffer,timestatement) 'debug = 5:debug = debug(debug) 'debug = 4:debug = debug(debug) start = 1 [reDo] timer 0
[branch] [loop]
#main.gbx "When characterInput"
print #main.textbox, sailingmsg$ if activatebutton = 1 then 'notice "1" mapactivate = 1 activatebutton = 0
end if draw=health(health)
if mapactivate = 2 then 'Button for pressing through dialog with npcs ' sailingmsg$ = "" mapactivate = 0 end if
'renew=serverexchange(serverdata)' draw$ = inventorygui$(object$) draw = specialbargui(special) 'draw = animations() if sailingmsg$ = " Do you have ship in bottle?" then 'animation ' print #main.gbx, "drawbmp ship1 0 0" ' display=ship(player.x,player.y,shipid) 'else 'animation 'hide=ship(player.x,player.y,shipid) end if 'IF SAILING = 0 THEN
print #main.gbx, "spritexy object6 -60 -60" ' END IF if shimmer > 1 then print #main.gbx, "spritexy object6 -48 -44" shimmer = 0 shimmering = 1 + 1 end if
if shimmering = 5 then shimmer = 0 shimmering = 0 end if
' #main.gbx "spritexy object7 130 50" 'draw gui abc buttons
'draw = display() player.y = player.y + INT(screen.y) map.y = map.y + INT(screen.y) player.x = player.x + INT(screen.x) map.x = map.x + INT(screen.x) pos$ = str$(player.x)+str$(player.y) pos = val(pos$) if abs(screen.y)>=1 Then screen.y = 0 if abs(screen.x)>=1 Then screen.x = 0
if player.x = 2 or player.x = 3 then goto [loop] end if if player.y = 2 or player.y = 3 then goto [loop] end if
if mapactivate = 1 then for objl = 1 to obj.n if mapobjectX(player.x, objl) > 0 then if mapobjectY(player.y, objl) > 0 then itemid = 0 'pickup itemid itemid$=quest$(player.x,player.y) itemid = val(itemid$) itemid$ = "" retur = pickup(selected, playerposx,playerposy, itemid, selecteditem, deleteid, pos,objl) if itemid = 1 then display$ = msg$(itemid, itemid) itemid = 0 end if mapobjectX(player.x, objl) = 0 mapobjectY(player.y, objl) = 0 end if end if next objl mapactivate = 0 end if
if attackactivate = 1 then attackactivate = 0 gosub [attacknotimer] end if
[attackreturn] 'if obj.x(l) = player.x obj.y(l) = player.y then 'obj.x(player.x) = 0: obj.y(player.y)=0 'notice "nullremoval" 'poss = 1 'selecteditem = obj.x(player.x) selecteditem = 1 'pickup = pickup(selecteditem,player.x, player.y, selecteditem, deleteid, poss)'
#main.gbx "DRAWSPRITES"
'if mapactivate(player.x,player.y) = 3 then 'type 3- quest notice 'print #main.textbox, "" 'end if 'if mapactivate(player.x,player.y) = 2 then 'cutscene 'print #main.textbox, msgs$(pos) 'display = miniclip()'skillid 'end if
[skip] timer 20, [reDo] ' 1 game tic = ms #main.gbx "When characterInput [keys]"
WAIT
[moveMap] 'credit to cundo ' print #main.textbox, "DEBUG XY:";pos$
if player.x = 3 or player.x = 4 then goto [loop] end if if player.y = 3 or player.y = 4 then goto [loop] end if draw = gui() For i =1 To obj SCAN w = tile(i,1) h = tile(i,2) if walk.val<1 Then #main.gbx "Spritexy obj";i;" ";_ w*TILESIZE-TILESIZE - (screen.x*TILESIZE) - OFFSET; " ";_ h*TILESIZE-TILESIZE - (screen.y*TILESIZE) - OFFSET End if If map.x+w<= map.width AND map.x+w>0 AND _ map.y+h <= map.height AND map.y+h>0 Then #main.gbx "SpriteImage obj";i;" "; trim$( map$(w+map.x,h+map.y));".bmp"
For L=1 to npc.n #main.gbx "spritexy ";npc.sprite.name$(L);" ";_ (npc.x(L)-map.x-screen.x)*TILESIZE-TILESIZE - OFFSET ;" ";_ (npc.y(L)-map.y-screen.y)*TILESIZE-TILESIZE - OFFSET NEXT L
For L=1 to obj.n 'if track(obj.n)=0 then 'obj.n = obj.n+1 'end if #main.gbx "spritexy ";obj.sprite.name$(L);" ";_ (obj.x(L)-map.x-screen.x)*TILESIZE-TILESIZE - OFFSET ;" ";_ (obj.y(L)-map.y-screen.y)*TILESIZE-TILESIZE - OFFSET NEXT L
For L=1 to item.n #main.gbx "spritexy ";item.sprite.name$(L);" ";_ (item.x(L)-map.x-screen.x)*TILESIZE-TILESIZE - OFFSET ;" ";_ (item.y(L)-map.y-screen.y)*TILESIZE-TILESIZE - OFFSET NEXT L Else ' set the tiles to an empty image #main.gbx "SpriteImage obj";i;" empty.bmp"
End if
Next
if map$(player.x,player.y) = "w" then SAILING = 1 goto [animationbase] else SAILING = 0 goto [cont] end if [animationbase]
directionsailing$ = word$(direction$,1)
steptoggle = steptoggle + 1 if steptoggle = 3 then steptoggle = 0 end if
if steptoggle = 2 then
select case directionsailing$
case "UP" 'print #main.gbx, "spriteimage object1 pirate.bmp" print #main.gbx, "spritexy object2 75 73"
case "RIGHT" '90de 'print #main.gbx, "spriteimage object4 pirater.bmp" print #main.gbx, "spritexy object4 124 60"
case "DOWN" '180 'print #main.gbx, "spriteimage object2 pirated.bmp" print #main.gbx, "spritexy object5 106 124"
case "LEFT" '270 'print #main.gbx, "spriteimage object3 piratel.bmp" print #main.gbx, "spritexy object3 150 63"';int(sea$(player.x,player.y)/10) end select
else
select case directionsailing$
case "UP" 'print #main.gbx, "spriteimage object1 pirate.bmp" print #main.gbx, "spritexy object2 70 70"
case "RIGHT" '90de 'print #main.gbx, "spriteimage object4 pirater.bmp" print #main.gbx, "spritexy object4 120 60"
case "DOWN" '180 'print #main.gbx, "spriteimage object2 pirated.bmp" print #main.gbx, "spritexy object5 100 120"
case "LEFT" '270 'print #main.gbx, "spriteimage object3 piratel.bmp" print #main.gbx, "spritexy object3 150 60" end select
end if
[cont]
goto [loop]
[attackloop] 'meter attack to 250ms and weapontiming beginers = 47 if attacktoggle=1 then attacktime2 = time$("ms") attacktoggle = 0 else attacktime1 = time$("ms") attacktimer = attackime1 attacktoggle = 1 end if
if attacktimer-attacktime2 < index(weapon)-50+beginers and attacktimer-attacktime2 > index(weapon)-50+beginers then 'charges special every hit brute = attacktimer - attacktime2 -index(weapon) brute$= str$(brute) brute = val(brute$) end if
callfunction = attack(attacktime, attacktimer, attacktime1, attacktime2, luck)'timer toggle if callfunction = 1 then gosub [attack] callfunction = 0 end if print #main.textbox, hit renew=serverexchange(serverdata)
goto [branch]
[attack] 'need to register luck and skill Timer 0
[attacknotimer] #main.gbx "When characterInput" if specialactivate = 1 then specialactivate=0 specialvariable = brute selections = luck * 1.33 end if if selections < .5 then weapon = 1 end if if selections < .5 and selections > 1 then weapon = 2 end if if selections < 1 then 'luck from .75 up to 2.0+ adds natual max hit possible to weapon to either 5 weapon = 3 end if if weaponchoice > 3 then weapon = 5 end if if weaponchoice > 7 then weapon = 7 'warlord mask end if
select case weapon case 1 'basic input here, 'specialvariable = brute case 2 'rate = 1 specialindex = 25 '+25 max hit constant case 3 rate = 2 specialindex = 15 '+30 max hit possible case 5 rate = 2 specialindex= 20 '+40 max hit possible case 7 'end game item rate = 999 specialindex = 999 end select
rate = 1 'natural additive 'key timing to correct time will give higher hit, same variable for special attack probabilityvariable = ((((brute-40+beginers) + playeraccuracy + luck * base10)+.1)*((.1*specialvariable)-1))+(rate*specialindex)-2'rnd with positive additive of player trained skill, -2 possiblity to add health, evens function
specialvariable = 0 specialindex = 0 variable = probabilityvariable if variable > (base10/2)*1.3 then 'adds bonus if exptionale accurate, directly from the RND for realisitic play hitbonus = 10 + variable '10 point buffer for allowing not to powerful end if ' if variable < 5 then 'see if 50/50 with accuracy added(max up to 1 to 13-29 "i think") gives hit or not ' print "miss" ' end if
debug=101:debug=debug(debug) hit = variable + hitbonus 'basically grabs postive handi capped "55+" RND adds bonus if accuracy is expectionale accurate over 100, to the handicap with a max of unknown, this gives base 55+/45- type RND sets, allowing for a positive gameplay without "sluggish" hits then times this number by your decimcal (skill level * 7) and divides by 3, this part is hard to explain how it linearized RND to be RND still, it just is because the seed is RND, now out of 100 this is not random, there is a positive value frequency to this code as stated before
'add a little 'luck' here players will gain small amount of luck thru out game and its added to a hidden hit value that could "stack" or add up after every hit if hit < 1 then hit = 5*luck*luck end if debug = 8:debug=debug(debug)
functio = weaponattackgfx(weapontiming,weaponofchoice)'gfx for weapon rotate 45 90 degree
'need parse for multi user current npcs only directionofattack = val("66"+direction$) x$=right$(left$(str$(directionofattack),4),2):y$=right$(str$(directionofattack),2) '1-9map non working xnpc = val(x$) : ynpc = val(y$)
if npc.x(xnpc ) > 0 and npc.y(ynpc) > 0 then npchealth(xnpc,ynpc)= npchealth(xnpc,ynpc)-hit end if hit = 20 'peusdo attack debug npchealth(xnpc,ynpc)=npchealth(xnpc,ynpc)-50 npchit = rnd(1)*10*10 npchit = (npchit)*(hit*.015+(luck*.01)) notice npchit
health = health - npchit notice health;"hp" if npchealth(xnpc,ynpc) < 0 then npc(npcx,npcy)=1 npc = npc(npcx,npcy)
#main.gbx, "spritexy ";npc.sprite.name$(npc);" 6400 6400" npc.x( npc )=100 npc.y( npc )=100 end if attackactivate = 0 'return ai attack
return
[defend] 'space bar defendtime = time$("ms") defendvar = defend(defendtimer, defendtime1, defendtime2, luck) if defendtime < defendvar and defendtime > defendvar then blocknexthit = 1 defendvar = 0 defendtime = 0 end if goto [branch]
[keys] 'credit to cundo Timer 0 k$ = Inkey$ keyValue = asc(right$(k$, 1)) #main.gbx "When characterInput" 'B
walk.val = .5'adds stepped input if noticestep = 1 then notice keyValue steppingnotice = steppingnotice +1 if steppingnotice = 2 then wait end if end if
direction$ = direction$(player.x,player.y,direction) '[right] 'if direction =
'[left] '[down] '[up] select case keyValue case 32' / ,46delete key
parse$ = direction$(player.x,player.x,direction) stringdirection1 = val(word$(parse$,2)) stringdirection2 = val(word$(parse$,3))
for npclook = 1 to npc.n for npclook2 = 1 to npc.n if npc.x(npclook) = stringdirection1 and npc.y(npclook2) = stringdirection2 then attackactivate = 1 end if if npc.x(npclook) = stringdirection1+1 and npc.y(npclook2) = stringdirection2+1 then attackactivate = 1 end if if npc.x(npclook) = stringdirection1-1 and npc.y(npclook2) = stringdirection2-1 then attackactivate = 1 end if if npc.x(npclook) = stringdirection1+1 and npc.y(npclook2) = stringdirection2-1 then attackactivate = 1 end if if npc.x(npclook) = stringdirection1-1 and npc.y(npclook2) = stringdirection2+1 then attackactivate = 1 end if next npclook2 next npclook
' attackactivate = 1
case 101 'number 5 for input keyvalue if stepping = 0 then noticestep = 1 stepping = 1 else noticestep = 0 end if
case _VK_DOWN direction = -1 if sailing <> 1 then
if player.y + 1 < map.height Then new.pos$ = map$(player.x,player.y+1) If new.pos$<>"r" and new.pos$ <>"ww" Then 'ww noclip activated screen.y = screen.y + walk.val Else screen.y=0 End if spi = abs(not(spi)) #main.gbx "spriteImage player player";1+spi;".bmp" 'pidid End if end if case _VK_UP direction = 1 if player.y - 1 >0 Then new.pos$ = map$(player.x,player.y-1) If new.pos$<>"r" and new.pos$ <>"ww" Then screen.y = screen.y - walk.val Else screen.y=0 End if spi = abs(not(spi)) is$ = sailing$(new.pos$,direction,player.x,player.y) #main.gbx "spriteImage player player";3+spi;".bmp" 'pidid if sailing = 4 then'4- is$ = sailing$(new.pos$,direction,player.x,player.y) end if End if case _VK_LEFT direction = 5 if player.x - 1 > 0 Then new.pos$ = map$(player.x-1,player.y) If new.pos$<>"r" and new.pos$ <>"ww" Then screen.x = screen.x - walk.val Else screen.x = 0 End if spi = abs(not(spi)) is$ = sailing$(new.pos$,direction,player.x,player.y) #main.gbx "spriteImage player player";5+spi;".bmp" 'pidid if sailing = 4 then 'sailing 4 is new ship id is$ = sailing$(new.pos$,direction,player.x,player.y)'shipid end if End if case _VK_RIGHT direction = -5 if player.x +1 < map.width Then new.pos$ = map$(player.x+1,player.y) If new.pos$<>"r" and new.pos$ <>"ww" Then screen.x = screen.x + walk.val Else screen.x=0 End if spi = abs(not(spi))
is$ = sailing$(new.pos$,direction,player.x,player.y) #main.gbx "spriteImage player player";7+spi;".bmp" 'PIDid if sailing = 4 then '4- is$ = sailing$(new.pos$,direction,player.x,player.y) end if End if case _VK_INSERT mapactivate = 1
case _VK_ESCAPE '[escape] to quit or [trapclose] goto [quit.main]
' case 47 'health reset ' special = special - 25 ' health = health - 25 ' if health < 0 then ' health =100 ' special = 100 ' end if
' shimmer = 1 ' if shimmer = 1 then ' shimmer = 0 ' end if 'goto [attackloop] 'case chr$(10) 'L key for special ' special = weapon(weapon,1) ' specialactivate = 1 '
case _VK_CONTROL 'chat input CTRL instead of ENTER"
print #main.textbox, "!contents? textchat$"; print #main.textbox, "!disable" outputchat$ = textchat$ 'OUTPUTCHAT=VAL(CHATPARSE$(OUTPUTCHAT$)'TURN 1-27 ALPHABET INTO 0-27 NUMBERS 0 = " " (space) 28-30+ = . , ; ECT. print #main.textbox, "PRINT #M lol nato sending...." send = loadtext(outputchat) print #main.textbox, "" if debug = 1 then 'debug for adding tiles print #main.textbox, "~" check$ = commands$(outputchat$) else check$ = commands$(outputchat$) end if print #main.textbox, "!enable" 'admin commands restyled into funtionableility end select
'pickup item 'if item.x(player.x) > 0 and item.y(player.y) > 0 then 'if item.x(player.x) = item.y(player.y) then 'func= pickup(selected,player.x,player.y, selecteditem, deleteid, pos) ' end if 'end if
goto [moveMap]
' if debug = 1 then
' end if [activate] 'for x y tile activation
'print #main.textbox, "DEBUG XY:";pos$ '2811 dirt path '715 map teleport 'data 6113 teleport to 6410 vs versa '6210 fishing spot 6209 3718 1211 334 324 344 '247 object '2515 2516 0425 fishing '2112 1719 building '2216 camp fire for cooking '1823-2523 fishing '5918, 5819, 5720 5821, 6217 fishing spot in view of each other
'---------SKILLS INFO TIMERS AND VARIABLES------------------------
[Woodcuting] if skill = 2 then for inventoryslotskill = 1 to 9 if inventory(inventoryslotskill)= woodcuting then woodcut = 1 end if
if woodcut = 1 then inventoryslotskill = 9 end if next inventoryslotskill
if woodcut = 1 then addexp = addxp( 2, 1) 'draw animation end if woodcut = 0 new= newitem(idforlog,itemid) end if [Fishing] if skill = 3 then for inventoryslotskill = 1 to 9 if inventory(inventoryslotskill)= fishingpole then isfishing = 1 end if
if isfishing = 1 then inventoryslotskill = 9 end if next inventoryslotskill
if isfishing = 1 then addexp = addxp( 3, 1) 'draw animation 'show cutscreen isfishing = 0 'single click for now end if
' new= newitem(idforrandomfish(1-X)) 'cutscene
[Mining] if skill = 4 then for inventoryslotskill = 1 to 9 if inventory(inventoryslotskill)= pickaxe then mining = 1 end if
if mining = 1 then inventoryslotskill = 9 end if next inventoryslotskill
if mining = 1 then addexp = addxp( 4, 2) 'draw animation mining = 0 end if
'new= newitem(idforrock) 'rnd for gems 'large rnd for bigger gems end if [Smelting] if skill = 5 then for inventoryslotskill =1 to 8 if inventory(inventoryslotskill)= ore then smelting = smelting + 1 end if next inventoryslotskill
'draw animation for slot = 1 to 8 if inventory(slot)=ore then addexp = addxp( 5, 1) 'deleteitem(inventory(slot)) 'new=newitem(idforbar) end if next slot
end if
end if [Firemaking] if skill = 8 then for inventoryslotskill = 1 to 8 if inventory(inventoryslotskill) = log then lightfire = 1 end if next inventoryslotskill if lightfire = 1 then for inv = 1 to 8 if inventory(inv) = log then 'deleteitem(invtory(inv)) addexp = addxp( 8, 1) map$(player.x,player.y)="f" 'should stay "burning" until log off fire = 1 end if next inv end if end if [Cooking] if skill = 11 then if map$(player.x,playe.y) = "f" then for inv = 1 to 8 for cookfish = 1 to amountoffish if inventory(inv) = rawfish(cookfish) then inventory(inv) = cookedfish(cookfish) addexp = addxp( 11, 1) end if next cookfish next inv end if end if [Herblaw] 'required items 'animation 'maybe xy mapping 'combine items 'new item
[Crafting] 'required items 'animation 'maybe xy mapping 'new item goto [nextpart] '-------------------------------------------------------------------------------END-SKILLS INFO TIMERS AND VARIABLES------------------------ [Luck] 'rnd toggle 1-2 toggle = toggle + 1 if toggle = 2 then luck = oldluck luck = luck + (luck * luck) / .125 toggle = 0 else luck = oldluck end if goto [branch]
[fillseafloor] for x =1 to 500 for y= 1 to 500 '1- fishing 2 - free 3 free 4 big fish 5 free 6 free 7 fish 8 free 9 run a ground 10 free floor = rnd(1)*10+1 sea(x,y) = floor next y next x
return
[redimm]'reset variables and arrays for new map loading note load file to new string in memory$ then load rest of code itemdata$="" id$="" map.width=0 map.height=0 redim npc.x(100) redim npc.y(100) redim old.npc.x(100) redim old.npc.y(100) redim map$(mapX,mapY) redim tile(1000,1000) 'natoreplacementylol
redim room$(1000,1000) redim room2$(1000,1000)
'dim mapitems(MAPX,MAPY) redim item(totalitems,3) '1 =unsed/id 2=type 3=unsed/unique id for trading redim mapitem(mapX,mapY) redim itemdisplay(totalitems, 2)
redim objdisplay(objcount, 2) redim objdisplay2(objectcount, 2)
redim inventory(8) redim bank(10)
redim specialattack(4)
redim playerfiles$(clientcount, 4)'1=health, 3=hit, 2=npc 4=graphic combo code/id *attire amulets swords ; ect.
player.x=0 player.y=0 playerpos$="" pos=0 pos$="00" if room = 1 then room = 2 gosub [LOADMAPTWO] end if
if room = 2 then room = 1 end if goto [branch]
'------------------------------------------------------------------------ '------------------------------------------------------------------------
[quit.main]'credit: cundo unloadbmp "empty.bmp" bmps = 9 ' for unload = 1 to bmps ' unloadbmp unload$+".bmp" ' next unload
'15 '16 obj1 obj2
'loading screen 'unloadbmp "gif.bmp" playwave "" for i = 1 To 5 'tiles unloadbmp left$(word$(tile.list$,i),1);".bmp" Next
for i = 1 TO 8 'player id unloadbmp "player";i;".bmp" next ' for i = 14 TO 16 'player id ' unloadbmp i;".bmp" ' next
if npc.n Then FOr L = 1 To npc.n unloadbmp npc.bmp.name$(L) NExt End if
if obj.n Then FOr L = 1 To obj.n unloadbmp obj.bmp.name$(L) NExt End if
if items.n Then FOr L = 1 To items.n unloadbmp items.bmp.name$(L) NExt End if
Close #main 'debug notice "Framework credit, justBasic proforums . com / Member: cundo" END
'------------------------------------------------------------------------ '------------------------------------------------------------------------ ' ' Functions '------------------------------------------------------------------------ function musica(museid) select case museid case 1 playwave "music1.wav" case 2 playwave "music2.wav" case 3 playwave "music3.wav" case 4 playwave "music4.wav" case else playwave "background.wav" end select
end function
function directionparse$(direction$) 'if left$(direction$,1) = "UP" then 'if right$(direction$, 2)=player.x+1 or right$(direction$,2)= player.x-1 then 'if right$(direction$,1) = player.y+1 or right$(direction$,1) = player.y-1 then
'end if 'end if end function
function direction$(player.x,player.y,direction) 'return direction XY pointing select case direction case -1 if map$(player.x,player.y+1) = "w" then sailingmsg$ = " Do you have ship in bottle?" else 'sailingmsg$="" end if direction$ = "DOWN ";str$(player.x);" ";str$(player.y+1)+sailingmsg$
case 1 if map$(player.x,player.y-1) = "w" then sailingmsg$ = " Do you have ship in bottle?" else 'sailingmsg$="" end if direction$ = "UP ";str$(player.x);" ";str$(player.y-1)+sailingmsg$
case 5 if map$(player.x-2,player.y) = "w" then sailingmsg$ = " Do you have ship in bottle?" else 'sailingmsg$="" end if direction$ = "LEFT ";str$(player.x-2);" ";str$(player.y)+sailingmsg$
case -5 if map$(player.x+2,player.y) = "w" then sailingmsg$ = " Do you have ship in bottle?" else 'sailingmsg$="" end if direction$="RIGHT ";str$(player.x+2);" ";str$(player.y)+sailingmsg$
end select
print #main.textbox, direction$ end function
Function addxp(skill,amount) select case skill case 1 skill(1,1) = skill(1,1) + amount case 2 skill(2,1) = skill(2,1) + amount case 3 skill(3,1) = skill(3,1) + amount case 4 skill(4,1) = skill(4,1) + amount case 5 skill(5,1) = skill(5,1) + amount case 8 skill(8,1) = skill(8,1) + amount case 9 skill(9,1) = skill(9,1) + amount case 10 skill(10,1) = skill(10,1) + amount case 11 skill(11,1) = skill(11,1) + amount case else Notice "Fatal Error:";skill END end select End Function
Function msg$(varr,log) 'notice function for messages for gameplay see array msg$() at top of code and [activate] if logx(log) > 0 then notice msgs$(varr) logx(log)=0 'null for non-infinite loop end if End Function
Function mousehandler()'finds mouse gui area 'unused 'Tile$ = MouseXY.Tilefinder$()
clickarea$ = word$(Tile$,1)
pos = val(word$(Tile$,2))
select case clickarea$
case "inventory" retur$ = inventory.handler$(selected, pos)
case "special" reset = click(lastselected, selected) prime = specialbar(specialbar)
case "four tiles" null = null case "itempickup" playerposx = player.x : playerposy = player.y reset = click(lastselected, selected) retur = pickup(selected, playerposx,playerposy, itemid, selecteditem, deleteid, pos,objl)
case "other" reset = click(lastselected, selected) end select
End Function
function click(lastselected,selected) 'resets selected when click on non clickable area of game/map if lastselected <> 0 then lastselected=0 selected=0 end if
if incombat = 1 then incombat = stopcombat() end if
'delay = pause(lag) debug = 9:debug=debug(debug)
end function
function pause(lag) ' startpausetime = time$("ms") 'for lagg = 1 to lag/div '' null = null 'add a bit of lag here ' next lagg ' pause = time$("ms")-startpausetime end function
Function item.handler(selecteditem, selecteditem, deleteid, pos, playerposx, playerposy) 'here we use a parsing parse parser parsing = inventory(selecteditem) parser = parse(parsing)' find item type id if parser = 2 then '2 = food 'DELETE ITEM, ADD HEALTH deleteid = 1 delete = deleteitem(selected, selecteditem, deleteid, pos, playerposx, playerposy,objl) deleteid = null end if if lastselected = 0 then lastselected = selecteditem selecteditem = 0 else if item(selecteditem,2) = item(lastselected,2) then 'if items second entry id matches nulled = deleteitem(selected, selecteditem, deleteid, pos, playerposx, playerposy,objl)' pos unsed nulled = deleteitem(selected, lastselected, deleteid, pos, playerposx, playerposy,objl)'pos unsed reset = click(lastselected, selected) 'reset click memory new=item(lastselected,2) retur = newitem(new,itemid) 'create new item from matched id end if end if End Function
Function parse(selecteditem) parse = item(selecteditem,2) 'find itemtypeid 0=null/regular item? 1= item 2=food 3= 4+ = new combined item id and .bmp End Function
function ship(player.x,player.y,shipid) 'set shipid everytime ' #main.gbx, "spritexy ship";shipid;" 50 50"
'if map$(player.x,player.y) = "w" then ' #main.gbx, "spritevisible ship";shipid;" on" 'else ' #main.gbx, "spritevisible ship";shipid;" off" 'end if end function
Function MouseXY.Tilefinder$() 'unused needs 64x64 mapping 'get mouse sx mouse y input prase through the 8 inventory post four tiles around player, special bar 'select case <> for each area 'return as three part string item position area string$
MouseX = MX : MouseY = MY
'item pickup if MX > (((SCREEN.WIDTH*64)/2)-32) and MX < (((SCREEN.WIDTH*64)/2)+32) then if MY > ((SCREEN.HEIGHT*64)/2)-32 and MY < ((SCREEN.HEIGHT*64)/2)+32 then pos = 1 END IF END IF
'four tiles - unused
'right hand side if MX > 400 and MX < ram then if MY >100 and MY < 200 then pos = 5 end if end if
if MX > 400 and MX < ram then if MY >300 and MY < 400 then pos = 6 end if end if
if MX > 400 and MX < ram then if MY >400 and MY < ram then pos = 7 end if end if
if MX > 400 and MX < ram then if MY >ram and MY < 600 then pos = 8 end if end if 'right handside/ 'bottom of screen
if MY > ram and MY < 600 then if MX > 100 and MX < 200 then pos = 9 end if end if
if MX > 400 and MX < ram then if MY > 200 and MY < 300 then pos = 10 end if end if
if MX > 400 and MX < ram then if MY > 300 and MY < 400 then pos = 11 end if end if
if MX > 400 and MX < ram then if MY >400 and MY < 500 then pos = 12 end if end if
'end bottom/
'four tiles
'special
if pos = 0 then pos = -1 end if
if pos > 0 and pos < 4 then clickarea$ = "four tiles" 'unused end if
if pos > 4 and pos < 13 then clickarea$ = "inventory" end if
if pos = 14 then clickarea$ = "special" end if
if pos = 15 then clickarea$ = "null" end if
if pos = 1 then clickarea$ = "itempickup" end if
if pos = -1 then clickarea$ = "other" end if
MouseXY.Tilefinder$ = clickarea$;" ";str$(pos)
End Function
Function inventory.handler$(selected, pos) 'returns item id of inventory item at position pos selecteditem = inventory(pos) if selecteditem = 0 then inventory.handler$="0" else inventory.handler$ = item.handler$(selecteditem) end if End Function
function sailing$(new.pos$,direction,player.x,player.y)
if new.pos$ = "w" then if direction <> -1 then boat = boat + 1 if boat > 2 then 'print #main.textbox, sea(player.x,player.y) 'displayship direction gfx ship[direction] end if end if end if end function
Function bank()
End Function
Function gui() 'draw sprite
End Function
Function pickup(selected, player.x, player.y, itemid, selecteditem, deleteid, pos, objl)' single item per square pickup if deleteid then null=null else deleteid = 3 end if func = deleteitem(selected, selecteditem, deleteid, pos, player.x, player.y,objl) 'delete item deleteid = null 'renew=serverexchange(serverdata) 'server exchange data 'notice "" newitem=objl func = newitem(newitem, itemid) 'create new item in inventory selecteditem=0 End function
Function deleteitem(selected, selecteditem, deleteid, pos, player.x, player.y,objl) ' TileX = left$(str$(pos,1)) ' TileY = right$(str$((pos,2))
for objl = 1 to obj.n if mapobjectX(player.x, objl) > 0 then if mapobjectY(player.y, objl) > 0 then #main.gbx, "spritexy ";obj.sprite.name$(objl);" 6400 6400" obj.x(objl)=100 obj.y(objl)=100 exitfor=1 end if if exitfor=1 then objl = obj.n end if end if mapobjectX(player.x,objl)=0 mapobjectY( player.y,objl) =0 next objl
'renew=serverexchange(serverdata)
' if deleteid = 1 then '1 = inventory ' if selected = inventory(pos) then 'debugged ' inventory(pos)=null ' end if ' end if
objl = 0 deleteid = 0 End Function
Function newitem(newitem, itemid)'multi-use selected variable also for new quest items and trade not included currently for inventorys = 1 to 8 if full = 8 then inventorys = 8 'null debug notice "Inventory full" exit for end if inventoryslot = inventoryslot+1 if inventory(inventoryslot) = 0 then 'check if slot is free if not null = null else it is a free slot inventory(inventoryslot) = newitem
inventoryid$(inventoryslot) =str$(itemid) inventorys = 8 else full = full + 1 null = null end if
'if inventory(8) > null then 'notice "item lost full" 'else 'notice "deebug" 'inputs selected data here for new item on next draw ' inventoryslot = 10' exit for ' end if 'make sure draw sprites command renews graphics
next inventorys inventoryslot = 0 newitem = 0 End Function
Function inventorygui$(object$)'draws all ten items via select case
'inventory(4)=1 'items$(4)="object1" 'inventory(5)=1 'items$(5)="object1" 'inventory(6)=1 'items$(6)="object1" 'inventory(7)=1 'items$(7)="object1" 'inventory(8)=1 'items$(8)="object1"
for inventorydraw = 1 to 10
select case inventorydraw
case 1 if inventory(1) > 0 then itemidstring = inventory(1) 'items$(1)="object1" object$ = obj.sprite.name$(itemidstring) ' print object$ print #main.gbx, "spritexy ";object$;" ";TILESIZE;" ";TILESIZE*4 'draw sprite str$(itemidstring) end if case 2 if inventory(2) > 0 then itemidstring = inventory(2)
object$ =obj.sprite.name$(itemidstring) print object$ print #main.gbx, "spritexy ";object$;" ";TILESIZE;" ";TILESIZE*5 'draw sprite str$(itemidstring) end if case 3 if inventory(3) > 0 then itemidstring = inventory(3)
object$ =obj.sprite.name$(itemidstring) print #main.gbx, "spritexy ";object$;" ";TILESIZE*2;" ";TILESIZE*5 'draw sprite str$(itemidstring) end if case 4 if inventory(4) > 0 then itemidstring = inventory(4)
object$ =obj.sprite.name$(itemidstring) print #main.gbx, "spritexy ";object$;" ";TILESIZE*3;" ";TILESIZE*5 'draw sprite str$(itemidstring) end if case 5 if inventory(5) > 0 then itemidstring = inventory(5)
object$ = obj.sprite.name$(itemidstring) print #main.gbx, "spritexy ";object$;" ";TILESIZE*4;" ";TILESIZE*5 'draw sprite str$(itemidstring) end if case 6 if inventory(6) > 0 then itemidstring = inventory(6)
object$ =obj.sprite.name$(itemidstring) print #main.gbx, "spritexy ";object$;" ";TILESIZE*5;" ";TILESIZE*5 'draw sprite str$(itemidstring) end if case 7 if inventory(7) > 0 then itemidstring = inventory(7)
object$ =obj.sprite.name$(itemidstring) print #main.gbx, "spritexy ";object$;" ";TILESIZE*7;" ";TILESIZE*5 'draw sprite str$(itemidstring) end if case 8 if inventory(8) > 0 then itemidstring = inventory(8)
object$ = obj.sprite.name$(itemidstring) print #main.gbx, "spritexy ";object$;" ";TILESIZE*7;" ";TILESIZE*4 'draw sprite str$(itemidstring) end if end select
next inventorydraw End Function
function health(health) select case health
if health < 25 then #main.gbx "spritexy object8 40 20" end if
if health > 30 and health < 49 then #main.gbx "spritexy object9 40 20" end if
if health > 49 and health < 65 then #main.gbx "spritexy object10 40 20" end if
if health > 65 and health < 80 then #main.gbx "spritexy object11 40 20" end if
if health > 80 then #main.gbx "spritexy object12 40 20" end if
end function
Function specialbargui(special) if special = 100 then
#main.gbx "spritexy object17 20 100" 'draw sprite special(1) end if if special = 75 then #main.gbx "spritexy object16 20 100"
'draw sprite special(2) end if ' if special = 66 then 'end if if special = 50 then #main.gbx "spritexy object15 20 100" end if ' if special = 33 then ' end if if special = 25 then #main.gbx "spritexy object14 20 100" end if if special = 0 then #main.gbx "spritexy object13 20 100" 'draw sprite(7) end if End Function
Function gamedatahandler() GameData$ = str$(vvar)'after retriving server data .db and loading to vvar
'set lenindex 'using 10 len string of a number var to indicate animaition bmp set for indexable = 1 to lenindex animationfinder$ =mid$(GameData$, 10, indexable)
if left$(animationfinder$, 2) = "10" then '10 indiates animation code 100100001-109959999 direction 01 animations 0000001 "-" is a invisble logical divider for reading purposes only not code animationgfx$(currentanimations)=right$(animationfinder$,8) end if if left$(datafinder$, 2) = "11" then 'username 8 char usernames$(indexable)=right$(datafinder$,8)'need to maintain GameData$ order with indexable end if
' if left$(datafinder$, 2) = "12" then '12- health Note: health luck skill are all client based non transferring data to server saved on local file; if you want, encypted ' health$(indexable)=right$(datafinder$,3) '7 open variable slots here ' end if
if left$(datafinder$, 2) = "13" then 'hit hit$(indexable)=right$(datafinder$,7) ' 1-4 direction xxyy 2-hit 1-40ish 'one avalible variable here end if
if left$(datafinder$, 2) = "14" then 'playerxy xxyy : 0099 playerxy$(indexable)=right$(datafinder$,4) 'option for second input of quick move being different before being read need to change current loop' end if
if left$(datafinder$, 2) = "17" then ' trade$(indexable)=right$(datafinder$,8)'trade item id 000-999 | direction 1-4 | tradeoffer item id 000-999 example 0012520 item 001 traded for item 520 with direction 2 of player view (to find other player in the data) end if
if left$(datafinder$, 2) = "18" then 'basic chat txt = txt + 1 txt$(txt)=time$("ms");" ";str$(indexable);" ";right$(datafinder$,8) end if
if left$(datafinder$, 2) = "19" then ''19 option gives an addition 8 charcters to message txt$ = txt$(txt) txt$(txt)=txt$;" ";right$(datafinder$,8) end if
if left$(datafinder$, 2) = "20" then ''20 option gives an addition 8 charcters to message 0000... ect is blank txt$ = txt$(txt) txt$(txt)=txt$;" ";right$(datafinder$,8) end if
if left$(datafinder$, 2) = "25" then ' txt$ = txt$(txt) txt$(txt)=txt$;" ";right$(datafinder$,8) end if
next indexable txt=0 End Function
'combat
Function stopcombat() stopcombat = null 'return 0 as if then not allowing combat next loop End Function
Function weaponattackgfx(weapontiming,weaponofchoice) weapontiming = weapontimes(weaponofchoice) timeweapon = time$("ms") 'display weaponbmp(weaponofchoice) middle of screenXY, while time$("ms") < timeweapon+weapontiming ' #main.gbx "spriteImage wgfx wgfx";spi;".bmp" wend 'display bmp2
End function
Function attack(attacktime, attacktimer, attacktime1, attacktime2, luck)'via button if attacktime1 > 0 then if a = 5 then a = 0 end if end if a = a + 1 attacktime = attacktime(a) - luck*luck '16-18 15-19 ' if attacktime+attacktimer<attacktime2+attacktime+luck then '* gotoattack = 1 attacktime = 0 : attacktimer = 0 : attacktime2 = 0 : attacktime1 = 0 ' end if attack = gotoattack End Function
Function defend(defendtimer, defendtime1, defendtime2, luck)'via space bar or key
if defendtime1 > 0 then if b = 5 then b = 0 end if end if b = b + 1
defendtime = attacktime(b) - luck*luck '16-18 15-19 using array for both if defendtime+defendtimer<defendtime2+defendtime+luck and defendtime+defendtimer>defendtime2+defendtime+luck then defend = (defendtime2-defendtime1)/2+luck' defendtime = 0 : defendtimer = 0 : defendtime2 = 0 : defendtime1 = 0 end if End Function
Function specialbar(special) 'mouse click if weaponspecial < special then 'see if there's enough special left special = special - weaponspecial 'subtract special end if incombat = stopcombat() ' require reclick? specialbar = special End Function
'luck
Function limiter(time2,time1,ms,buffer,timestatement) 'need for to be implemneted on a faster machine, possible a more lite weight os if time2-time1 < ms then timestatement = (time2-time1)-int(luck*3+1) limiter = timestatement end if End Function
'filesystem 'see bottom of code datafunction() data function
'animations
Function animations()
'display x y starts and stops 'step program thru loop 8 frames; (4) animation frames twice per theoretical slowed down second 1000ms / 8 'count 'aninum = count ' readnow= loadanimations() 'for ani = 0 to readnow ' print #w.g, "addsprite ";animation$;" "animation1$;" ";animation2$;" "animation3$ ' print #w.g, "cyclesprite ";animation$;" 1" ' print #w.g, "spritemovexy ";animation$;" 4 0" ' loadnanimations = aninum End Function
Function setup() 'credit to cundo #main.gbx "setfocus;" ;_ "When characterInput [keys]; ";_ "Getbmp back.bmp 1 1 10 10;" ;_ "Background back.bmp;" ;_ "DRAWSPRITES" End Function
Function globalint$(playerfile$,downloadfile$,offline$) playerfile$="player" downloadfile$=playerfile$+"A" 'attribute to files, will add "offline" to name if player is not online offline$="OFFLINE"' not used currently End Function
'splashscreen loading menu
Function splashscreen(percentage,TILESIZE, SCREENWIDTH, SCREENHEIGHT, OFFSET, GAMEWIDTH, GAMEHEIGHT,BackgroundColor$,UpperLeftY, UpperLeftX) select case percentage case 1 '11 bmps. 10 with percentages
'start first screen case 5 '5, ect. case 10
case 20
case 30
case 40
case 60
case 67
case 70
case 95
case 98
delay=pauses(lag) 'a bit of epic pause here, hopefully be used later in-game delay=pauses(lag) case 100
case else errornumber = 1 null = noticeerror(errornumber,percentage,null) end end select End Function
'pause function null Function pauses(lag) for paus = 1 to 4 'ready game window delay=pauses(lag) next paus End Function
'extras
Function fps(fps,time,loopx) 'print #main.gbx, "/text fps(";int(actualfps) End Function
'commands unsable right now Function commands$(inputcommand$) 'EXAMPLE: 'ctrl$+map/npc/oject 0X 0Y refID$' then [Enter] key ctrl$ = "S" 'COMMAND KEY INT. -> "S" char. if left$(outputchat$, 1) = ctrl$ then commands = commands + 1 'keep track of commands commandsarray$(commands) = word$(outputchat$,1) commandtype$ = commandsarray$(commands) xmap= val(word$(inputmap$, 2)) ymap= val(word$(inputmap$, 3)) mapcommandtile$ = word$(outputchat$, 4)
print ":COMMANDISSUED:SET>";left$(outputchat$, 4);" ";str$(xmap);" ";str$(ymap);"<"; word$(outputchat$,4) ;">tileRefID$: "
select case commandtype$ case "Smap" map$(xmap,ymap)=mapcommandtile$ 'actual input line command here case "Snpc" ' = val(mapcommandtile$) npc.x(null) =xmap 'update game data here npc.y(null) =ymap 'npc object commands case "Sobject"
case "Sitem"
case else notice "invalid entry" end select
commands$=commandtype$ 'for ref end if End Function 'debug Function debug(debug) if debugnull = 1 then select case debug
case 2 notice frames;" x ";seconds;" seconds / frames (Double Click) [ENTER]" notice "Continue [enter]" 'pause break case 3 print currentplayercount;" current player count" case 4 print (time2-time1);" ms game compiled frame in pause of no input, ";timestatement;" lag/wait until next frame of scaaning input, enter pauses here for verifying SCAN and Input [keys]" timerstatement = timerstatement' - buffer case 5 timerstatement = timerstatement + 1000 * seconds ' wait for debug next frame case 6 print "closing for now 0% upload not featured in code yet" case 7 print playerpos$ 'debug case 8 print hit case 9 print delay delay = 0 case 101 ' print time$("ms") - clickms case 1000 loopx = loopx + 1 clientloop = clientloop + 1
if clientloop = frames*seconds then 'frames = 10 FPS, refer fps() for actual fps clientloop = 0
debug = 2:debug = debug(debug)
timer 1000*seconds, [timer] wait
' text=loadtext() 'load text once per second end if end select debug = 0 'reset debug end if End Function
'fail to load error notice Function noticeerror(errornumber,percentage,null) notice "32x linux only; windows 64/32" select case errornumber case 1 notice "ERROR ";errornumber;" ";percentage;" loaded." case 2 notice "ERROR ";errornumber;" ";null;" loaded." case 3 notice "ERROR ";errornumber;" ";null;" loaded." case else notice "ERROR ";Err$;" ";null;"null number" end select end function
'download every users file of "XX YY" 'add more data here 'now$ = uploadtolan$(updateXY$,npcname$,healthnull,myg) ' currentplayercount$ = playercount$(playerfile$,count$,playercount) 'for PID = 1 to val(currentplayercount$) 'download every users file of "XX YY" 'add more data here ' cache$ = downloadplayerfile$(PID, currentplayercount) 'function downloads pid file and updates npc.x(pid) npc.y(pid) ' playerfiles$(PID) = cache$ 'next PID 'next playercount loop ' updateXY$ = playerpos$(player.x,player.y, screen.y, screen.x, map.x, map.y)
Function serverexchange(serverdata) 'BASIC MODAL LOGIC SET gather= datafunction() 'fileserverformat line1 line2 animtion1 username2 hit1 health2 direction1 trade2 chat 'nulled line '00000001-00002002 = animation1 usernamee " b b" '... - ... hit health '00315205-00402002 = tradeitem003 direction 1 for item 5205 '27010203 = "zaba" chat input 'chat is parsed two charcters at a time with a total of 4 characters serverexchange = gather End Function
Function datafunction() 'actual server End Function
Function serverexchangetrade(userID,player.x,player.y,direction) null = null End Function
Function trade() 'unfinished exchang = serverexchangetrade(userID,player.x,player.y,direction) 'deleteitem(selected) 'newitem()=exchange End Function
' ' A|ways Missing function select$(s$)
if left$(s$,1)="," then nextvarl = 1 end if if right$(s$,1)="," then nextvarr = 1 end if
if nextvar1 = 1 then nextvar1 = 0 select$ = right$(s$,1) s$="" end if
if nextvarr = 1 then nextvarr = 0 select$ = left$(s$,1) s$="" end if if s$<>"" then select$ = s$ end if end function
Will be adding 4 bi partial rotation of ship for "turning", file format to add info into arrays from .txt document rather then hard coding 1000, sprites manually.
Animations are next, then file server and implementation to clients, last sprite mask read parse and fill story/lore data for the actual game
|
|
atomose
Member in Training
Posts: 32
|
Post by atomose on May 24, 2021 8:44:15 GMT
code cant work because i havent .bmp files ^^ ....
|
|