Author Topic: Urgent Problem, needs fixing ASAP  (Read 10917 times)

0 Members and 2 Guests are viewing this topic.

Offline SpiltCoffee

  • Veteran
  • *****
  • Posts: 1579
  • Spilt, not Split!
    • SpiltCoffee's Site
Re: Urgent Problem, needs fixing ASAP
« Reply #20 on: April 08, 2010, 03:26:42 am »
What a guess! :D
When life hands you High Fructose Corn Syrup, Citric Acid, Ascorbic Acid, Maltodextrin, Sodium Acid Pyrophosphate,
Magnesium Oxide, Calcium Fumarate, Yellow 5, Tocopherol and Less Than 2% Natural Flavour... make Lemonade!

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Urgent Problem, needs fixing ASAP
« Reply #21 on: April 09, 2010, 03:22:01 am »
new problem:

http://pastebin.com/fjKxxADT

basically i have tried to add a cost increaser and dynamic cost for buy dex. See the pastebin for full details.

getting a type mismatch error

for those who have just gone through the pastebin:
DEC is constantly increasing and already goes past the limit for Byte but is perfect for Integer

same as DECC

so why is the compiler throwing me the error?

btw i am using my server to test new code, so my server is now offline until the problem is solved

any good pascal compilers out there i can use that are EASY to use? so that debugging will be simpler as i will be able to copy and paste code, and find out the errors that way?
« Last Edit: April 09, 2010, 03:24:16 am by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline SpiltCoffee

  • Veteran
  • *****
  • Posts: 1579
  • Spilt, not Split!
    • SpiltCoffee's Site
Re: Urgent Problem, needs fixing ASAP
« Reply #22 on: April 09, 2010, 08:23:04 am »
DEC is an Integer, but you're trying to use it in a String. You have to use IntToStr on DEC to convert it from an Integer to a String to write it to console.

Code: (pascal) [Select]
WriteConsole(0,IdtoName(ID)+' has just bought bigger bangs for '+DEC+' Cash',$EE81FAA1);

//try this instead
WriteConsole(0,IdtoName(ID)+' has just bought bigger bangs for '+IntToStr(DEC)+' Cash',$EE81FAA1);
When life hands you High Fructose Corn Syrup, Citric Acid, Ascorbic Acid, Maltodextrin, Sodium Acid Pyrophosphate,
Magnesium Oxide, Calcium Fumarate, Yellow 5, Tocopherol and Less Than 2% Natural Flavour... make Lemonade!

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Urgent Problem, needs fixing ASAP
« Reply #23 on: April 09, 2010, 10:05:19 am »
any good pascal compilers out there i can use that are EASY to use? so that debugging will be simpler as i will be able to copy and paste code, and find out the errors that way?
pascal compilers would choke on scriptcore code and bleed to death. Use this instead: http://forums.soldat.pl/index.php?topic=26011.msg305925#msg305925

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Urgent Problem, needs fixing ASAP
« Reply #24 on: April 09, 2010, 08:24:42 pm »
thanks, now it works perfect :)

From: April 10, 2010, 10:38:04 pm
getting an assignment expected error as soon as i added these parts of code, again its not pointing to any of these sections but once i comment them out it works, even the pascal IDE doesnt see what the problem is

http://pastebin.com/vrxTBmXL
« Last Edit: April 10, 2010, 10:38:04 pm by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Urgent Problem, needs fixing ASAP
« Reply #25 on: April 11, 2010, 06:18:33 am »
line 15 in the paste

for i := 1 to NumPlayers do

Offline Silnikos

  • Soldier
  • **
  • Posts: 129
Re: Urgent Problem, needs fixing ASAP
« Reply #26 on: April 11, 2010, 06:55:16 am »
actually, the NumPlayers works only on the newest beta server version.

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Urgent Problem, needs fixing ASAP
« Reply #27 on: April 11, 2010, 08:03:07 am »
I'm sure you mean HighestID.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Urgent Problem, needs fixing ASAP
« Reply #28 on: April 11, 2010, 01:00:38 pm »
no, Numplayers works fine

i was just missing the : next to the =

now its workng perfect, so Numplayers must work on both the beta and older versions if its working in my script
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Urgent Problem, needs fixing ASAP
« Reply #29 on: April 11, 2010, 08:09:55 pm »
no no he really does mean HighestID. if you have 3 players in-game, ids are 1, 2, and 4 (since player # 3 left), i will become 1, 2, then 3.. thats it... player id 4 will never get accessed.
or just use 32 if ur not using that version of scripting core (too lazy to look through the topic :P)

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Urgent Problem, needs fixing ASAP
« Reply #30 on: April 12, 2010, 12:33:10 am »
Quote
Numplayers works fine


did u even read that bit? i know that he did mean HighestID but

NumPlayers IS working PERFECTLY

please do not post if you havent read the topic, that is really annoying :P


From: April 12, 2010, 01:00:05 am
Code: (pascal) [Select]
//  if Text = '/buy ally' then begin
    if Cash < 10000 then begin
        WriteConsole(0,IdtoName(ID)+' just tried to purchase an ally, not enough funds!',$EE81FAA1);
     end;
     if Cash >= 10000 then begin
         Cash :=Cash-10000;
         Command('/setteam1 '+inttostr(Botn));
         WriteConsole(0,IdtoName(ID)+' has just bought an ally for 10000 Cash',$EE81FAA1);
     end;
  end;

this section of code is giving me a type mismatch error, again not pointing to this section but once its commented out it compiles

Botn is a Byte, how to i convert byte to string?

From: April 12, 2010, 01:03:30 am
also for some reason this line type gives me a type mismatch error

i have 2 lines exactly like this

Code: (pascal) [Select]
Command('/maxrespawntime 20');
« Last Edit: April 12, 2010, 01:03:30 am by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline SpiltCoffee

  • Veteran
  • *****
  • Posts: 1579
  • Spilt, not Split!
    • SpiltCoffee's Site
Re: Urgent Problem, needs fixing ASAP
« Reply #31 on: April 12, 2010, 01:33:40 am »
Quote
Numplayers works fine


did u even read that bit? i know that he did mean HighestID but

NumPlayers IS working PERFECTLY

please do not post if you havent read the topic, that is really annoying :P
That might be the case, but when iterating through all players, it's not a particularly good idea to use NumPlayers, since it's possible to get players who have IDs that are higher than NumPlayers is, and so you never perform operations on them.

Take, for example, a full server. Then it diminishes to two people in slots 1 and 12 (so NumPlayers will be 2). Anything you try to do with a for loop using NumPlayers will only affect the first player; the second player has an ID greater than what NumPlayers has.

In 2.6.5, I'd recommend using 32 instead of NumPlayers, and in 2.7.0, since HighestID is implemented in the 2.7.0 ScriptCore, use HighestID over NumPlayers.

Just food for thought. :)
When life hands you High Fructose Corn Syrup, Citric Acid, Ascorbic Acid, Maltodextrin, Sodium Acid Pyrophosphate,
Magnesium Oxide, Calcium Fumarate, Yellow 5, Tocopherol and Less Than 2% Natural Flavour... make Lemonade!

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Urgent Problem, needs fixing ASAP
« Reply #32 on: April 12, 2010, 01:53:05 am »
thankyou spilt, now how do i get my code to work? please see below the post that you quoted
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline SpiltCoffee

  • Veteran
  • *****
  • Posts: 1579
  • Spilt, not Split!
    • SpiltCoffee's Site
Re: Urgent Problem, needs fixing ASAP
« Reply #33 on: April 12, 2010, 03:24:10 am »
When you get an error, the reported line number that the ScriptCore gives you is a couple of lines ahead for whatever reason (really annoying). You'll have to post some of the code that precedes those two sections of code, just in case the error is actually occurring there.
When life hands you High Fructose Corn Syrup, Citric Acid, Ascorbic Acid, Maltodextrin, Sodium Acid Pyrophosphate,
Magnesium Oxide, Calcium Fumarate, Yellow 5, Tocopherol and Less Than 2% Natural Flavour... make Lemonade!

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Urgent Problem, needs fixing ASAP
« Reply #34 on: April 12, 2010, 03:33:08 am »
but if the error isnt occuring when those lines are commented out then the script wouldnt even compile so how can that be? but anyways heres the code for those two lines

Code: (pascal) [Select]
if Text = '/deathexplode' then begin
      WriteConsole(0,'death explosions enabled', $00EE0000);
      //Command('/maxrespawntime 20');
      WriteLn('death explosions have been enabled by ' + IntToStr(ID) + '!');
      deathexp := True;
   end;

   if Text = '/nodeathexp' then begin
      WriteConsole(0,'death explosions disabled', $00EE0000);
      //Command('/maxrespawntime 2');
      WriteLn('death explosions have been disabled by ' + IntToStr(ID) + '!');
      deathexp := False;
   end;

please answer my question

Quote
how do i convert a byte to string

and why is this code giving me a type mismatch error?

Code: (pascal) [Select]
  if Text = '/buy ally' then begin
    if Cash < 10000 then begin
        WriteConsole(0,IdtoName(ID)+' just tried to purchase an ally, not enough funds!',$EE81FAA1);
     end;
     if Cash >= 10000 then begin
         Cash :=Cash-10000;
         Command('/setteam1 '+inttostr(Botn));
         WriteConsole(0,IdtoName(ID)+' has just bought an ally for 10000 Cash',$EE81FAA1);
     end;
  end;

Botn is a byte, i am trying to convert it to string but cannot find any syntax that allows it

i mean inttostr is on neither of these sites, so whats the best place to get ALL the syntax for soldat?
these are the sites i have, not even the syntax for Copy is there:
http://devs.soldat.pl/wiki/index.php?title=Category:Server_Scripting
http://enesce.com/help/

From: April 13, 2010, 02:46:07 am
Bump
« Last Edit: April 13, 2010, 02:46:07 am by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Urgent Problem, needs fixing ASAP
« Reply #35 on: April 14, 2010, 03:27:03 am »
omg type conversion ;_;
inttostr to convert byte, integer and longint to string (reverse - strtoint)
floattostr to convert single and double to string (reverse - strtofloat)

strtoint and strtofloat should also work on the char type i think

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Urgent Problem, needs fixing ASAP
« Reply #36 on: April 14, 2010, 12:02:45 pm »
@dnmr: forgot type extended for floattostr / strtofloat; Iuuno about char, but should be noted: Chr for Byte -> Char and Ord for Char -> Byte (which then can be InttoStr / StrtoInt`ed).

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Urgent Problem, needs fixing ASAP
« Reply #37 on: April 14, 2010, 03:08:04 pm »
@dnmr: forgot type extended for floattostr / strtofloat; Iuuno about char, but should be noted: Chr for Byte -> Char and Ord for Char -> Byte (which then can be InttoStr / StrtoInt`ed).
wellll, you could add word and whatnot you guys have in there. Never used them though, so didnt want to complicate things by using more weird terms |:

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Urgent Problem, needs fixing ASAP
« Reply #38 on: April 14, 2010, 07:24:58 pm »
@dnmr: forgot type extended for floattostr / strtofloat; Iuuno about char, but should be noted: Chr for Byte -> Char and Ord for Char -> Byte (which then can be InttoStr / StrtoInt`ed).
wellll, you could add word and whatnot you guys have in there. Never used them though, so didnt want to complicate things by using more weird terms |:
good point, sorryz (and i feel silly for completely forgetting about the million other types of integers heh) :(

InttoStr converts any sort of integer into a string, vice-versa is StrtoInt
FloattoStr converts any sort of floating point value into a string; StrtoFloat is vice-versa

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Urgent Problem, needs fixing ASAP
« Reply #39 on: April 15, 2010, 01:15:29 am »
btw HighestID doesnt work

i changed NumPlayers to HighestID and im getting errors as a result

Code: [Select]
Unknown identifier 'HighestID'
check out my server! click here

If at first you don't succeed, Improvise! :D