Search found 635 matches

by citystate
Mon Dec 03, 2018 12:23 am
Forum: Game Programming
Topic: SQL driven MUD
Replies: 5
Views: 3301

Re: SQL driven MUD

CLIENT.pb OpenConsole() ;EnableGraphicalConsole(1) InitNetwork() a$="127.0.0.1" port=8080 c=CountProgramParameters() If c a$=ProgramParameter() If c>1 port=Val(ProgramParameter()) EndIf EndIf sv=OpenNetworkConnection(a$,port) Procedure thread(sv) While 1 Delay(0) ne=NetworkClientEvent(sv)...
by citystate
Mon Dec 03, 2018 12:22 am
Forum: Game Programming
Topic: SQL driven MUD
Replies: 5
Views: 3301

Re: SQL driven MUD

dbsetup.txt #create table if not exists [1]([2]) last~label char primary key,id integer,error char com_~id integer primary key autoincrement,tick integer,sent integer default 0,who integer,message char log~id integer primary key autoincrement,tstamp char default current_timestamp,actioned integer,w...
by citystate
Mon Dec 03, 2018 12:21 am
Forum: Game Programming
Topic: SQL driven MUD
Replies: 5
Views: 3301

Re: SQL driven MUD

dammit :? I was hoping to make it easier for peeps - I'll just c/p below - it's a little large, so I'll break it up into three posts you'll need to save everything in the same directory MOTA.pb CreateRegularExpression(0,"[\w()\d\-'#$%^&*+/\\]+(\.\d+)?|(["+#DQUOTE$+"])[\w()\d\s\-'#...
by citystate
Fri Nov 30, 2018 3:19 am
Forum: Coding Questions
Topic: DatabaseUpdate SQLite update method not working
Replies: 10
Views: 1541

Re: DatabaseUpdate SQLite update method not working

if a record doesn't exist, Sqlite ignores an UPDATE - I prefer to use INSERT OR REPLACE (making sure that recno is a primary key) ; ▼ ▼ ▼ the code below goes to UPDATE COMPLETED i.e., no error on update but the PWS10 table is not updated with the changes SetDatabaseLong(0,0,DBRECNO) SetDatabaseStrin...
by citystate
Mon Nov 26, 2018 5:47 am
Forum: Coding Questions
Topic: Restore from a variable.
Replies: 3
Views: 990

Re: Restore from a variable.

macros might do the trick

Code: Select all

Macro test(label)
  Restore label
EndMacro

test(dat1)
For i=1 To 4:Read.b a.b:Debug a:Next
test(dat2)
For i=1 To 4:Read.b a.b:Debug a:Next

DataSection
  dat2:
  Data.b 5,6,7,8
  dat1:
  Data.b 1,2,3,4
EndDataSection
by citystate
Mon Nov 26, 2018 5:18 am
Forum: Game Programming
Topic: SQL driven MUD
Replies: 5
Views: 3301

SQL driven MUD

a few months ago, there was a post about creating a Multi-User Dungeon in Purebasic (but I can't seem to be able to find it now) in any case, I started experimenting with a couple of different ways to code it - I'm hoping you guys might find my attempt as interesting as I do :) the linked zip consis...
by citystate
Wed Nov 21, 2018 5:04 am
Forum: Tricks 'n' Tips
Topic: Calculate last day of month
Replies: 20
Views: 4019

Re: Calculate last day of month

why not use PB's inbuilt date functions? That example fails for December: today=Date(2018,12,25,0,0,0) first=AddDate(today,#PB_Date_Day,1-Day(today)) last=AddDate(AddDate(first,#PB_Date_Day,-1),#PB_Date_Month,1) Debug "xmas "+FormatDate("%dd/%mm/%yyyy",today) Debug "first &...
by citystate
Wed Nov 21, 2018 4:41 am
Forum: Coding Questions
Topic: SQLite using Variables with SELECT and WHERE
Replies: 7
Views: 2364

Re: SQLite using Variables with SELECT and WHERE

try something like this, perhaps? SetDatabaseLong(0,0,DBRECNO) If DatabaseQuery(0,"SELECT RecNo, GroupBy, Email, Name,...... FROM PWS10 WHERE RECNO = ?") ...... ...code Else mDBErr = DatabaseError() ; -> returns zero unless a literal Endif the SetDatabase X commands allow us to insert valu...
by citystate
Mon Nov 19, 2018 2:18 am
Forum: Tricks 'n' Tips
Topic: Calculate last day of month
Replies: 20
Views: 4019

Re: Calculate last day of month

why not use PB's inbuilt date functions? today=Date() first=AddDate(today,#PB_Date_Day,1-Day(today)) last=AddDate(AddDate(first,#PB_Date_Day,-1),#PB_Date_Month,1) Debug "today "+FormatDate("%dd/%mm/%yyyy",today) Debug "first "+FormatDate("%dd/%mm/%yyyy",first)...
by citystate
Mon Mar 19, 2018 5:36 am
Forum: Coding Questions
Topic: Including icons into code
Replies: 8
Views: 2148

Re: Including icons into code

technically you have been creating the images with CatchImage() - this command loads an image from memory ordinarily, I'd load all my images with specific image_numbers, and then assign them to the ButtonImageGadgets by number (this way you can reuse images easily without having to reload them - hel...
by citystate
Tue Jan 30, 2018 11:49 pm
Forum: Coding Questions
Topic: Keyboard input hangs after approx 30 minutes
Replies: 15
Views: 3077

Re: Keyboard input hangs after approx 30 minutes

nco2k wrote:the whole delay thing is total nonsense. this sounds more like some sort of energy saving issue.

c ya,
nco2k
in my defense, as my sig states, I may be talking out of my hat :?
by citystate
Tue Jan 30, 2018 4:07 am
Forum: Coding Questions
Topic: Keyboard input hangs after approx 30 minutes
Replies: 15
Views: 3077

Re: Keyboard input hangs after approx 30 minutes

I'd imagine it has something to do with the lack of Delay() in your main loop; your code would be taking most of your system's processing, which could cause problems if another process attempts to run
by citystate
Thu Jan 25, 2018 2:45 am
Forum: Coding Questions
Topic: Image memory contents
Replies: 8
Views: 1773

Re: Image memory contents

this perhaps, then? Procedure CopyContent_Image_Canvas(source_ID, destination_ID, output_x, output_y, new_size_x, new_size_y) temporary_ID=CopyImage(source_ID,#PB_Any) If IsImage(temporary_ID) ResizeImage(temporary_ID,new_size_x,new_size_y) If StartDrawing(CanvasOutput(destination_ID)) DrawAlphaImag...
by citystate
Mon Nov 20, 2017 11:44 pm
Forum: Coding Questions
Topic: What is the right way to debug a threaded proc
Replies: 5
Views: 1611

Re: What is the right way to debug a threaded proc

My main method, as spikey suggests, is to separate the threaded portion into a non-threaded procedure - that way, using breakpoints and program stepping, you can see what the thread is doing - also, display your variables with the debugger window
by citystate
Mon Oct 30, 2017 1:06 am
Forum: Coding Questions
Topic: Alternative way of addressing elements of a structure?
Replies: 9
Views: 2103

Re: Alternative way of addressing elements of a structure?

would using an array of pointers work for you?