[Noob@work]Needs help .
Moderator: Moderators
[Noob@work]Needs help .
Hello everybuddy,
im new with MoH scripting but i have a big problem.
I need a script to print textes on the clientside.
Now its easy i think iprint "Hello User" .
But after a try in the console its write only Hello.
After a space ther write nothing.
I need the script to write from HLSW or ASE or my Python Script to the users.
Infos likes Time , How many player joinet today and so.
Can some one help me , please ?
Im german and my english is very bad so i dosent asked some one bevor.
But now its importent for me.
Lots of thanks.
Greets KC25m
im new with MoH scripting but i have a big problem.
I need a script to print textes on the clientside.
Now its easy i think iprint "Hello User" .
But after a try in the console its write only Hello.
After a space ther write nothing.
I need the script to write from HLSW or ASE or my Python Script to the users.
Infos likes Time , How many player joinet today and so.
Can some one help me , please ?
Im german and my english is very bad so i dosent asked some one bevor.
But now its importent for me.
Lots of thanks.
Greets KC25m
Noob @ Work.
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
It seems that the Linux version has a script parsing deficiency. I'm afraid you'll have to use underscores (the '_' char).
As to what you're trying to do, it's impossible with the MoHAA scripting. You'd have to establish RCON access on the server and use an UDP client to issue console commands to the server (the protocol is fairly simple). Which is, as far as I know, easily doable with Python.
As to what you're trying to do, it's impossible with the MoHAA scripting. You'd have to establish RCON access on the server and use an UDP client to issue console commands to the server (the protocol is fairly simple). Which is, as far as I know, easily doable with Python.
i use a Python Socket UDP to connect to the server ,
i send status , got the result back.
Test for new players and when some one comes in i will send Hello PlayerName ...
But when i send iprint "Hello "+str(Name) its displays only Hello.
i think this is a mistake of me so i tryed on server in console to write iprint "Hello Users" and ... its comes only Hello.
i dont will have _ i will have some spaces ...
so i think when i write a funktione vprint as script in moh i can use it over console , 2.
is it right ?
i send status , got the result back.
Test for new players and when some one comes in i will send Hello PlayerName ...
But when i send iprint "Hello "+str(Name) its displays only Hello.
i think this is a mistake of me so i tryed on server in console to write iprint "Hello Users" and ... its comes only Hello.
i dont will have _ i will have some spaces ...
so i think when i write a funktione vprint as script in moh i can use it over console , 2.
is it right ?
Noob @ Work.
yea but when i write it : rcon say Hello USERNAME ... its works fine.
so i think i need qutes iprint "Hello \""+NAME+"\""
example :
iprint "Hello User"
so i have only 2 comands iprint and the string.
but , its dosent works.
From Game self when im on Server i write rcon iprint "Hello U" its dosent works,2.
so i think i need qutes iprint "Hello \""+NAME+"\""
example :
iprint "Hello User"
so i have only 2 comands iprint and the string.
but , its dosent works.
From Game self when im on Server i write rcon iprint "Hello U" its dosent works,2.
Noob @ Work.
-
Green Beret
- Major General
- Posts: 746
- Joined: Mon Apr 19, 2004 12:21 pm
- Contact:
Ah my original reply was wrong (as you already mentioned). In fact what happens is that rcon strips quotes.. hence iprint "hello world" would become iprint hello world.. recognized as iprint with arguments hello and world. iprint takes only the first argument.
Say, on the other hand, takes multiple arguments.
say arg1 arg2 arg3 ... argn
That's why you can say something with spaces in between without using quotes.
That said, the only way I can think of to solve your problem is by setting a cvar via rcon with a custom seperator character, and have a script (.scr) running on the server that reads this cvar, adds spaces, prints it, then empties the cvar.
It would work like this:
Add a call to your printing script from map script (i.e. maps/dm/mohdm1.scr, do this for all maps):
Then the file global/KC25m/printer.scr (example):
Unless I made a mistake somewhere you can now iprint to all players by rconing 'rcon set KC25m_iprint Hello_World' and it will print 'Hello World' with a space.
Good luck
Say, on the other hand, takes multiple arguments.
say arg1 arg2 arg3 ... argn
That's why you can say something with spaces in between without using quotes.
That said, the only way I can think of to solve your problem is by setting a cvar via rcon with a custom seperator character, and have a script (.scr) running on the server that reads this cvar, adds spaces, prints it, then empties the cvar.
It would work like this:
Add a call to your printing script from map script (i.e. maps/dm/mohdm1.scr, do this for all maps):
Code: Select all
(...)
// find this line
level waittill spawn
// add this directly below (example)
exec global/KC25m/printer.scr
(...)
Code: Select all
main:
local.mycvar = KC25m_iprint
local.space_surrogate = "_" // may NOT be ';'
local.space = " " // a space
// loop forever
while(1)
{
local.string = getcvar local.mycvar
// checks if string is not empty
if(local.string)
{
// replace surrogate char with a space
local.string = waitthread char_replace local.string local.space_surrogate local.space
// print to all players
waitthread broadcast local.string 0
// clear cvar
setcvar local.mycvar ""
}
// need this or it'll crash
waitframe
}
end
// replaces any chars in string matching find with replace
// find and replace should be single characters
char_replace local.string local.find local.replace:
// the result
local.result = ""
// strings start indexing at 0
// vectors start indexing at 0
// arrays start indexing at 1
for(local.i = 0; local.i < local.string.size; local.i++)
{
// I believe strings are immutable,
// so making a new string with the result.
// Might not be necessary to do it this way, though
local.char = local.string[local.i]
if(local.char == local.find)
{
local.result += local.replace
}
else
{
local.result += local.char
}
}
end local.result
// broadcasts string to all players
// if bold is set to 1, text will print in white clicking text
// if bold is set to 0, text will print in yellow
broadcast local.string local.bold:
// strings start indexing at 0
// vectors start indexing at 0
// arrays start indexing at 1
// $player is an array of Players
// $player == $player[1] when there is only 1 player
for(local.i = 1; local.i <= $player.size; local.i++)
{
$player[local.i] iprint local.string local.bold
}
end
Good luck
Strings are immutable in Java, i know. But it's a transparant difference, you can initiate a different string via the same pointer and it will make a new one. I believe MOH is the same way, although i'm not completely sure. I'd be surprised if they didn't support it.
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
There's a lot of info in our tutorials section (see main page) and at Bjarne's site:
http://gronnevik.se/rjukan/
http://gronnevik.se/rjukan/
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
I don't think so, unless there are some German community websites that have scripting tutorials.
The language is a custom language developed by the authors of Heavy Metal FAKK 2 (the game MoHAA is based upon). It's a cross between C and PHP with some custom features. I'm afraid there are no e-books for it, just the documentation included with MoH Radiant and/or Spearhead SDK.
The language is a custom language developed by the authors of Heavy Metal FAKK 2 (the game MoHAA is based upon). It's a cross between C and PHP with some custom features. I'm afraid there are no e-books for it, just the documentation included with MoH Radiant and/or Spearhead SDK.
@jv_map u script prints all 2 time on display 
i must clear cvar after copy into a string ...
or i get it to times on screen.
But its runs fine.
Now a question u write that i can print withe and yellow texts but how can i give the arguments dynamic not in script ?
Yea something of the scripts looks likes C and PHP.
i think when i find german toturials i can write own good scripts
Thanks for the Answers .
i must clear cvar after copy into a string ...
or i get it to times on screen.
But its runs fine.
Now a question u write that i can print withe and yellow texts but how can i give the arguments dynamic not in script ?
Yea something of the scripts looks likes C and PHP.
i think when i find german toturials i can write own good scripts
Thanks for the Answers .
Noob @ Work.



