o0oiiijoshiiio0o // User Search

o0oiiijoshiiio0o // User Search

1  2  |  

encryption

Jun 25, 2002, 12:15am
bleh. ive been programming mostly c++, but for anyone doing that that wants
some basic encryption, sorry for the uselessness of this, im tired, but
here's the basis of an XOR encryption. because im not gunna put that much
effort into it, this will only work on strings of the same length
char* XOR(char* buffer, char* key)
{
char* m_return;
for(x = 0; x <= strlen(buffer); x++)
{
m_return[x] = buffer[x] ^ key[x];
}
return m_return;
}

the way this works is XOR is a bitwise operation where things that are the
same return a 0 (false) otherwise a 1 (true) so if you had to name it a
function, you might call it IsDifferent().

this way....
11110000 ^ 00001111 = 11111111
10101010 ^ 01010101 = 11111111
11110000 ^ 10101010 = 01011010

fairly easy to crack though:
11110000 ^ 00001111 ^ 11110000 = 00001111

so, be careful not to use this on things where the user will know what the
buffer is equal to, like chat...

and a demonstration on how this works for strings is
This is the string that we'll encrypt
^ ababababababababababababa

is T^a, h^b, i^a, etc....

if you wanted to have varied length keys and buffers, the finished
encryption would end up looking like this:

This is the string that we'll encrypt.
XORKEYXORKEYXORKEYXORK

where you just repeat the key to match the number of chars in the buffer.

ok, im sorry, i just had to post sometime or id explode from being off of
the NGs for so long. enjoy, if it's any use to you whatsoever. and i know
this was originally about VB :P

-J

[View Quote]

yab (yet another bot)

Oct 10, 2002, 9:03pm
Hey hey hey. Don't oversimplify. C/++ can be made as huge or small as the
owner has in power. VB is a set size. I guarantee you my C version of that
would be far smaller...

-J

[View Quote]

something strange about the SDK

Jun 12, 2002, 10:48am
blah. the sdk is loaded with strange stuff. keep in mind that we have the
bot telegram stuff and it's just not turned on? i believe luke knew how to
get access to all that stuff...
-J

[View Quote]

Gap in terrain?

Jun 25, 2002, 7:57pm
Is it possible to take out a chunk of the terrain so as to say add a cave
system?
-J

Gap in terrain?

Jun 25, 2002, 8:04pm
woah, you're right here. if i say something, will you respond in 5 minutes?
;-)
-J
[View Quote]

Gap in terrain?

Jun 25, 2002, 8:05pm
oh hey i get it! i always wondered what that hole button did.
[View Quote]

Gap in terrain?

Jun 25, 2002, 8:07pm
and... is there any way i can undo a hole? hahahaha.
[View Quote]

Multithreading Tutorial (Was to be "Is there a wait command?")

Jul 17, 2002, 10:34am
Multithreading is a good thing. I'll give you some code to get you started,
but be warned that my code actually only waits 5 between saying it will wait
5 and saying it has waited 5 - it won't stop its other actions from running.
Excersise for the student, not the woke-up-10-minutes-ago teacher ;)

#include <windows.h>
#include <aw.h>
#include <time.h>

HANDLE d_ThreadHandle;
DWORD d_threadID;
bool d_IsRunning;

int StartTime;
int TimeToFinish;

void TimerStarter()
{
aw_say("Behold, as I wait a marvelous 5 seconds!");

// Check to make sure a handle doesn't already exist.
if(d_ThreadHandle)
{
return;
}

// Create the thread to run immediately. TimerTimer is the actual
procedure
d_ThreadHandle = CreateThread(NULL,
0,
(unsigned
long (_stdcall*)(void*))TimerTimer,
0,
0,

(LPDWORD)&d_threadID);

if(d_ThreadHandle)
{
// An error occured. GetError will return a DWORD that you can look
up on msdn.microsoft.com
}

d_IsRunning = true;

// StartTime = ??? I still don't have my K&R at my desk, but look up
time.h
// TimeToFinish = StartTime + <5 seconds. Implement this depending on
which
// member of the time_t you just used a second ago>
}

DWORD WINAPI TimerTimer()
{
// This is the thread procedure function. Think main() for the thread.
//int CurrentTime = <make this identical to the StartTime = from before>

if(TimeToFinish - CurrentTime <= StartTime)
TimeFinish();

return 0;
}

void TimeFinish()
{
// Called when our 5 seconds are up

aw_say("Tada! 5 seconds!");
d_IsRunning = false;
CloseHandle(d_ThreadHandle); // Normally we'd use
WaitForSingleObject, but
// we know because this function was called, it's done.
d_ThreadHandle = NULL;
}

Now you can call TimeStart() from your main thread, and there'll be 5
seconds between one message and the next (but it won't actually stop the
rest of your program). Shamus told me that the SDK isn't thread safe but
single instance programs should be fine, so..... keep that in mind. Check
d_IsRunning to see if the thread has finished yet... Ask me if you need help
with actually understanding the concept of threads...

Another important thing is thread safety. To show the necessity...

Take, for example, a program that has two functions that create threads:

FindObjectInList
DeleteEntireList

and they're designed to manipulate your linked list (Aww, come on, surely
you know how to do that. They're so much fun! ::shrugs:: ask me if not).

However, if you call DeleteEntireList, and then FindObjectInList,
FindObjectInList may traverse right onto an empty pointer, thus creating a
serious problem... Actually, probably a crash of your program.

What you need is a Mutex (Mutual Exclusivity Operator, or something like
that). Mutex's are like those red-and-green lights on the railroad tracks.
They say, ok, now it's safe for one guy to go, now it's safe for the other.
As long as you aren't playing with the same toys at the same time, sharing
can be fun.

I'm not actually going to give you code beyond copy-pasting from something
of mine that's only a slight modification on elsewhere's code. I have two
functions, one for a blocking mutex and one for a non-blocking mutex. I'm
gunna give you the blocking mutex.

Works simple: For your valuable data (like your list) you make an instance
of the mutex. Whenever you need to access it, you call MutexOn();... If it
is off, it's turned on and now you can access the data. If it is turned on,
it stops you from going (that's the blocking part) until the other guy calls
MutexOff, at which point you're good to access the data. When you're done,
you call MutexOff();.


class cMonitor
{
HANDLE d_mutex;

public:
cMonitor()
{
// This mutex will help the two threads share their toys.
d_mutex = CreateMutex( NULL, false, NULL );
if( d_mutex == NULL )
throw cError( "cMonitor::cMonitor() - Mutex creation failed." );
}


virtual ~cMonitor()
{
if( d_mutex != NULL )
{
CloseHandle( d_mutex );
d_mutex = NULL;
}
}

void MutexOn() const
{
WaitForSingleObject( d_mutex, INFINITE ); // To be safe...
}

void MutexOff() const
{
ReleaseMutex( d_mutex ); // To be safe...
}
}

-J

[View Quote]

Multithreading Tutorial (Was to be "Is there a wait command?")

Aug 1, 2002, 8:39pm
Ahahah. Yeah. That was stoooopid of me. Well, it should have a loop that
checks the difference and calls the finisher once there is none... Oops.

-J

[View Quote]

Converting a Co-ord String to API Usable

Jul 17, 2002, 11:41pm
Ah, all those replies and no working code. It makes me feel wanted. The
function I use is strtok, since it's ANSI C. I believe the header on that
one is string.h. Note that I almost ALWAYS use STL string... more
versatile... just
#include <string>
using namespace std;
and then you can do string MyString.... but calling my soon-to-be-listed
parse function with a string of any other type that I've ever tested with
would work fine.

This will take a string like "1000 -1000 10 90" and fill in the soon to be
shown Coordinates struct. As an excersize (oh God, it must be summer) for
the student, I'm not gunna deal with the characters NSEW, and use negative
numbers instead.

struct Coordinates
{
int x;
int y;
int z;
int yaw;
};

Coordinates *GetCoordinates(string ParseFrom)
{
char *token;

Coordinates ParseReturn;

token = strtok(ParseFrom.c_str(), " "); // 1234n 5678e leaves token as
// 1234n
ParseReturn.x = atoi(token);

token = strtok(NULL, " "); // parse between the first two spaces
ParseReturn.z = atoi(token);

token = strtok(NULL, " ");
ParseReturn.y = atoi(token);

token = strtok(NULL, " ");
ParseReturn.yaw = atoi(token);
}


So as a quick recap, if you have a string like -1234 5678 9 10

You can do Coordinates MyCoords = GetCoordinates(string); and then access
members of the structs.

Of course, since I'm dealing with pointers and don't have any coffee on my
desk, that's a sign that you want to test and come back during the day hours
if this doesn't work. I know how to do it; I've done it before. Just
::yawn:: tired.

-J


[View Quote]

Converting a Co-ord String to API Usable

Jul 18, 2002, 11:32am
Well, of course, but I always give snippets for my ideas and no one's
mentioned strtok...
-J

[View Quote]

[VB SDK] EventTelegram

Aug 1, 2002, 8:41pm
Exactly. It's a fully functional (I assume) set of functions and events that
are not enabled, so that it would be easy to support in later builds. At
least, that's what I was told, and what I've come to believe, but either
way, there's nothing you can do with it at the moment. (Unless you're Luke
;)

-J

[View Quote]

[VB SDK] EventTelegram

Aug 2, 2002, 10:16am
Well, whether he is or whether he isn't, I happen to have known Luke to have
accessed these functions, eh?

-J

[View Quote]

New to C++, how to make it work with an interface?

Aug 9, 2002, 9:32pm
Did you include aw.lib?

-J

[View Quote]

Help me I want to learn how to make bots

Aug 14, 2002, 12:35pm
do you already program? if so, what language?

in c/++, www.activeworlds.com/sdk
in any other language, ask around but i cant help you

if not, you'll need to do that first, pick up a good book on a good language
(again, i recommend c/++)

-J

[View Quote]

Bingo Bot

Jun 28, 2002, 1:08am
Working on it.
-J
[View Quote]

The moment about two of you have been waiting for!

Jun 28, 2002, 9:57am
http://www.planet-safira.com/botspot/

My beautiful fractal terrain bot. It's shown its ability to do smooth
rolling hills, mountains, ledges, all sorts of stuff. My personal favorite
terrain bot, if I may say so myself ;)

Sorry that the webpage is as... errr... hideous... as it is. I was just
rushing to be ready for Cys ;)

-J

The moment about two of you have been waiting for!

Jun 29, 2002, 11:22am
no, but he was so kind as to host the page for me :D
-J
[View Quote]

Is there a wait command?

Jul 15, 2002, 9:14am
aw_wait can be used, as is seen in the AW SDK sample program #2 (the DJ).
That's the way I'd advise you to do it, though if you're using MFC, there
are others...
[View Quote]

Is there a wait command?

Jul 16, 2002, 9:50am
Not designed for that purpose, but that didn't stop the fine people at AW ;)

Anyways, the alternative is to include time.h - I don't have my K&R on hand
(:O) so I can't tell you how to do it, but I know that you get a time_t
struct with all sorts of time information..

-J

[View Quote]

New nifty terrain tool: BMP2TER

Aug 14, 2002, 1:15am
Not tested at all, so all of you that find bugs... enjoy and contact me.

A simple bot, this takes greyscale windows bitmaps and loads them into the
world.

Run as follows:

BMP2TER 327603 YouWish beta 10000 c:\pictures\greyscale\josh.bmp

where it's... cit#, ppw, worldname, max height (this is denormalized, so a
white pixel in the bmp image will be equal to maxheight), and file path.

Enjoy.

-J

New nifty terrain tool: BMP2TER

Aug 16, 2002, 12:56am
::cough:: Alright, my apologies. I had caughed it up in ten minutes and was
proud of myself for my lightning-speed ;)

-J

[View Quote]

Lister Version 1

Aug 22, 2002, 11:32am
In C/++, call break;

-J

[View Quote]

Another AW employee gone!

Aug 5, 2002, 12:25am
Newburyport... I swear to god I have to bike ride up there sometime. It
would probably mean camping overnight once there and once back, but that's
certainly a price to pay for some major AWC-employee nose-honking... isn't
that right, Agent? ;)

-J

[View Quote]

Another AW employee gone!

Aug 5, 2002, 8:39pm
Please spare me any more of these messages. They're terribly funny to
read... ::cough:: OK, I lied there. But... blah.

-J

[View Quote] ** So that was going to be, observe his nose? heh.

> He will notice
> that all of my posts have had the email changed from the very start.
> lol
> YET it takes him umpteen posts later to notice that fact... That shows
> right off where his nose has been.... Up this poor "KIEFFER's" butt.
>
> Will someone in the NG community do us all a little favor.... Stick
> your nose up Goober's Butt.... And then write a news article on how
> clean or DIRTY it is. lol
> It sould really make for an interesting read. lol

** What's all this laughing for? It's not funny.

> ===============================================
> "goober king" <gooberking at utn.cjb.net> wrote in news:3D4EA527.5030806
> at utn.cjb.net:
>
> may
>
>

Another AW employee gone!

Aug 5, 2002, 8:43pm
I knew some day I'd read something funny tracing flames like this.

-J

[View Quote]

Another AW employee gone!

Aug 5, 2002, 8:44pm
Oh my. What am I reading? WHAT IS THIS WORLD COMING TO? WE ARE ALL DOOMED!
DOOMED, I SAY! DOOMED!!!!!!

::cough:: Sorry....

Really folks...

-J

[View Quote]

Another AW employee gone!

Aug 5, 2002, 11:31pm
Where might I find that guide of which your sig speaks?

-J

::snip::

> From the Newbie's Guide to the AW NG:
>
> "Nornny11 - The original wishy-washy man, this one can actually insult
you
> and compliment you in the same breath, and in the end say absolutely
> nothing! What a talent!"

::snip::

Another AW employee gone!

Aug 6, 2002, 9:55am
If you prefer it so much, how come such a large chunk of this argument was
made by... you?

-J

[View Quote]

Another AW employee gone!

Aug 7, 2002, 8:17pm
::shrugs:: Little to nothing. That bother you too?

-J

[View Quote]

1  2  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn