ParanoiaPhD submitted a new resource:

An OpenAI Bot Script (SUPER EASY SETUP) - It's the same as being on chatgpt

Add this to the bottom of scripts.csproj...

<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Other project settings -->
<ItemGroup>
<!-- Other references -->
<Reference Include="System.Net.Http" />
</ItemGroup>
<!-- Other project configurations -->
</Project>

THEN!!!

All u need is a chatgpt API and put some money in the system... plug in ur api. load the script. Plop in the bot and presto...

Read more about this resource...
 
ParanoiaPhD updated An OpenAI Bot Script (SUPER EASY SETUP) (UPDATED!! NOW WITH CHARACTERIZATION) with a new update entry:

Standard NPC AI Bot Script - (Fully customizable)

I notice my last update seemed to fail or revert. This time I'm keeping my eyes on it. This script was simplified and is meant to simply add a blank NPC that players can talk to with a specific personality into the game that will stay put and walk around like a normal npc. USE this script to create NPCs that sell stuff, act as quest givers, etc! Do what ever you want just send the whole script to claude.ai and tell Claude to help you make it into something else and Claude will... I hope you...

Read the rest of this update entry...
 
Contribute a version of RUNUO2.0:
=============================================

Using System;
Using Server;
Using Server Items;
Using Server Mobiles;
Using System IO;
Using System Net;
Using System Text;
Using System Threading;

Namespace OpenAIBot
{
[CorpseName ("BOT's corpse")]
Public class OpenAIRPC: BaseCreation
{
Private const string OpenAIKey="sk -";
Private const string OpenAIEndpoint=“ https://api.openai.com/v1/chat/completions ";
Private string'botPrompt="Your word";
[Constructible]
Public OpenAIRPC(): base (AIType.AI-Melee, FightMode. None, 10, 1, 0.2, 0.4)
{
Name="OpenAI Bot";
Body=0x190;
Hue=0x83EA;
SpeedHue=0x23F;
//BaseSoundID=0x482;

SetStr (100);
SetDex (100);
SetInt (100);
SetHits (500);
SetStam (100);
SetMana (100);
SetDamage (10, 20);

SetSkill (SkillName. EvalInt, 80.0);
SetSkill (SkillName. Magery, 80.0);
SetSkill (SkillName. MagicResist, 80.0);
}


Public OpenAIRPC (Serial serial): base (serial)
{
}

Public override void OnSpeech (SpeedEventArgs e)
{
Base OnSpeech (e);
If (e.Mobile is PlayerMobile&&! (PlayerMobile) e. Mobile) Deleted
{
String question=e.Speech Trim();

Thread thread=new Thread (new ThreadStart (delegate())
{
Try
{
String response=AskOpenAI (question);
Say (response);
}
Catch (Exception ex)
{
Console WriteLine ("Error in OpenAIRPC. OnSpeech:"+ex. Message);
Console WriteLine ("Error Stack Trace:"+ex. StackTrace);
}
});
Thread Start();
}
}

Private string AskOpenAI (string question)
{
Try
{
HttpWebRequest request=(HttpWebRequest) WebRequest Create (OpenAIEndpoint);
Request Method="POST";
Request Headers Add ("Authorization", "Bearer"+OpenAIKey);
Request ContentType="application/JSON";
Request Timeout=60000;

String requestBody="{" model ":" gpt 3.5 turbo "," messages ": [{" role ":" system "," content ":"+_botPrompt+"\"}, {"role": "user", "content": "+question+" \ "}";
Byte [] requestBodyBytes=Encoding UTF8. GetBytes (requestBody);
Request ContentLength=requestBodyBytes Length;

Using (Stream requestStream=request. GetRequestStream())
{
RequestStream Write (requestBodyBytes, 0, requestBodyBytes. Length);
}

Using (HttpWebResponse response=(HttpWebResponse) request GetResponse()
Using (Stream responseStream=response. GetResponseStream)
Using (StreamReader reader=new StreamReader (responseStream))
{
String responseBody=reader ReadToEnd();

Int contentIndex=responseBody IndexOf (content: );
If (contentIndex!=-1)
{
Int startIndex=contentIndex+. Length;
Int endIndex=responseBody IndexOf ("\", startIndex);
If (endIndex!=-1)
{
String assistantMessage=responseBody Substring (startIndex, endIndex - startIndex);
Return assistantMessage;
}
}

Return "Unable to generate a response.";
}
}
Catch (Exception ex)
{
Console WriteLine ("Exception in OpenAIRPC. AskOpenAI:"+ex.Message);
Console WriteLine ("Exception Stack Trace:"+ex. StackTrace);
Return "An error occurred while generating a response.";
}
}



Public override void Serialize (GenericWriter writer)
{
Base Serialize (writer);

Writer Write ((int) 0)// Version
}

Public override void Deserialize (GenericReader reader)
{
Base Deserialize (reader);

Int version=reader ReadInt();
}
}
}


======================================================================================================
I will report an error because the connection to OPENAI in China is blocked. Is there a big god that can solve the problem of server connection in China? My error message:
Exception in OpenAIRPC AskOpenAI: Basic connection has been closed: An error occurred while sending.
Exception Stack Trace: In System Net HttpWebRequest GetRequestStream (TransportContext&context)
In System Net HttpWebRequest GetRequestStream()
In OpenAIBot OpenAIRPC AskOpenAI (String question)
Exception in OpenAIRPC AskOpenAI: Basic connection has been closed: An error occurred while sending.
Exception Stack Trace: In System Net HttpWebRequest GetRequestStream (TransportContext&context)
 
Back