Jump to content
  • 0

Some scripting Questions.


Question

Posted

PLEASE! For scripters or programmers only.

 

1. What programming language does ragnarok is/are currently using?

 

2. Is it possible to call the variable name of the player's name?

 

For example:

 

String PlayerNameVariable = Crucified Death

 

System.out.println("New Player: " + PlayerNameVariable);

 

Output: NewPlayer: Crucified Death

 

if you can understand the system block above, basically I want to add some kind of a "Title" before the player's name.

The language that I used above is java language.

 

That's all.

 

 

Please for experienced scripters or programmers only.

 

 

I'm a programmer my self and knows how to code. But there are some elements that are missing or I didn't know still.

 

THANK YOU GUYS FOR ALL THOSE WHO ARE INTERESTED TO HELP :)!

 

More power rAthena!

 

Shout out to Emistry :)

18 answers to this question

Recommended Posts

  • 0
Posted

What do you mean by modifying? Ok here's the full explaination. Think about it as a BTS quest. Every part that they complete, they will have a title before the player's IGN. I can somehow do the npc script but I don't know how to call the player's name variable (if there's something like that).

 

For example, a specific player completed the first part of the BTS quest which for example is the Valk Helm. after the quest, their name will be "VH Holder Crucified Death" something like that.

  • 0
Posted (edited)

PLEASE! For scripters or programmers only.

 

1. What programming language does ragnarok is/are currently using?

 

2. Is it possible to call the variable name of the player's name?

 

For example:

 

String PlayerNameVariable = Crucified Death

 

System.out.println("New Player: " + PlayerNameVariable);

 

Output: NewPlayer: Crucified Death

 

if you can understand the system block above, basically I want to add some kind of a "Title" before the player's name.

The language that I used above is java language.

 

That's all.

 

 

Please for experienced scripters or programmers only.

 

 

I'm a programmer my self and knows how to code. But there are some elements that are missing or I didn't know still.

 

THANK YOU GUYS FOR ALL THOSE WHO ARE INTERESTED TO HELP :)!

 

More power rAthena!

 

Shout out to Emistry :)

 

 

1.- Ragnarok use two types of programming languajes, the game SOURCE its on C and the scripts that you can found in /npc (npc, minor functions, and another things that the players see directly for example) are in "Athena", a lenguaje created for ragnarok itself. its easy to learn and every function and commands for the scripts are in the file doc/script_commands.txt

 

2.- If you want to create a title before the name, or edit all the name, you can edit the source, you can find what are you looking for in src/map/clif.c in the function void clif_charnameack (int fd, struct block_list *bl), i'm sure that you will not have problems finding the way to do this, but if you have problems just PM me

Edited by Enthr
  • 0
Posted (edited)

my pseudo for that would be,

 

save the original name from database

if quest == completed then

newname = title+originalname
update char name of the character from the character database to newname

Downside of this would be a constant name changing.

Edited by benching
  • 0
Posted

Enthr said what I was about to.
Also, take some time to take a close look on the doc folder, all the Script Commands and AtCommands that may be used, avoiding Source Snippets, are listed and explained there.

  • 0
Posted

PD: Dont forget that the new name to show cant exceed 24 characters

and in the method that i'm saying, the original player name will not change, only the visible name for the players who put the cursor in him


PDD: (And in the scripts, if you only want to know the name of the character for what i was reading in your reply to benching, just use strcharinfo(0))

  • 0
Posted (edited)

@Enthr
yep, but if he use the method i said, using strcharinfo(0) will cause,
newname = title+(title+newname); // this will happen on 2nd name change and up.

 

with all the info you know from src,

kind of jealous here /heh lol, i should touch src soon

Edited by benching
  • 0
Posted (edited)

Ok guys thanks but I think you're going on the wrong direction.

 

What I'm trying to say here is if the player completed my custom quest, it'll broadcast the player's name and there will be a "title" added before the player's name.

 

Rank 1 = Newbie

Rank 2 = Seasonal

Rank 3 = Addicted

Rank 4 = Pro

Rank 5 = God

 

If a player completed the 1st quest, the title "Newbie" will be added to his/her name.

eg: Newbie Player

If a player completed the 2nd quest, the title "Seasonal" will be added to his/her name.

eg: Seasonal Player

 

...

 

Also, I want it to be automatic not manually. Manual changing or customizing will be hell of an effort.

 

The quest will be a chain quest. You cant do the Rank 4 quest if you're currently on the Rank 2 quest.

Edited by CrucifiedDeath
  • 0
Posted

what you ask is how to add prefix/title to player name,
we give you possible ways to do it, i didn't know you were asking for a whole script.

 

 

if you want to know more, go for @haziel's suggestion,

Enthr said what I was about to.
Also, take some time to take a close look on the doc folder, all the Script Commands and AtCommands that may be used, avoiding Source Snippets, are listed and explained there.


or go to wiki: https://rathena.org/wiki/

  • 0
Posted
switch ( rank_level ) {
	case 1: .@rank_title$ = "Rank 1"; break;
	case 2: .@rank_title$ = "Rank 2"; break;
	case 3: .@rank_title$ = "Rank 3"; break;
	case 4: .@rank_title$ = "Rank 4"; break;
	default:
		.@rank_title$ = "Default Title"; 
		break;
}
announce "Congratulation to ["+.@rank_title$+"] "+strcharinfo(0)+" for completed the quests.",bc_all;

you could try something like this.

of course there are alot of ways to do this as well.

  • 0
Posted

Hi Emistry! :). I want the title or prefix for the player to be permanent. Even if the player logged out and in, there's still the title or prefix. Not just in broadcast, but also when you hover on some player's name, there will be a prefix.

  • 0
Posted (edited)

So if you want it to be permanent you can just change the name adding the prefix. ¿How do you change it when the player level up? just use explode and change the first term in the new array.

You can see how the explode works in the doc.

If you dont want to change the name of the character, and just only add the prefix like when you hover on a character, you need to change the things that i say in the source and do a function in the scripts to comprobate when you wanna do a broadcast o a thing like that.


Also, the variable that emistry is using, is permanent to the character, it will not go when it logout

Edited by Enthr
  • 0
Posted (edited)

Maybe this is what you want. Try it :)

function<TAB>script<TAB>Func_RefreshRank<TAB>{
switch ( rank_level ) {
case 1: .@rank_title$ = "Seasonal"; break;
case 2: .@rank_title$ = "Addicted"; break;
case 3: .@rank_title$ = "Pro"; break;
case 4: .@rank_title$ = "God"; break;
default:
.@rank_title$ = "Newbie";
break;
}
atcommand "@fakename "+strcharinfo(0)+" - "+.@rank_title$;
return;
}

Just simply run this function "Func_RefreshRank" after you change your rank_level variable.

 

Maybe you need this too. A suggestion:

This will auto change the name for you when character enter a map.

-<TAB>script<TAB>RankSystem<TAB>-1,{
OnPCLoadMapEvent:
Func_RefreshRank();
}
Edited by yuchinin
  • Upvote 1
  • 0
Posted

Guys sorry if I don't have time trying out your suggestion. I'm kinda busy because of school activities and project. But I will try them all as long as I'm done with my school activities.


Please don't close this topic yet.

 

Thank you!

 

Shout out to Emistry :)

  • 0
Posted (edited)

 

Maybe this is what you want. Try it :)

function<TAB>script<TAB>Func_RefreshRank<TAB>{
switch ( rank_level ) {
case 1: .@rank_title$ = "Seasonal"; break;
case 2: .@rank_title$ = "Addicted"; break;
case 3: .@rank_title$ = "Pro"; break;
case 4: .@rank_title$ = "God"; break;
default:
.@rank_title$ = "Newbie";
break;
}
atcommand "@fakename "+strcharinfo(0)+" - "+.@rank_title$;
return;
}

Just simply run this function "Func_RefreshRank" after you change your rank_level variable.

 

Maybe you need this too. A suggestion:

This will auto change the name for you when character enter a map.

-<TAB>script<TAB>RankSystem<TAB>-1,{
OnPCLoadMapEvent:
Func_RefreshRank();
}

 

using @fakename will hide the guild name

Edited by benching

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...